Skip to content

Commit 498d037

Browse files
authored
Fixes two-handed items and runtimes (#869)
* fixx 2h items * make monochrome ghost pref work * buff synaptizine * fix cleanbot getting confused with blood on walls * no more self headbutt * pm fixes
1 parent a80428e commit 498d037

File tree

21 files changed

+77
-56
lines changed

21 files changed

+77
-56
lines changed

code/__DEFINES/dcs/signals/signals_mob/signals_mob_living.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
///called on /living when attempting to pick up an item, from base of /mob/living/put_in_hand_check(): (obj/item/I)
1+
///called on /living when attempting to pick up an item, from base of /mob/living/can_put_in_hand(): (obj/item/I)
22
#define COMSIG_LIVING_TRY_PUT_IN_HAND "living_try_put_in_hand"
33
/// Can't pick up
44
#define COMPONENT_LIVING_CANT_PUT_IN_HAND (1<<0)

code/_onclick/hud/rendering/plane_master.dm

-4
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@
127127
/atom/movable/screen/plane_master/above_lighting
128128
name = "above lighting plane master"
129129
plane = ABOVE_LIGHTING_PLANE
130-
appearance_flags = PLANE_MASTER //should use client color
131130
blend_mode = BLEND_OVERLAY
132131

133132
///Contains space parallax
@@ -144,7 +143,6 @@
144143
/atom/movable/screen/plane_master/pipecrawl
145144
name = "pipecrawl plane master"
146145
plane = PIPECRAWL_IMAGES_PLANE
147-
appearance_flags = PLANE_MASTER
148146
blend_mode = BLEND_OVERLAY
149147

150148
/atom/movable/screen/plane_master/pipecrawl/Initialize(mapload)
@@ -158,7 +156,6 @@
158156
/atom/movable/screen/plane_master/camera_static
159157
name = "camera static plane master"
160158
plane = CAMERA_STATIC_PLANE
161-
appearance_flags = PLANE_MASTER
162159
blend_mode = BLEND_OVERLAY
163160

164161
/atom/movable/screen/plane_master/o_light_visual
@@ -172,7 +169,6 @@
172169
/atom/movable/screen/plane_master/runechat
173170
name = "runechat plane master"
174171
plane = RUNECHAT_PLANE
175-
appearance_flags = PLANE_MASTER
176172
blend_mode = BLEND_OVERLAY
177173
render_relay_plane = RENDER_PLANE_NON_GAME
178174

code/datums/ai/generic/generic_behaviors.dm

+1-3
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,10 @@
169169
var/obj/item/target = target_ref.resolve()
170170

171171
if(!(target in living_pawn.held_items))
172-
if(!living_pawn.put_in_hand_check(target))
172+
if(!living_pawn.put_in_hands(target))
173173
finish_action(controller, FALSE, target, hunger_timer_key)
174174
return
175175

176-
living_pawn.put_in_hands(target)
177-
178176
target.melee_attack_chain(living_pawn, living_pawn)
179177

180178
if(QDELETED(target) || prob(10)) // Even if we don't finish it all we can randomly decide to be done

code/game/objects/items.dm

+5-8
Original file line numberDiff line numberDiff line change
@@ -622,12 +622,9 @@ DEFINE_INTERACTABLE(/obj/item)
622622
if(!allow_attack_hand_drop(user) || !user.temporarilyRemoveItemFromInventory(src))
623623
return
624624

625-
. = FALSE
626-
pickup(user)
627625

628-
if(!user.put_in_active_hand(src, FALSE, was_in_storage))
629-
user.dropItemToGround(src)
630-
return TRUE
626+
// Return FALSE if the item is picked up.
627+
return !user.pickup_item(src, ignore_anim = was_in_storage)
631628

632629
/obj/item/proc/allow_attack_hand_drop(mob/user)
633630
return TRUE
@@ -921,9 +918,9 @@ DEFINE_INTERACTABLE(/obj/item)
921918
else if(slot)
922919
user.update_clothing(slot)
923920

924-
// if the item requires two handed, drop the item on unwield
925-
if(HAS_TRAIT(src, TRAIT_NEEDS_TWO_HANDS))
926-
user.dropItemToGround(src, force=TRUE)
921+
// if the item requires two handed, drop the item on unwield
922+
if(HAS_TRAIT(src, TRAIT_NEEDS_TWO_HANDS))
923+
user.dropItemToGround(src, force=TRUE)
927924

928925
// Show message if requested
929926
if(show_message)

code/game/objects/items/grenades/_grenade.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@
221221
if(damage && attack_type == PROJECTILE_ATTACK && hit_projectile.damage_type != STAMINA && prob(15))
222222
return TRUE
223223

224-
/obj/item/grenade/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", damage = 0, attack_type = MELEE_ATTACK)
224+
/obj/item/grenade/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", damage = 0, attack_type = MELEE_ATTACK, block_success = TRUE)
225225
. = ..()
226226
if(!.)
227227
return

code/game/objects/items/offhand.dm

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636

3737
/obj/item/offhand/proc/deleteme(datum/source, mob/user)
3838
SIGNAL_HANDLER
39-
40-
qdel(src)
39+
if(!QDELETED(src))
40+
qdel(src)
4141

4242
/obj/item/offhand/proc/try_swap_hands(datum/source, obj/item/held_item)
4343
SIGNAL_HANDLER

code/modules/antagonists/highlander/highlander.dm

+1-2
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,8 @@
7373
sword = new(H)
7474
if(!GLOB.highlander_controller)
7575
sword.flags_1 |= ADMIN_SPAWNED_1 //To prevent announcing
76-
sword.pickup(H) //For the stun shielding
77-
H.put_in_hands(sword)
7876

77+
H.pickup_item(sword)
7978

8079
var/obj/item/bloodcrawl/antiwelder = new(H)
8180
antiwelder.name = "compulsion of honor"

code/modules/cards/cardhand.dm

+2-4
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,12 @@
7373
return FALSE
7474

7575
var/obj/item/toy/singlecard/selected_card = draw(user, choice)
76-
selected_card.pickup(user)
77-
user.put_in_hands(selected_card)
76+
user.pickup_item(selected_card)
7877

7978
if(cards.len == 1)
8079
user.temporarilyRemoveItemFromInventory(src, TRUE)
8180
var/obj/item/toy/singlecard/last_card = draw(user)
82-
last_card.pickup(user)
83-
user.put_in_hands(last_card)
81+
user.pickup_item(last_card)
8482
qdel(src) // cardhand is empty now so delete it
8583

8684
/obj/item/toy/cards/cardhand/proc/check_menu(mob/living/user)

code/modules/cards/deck/deck.dm

+2-2
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@
153153
return
154154
if(flip_card)
155155
card.Flip()
156-
card.pickup(user)
157-
user.put_in_hands(card)
156+
157+
user.pickup_item(card)
158158
user.balloon_alert_to_viewers("draws a card")
159159

160160
/obj/item/toy/cards/deck/attack_hand_secondary(mob/living/user, list/modifiers)

code/modules/cards/singlecard.dm

+1-2
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,7 @@
173173

174174
if(!isturf(loc)) // make a cardhand in our active hand
175175
user.temporarilyRemoveItemFromInventory(src, TRUE)
176-
new_cardhand.pickup(user)
177-
user.put_in_active_hand(new_cardhand)
176+
user.pickup_item(new_cardhand)
178177
return
179178

180179
if(istype(item, /obj/item/toy/cards/cardhand)) // insert into cardhand

code/modules/client/preferences/monochrome_ghost.dm

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
return
1212

1313
if(value && !M.started_as_observer)
14+
if(locate(/datum/client_colour/ghostmono) in M.client_colours)
15+
return
1416
M.add_client_colour(/datum/client_colour/ghostmono)
1517
else
1618
M.remove_client_colour(/datum/client_colour/ghostmono)

code/modules/grab/grabs/grab_normal.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
return FALSE
117117

118118
/datum/grab/normal/resolve_openhand_attack(obj/item/hand_item/grab/G)
119-
if(!G.assailant.combat_mode)
119+
if(!G.assailant.combat_mode || G.assailant == G.affecting)
120120
return FALSE
121121
if(G.target_zone == BODY_ZONE_HEAD)
122122
if(G.assailant.zone_selected == BODY_ZONE_PRECISE_EYES)

code/modules/mob/dead/observer/observer.dm

+2-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ Works together with spawning an observer, noted above.
220220
ghost.mind = null
221221

222222
if(!admin_ghost)
223-
ghost.add_client_colour(/datum/client_colour/ghostmono)
223+
if(!ghost.client?.prefs || ghost.client.prefs.read_preference(/datum/preference/toggle/monochrome_ghost))
224+
ghost.add_client_colour(/datum/client_colour/ghostmono)
224225

225226
return ghost
226227

code/modules/mob/inventory.dm

+46-17
Original file line numberDiff line numberDiff line change
@@ -143,27 +143,40 @@
143143

144144

145145
//Returns if a certain item can be equipped to a certain slot.
146-
// Currently invalid for two-handed items - call obj/item/mob_can_equip() instead.
147146
/mob/proc/can_equip(obj/item/I, slot, disable_warning = FALSE, bypass_equip_delay_self = FALSE)
148147
return FALSE
149148

150-
/mob/proc/can_put_in_hand(I, hand_index)
151-
if(hand_index > held_items.len)
152-
return FALSE
153-
if(!put_in_hand_check(I))
154-
return FALSE
155-
if(!has_hand_for_held_index(hand_index))
156-
return FALSE
157-
return !held_items[hand_index]
149+
/mob/proc/can_put_in_hand(obj/item/I, hand_index)
150+
return FALSE
151+
152+
/// A helper for picking up an item.
153+
/mob/proc/pickup_item(obj/item/I, hand_index = active_hand_index, ignore_anim)
154+
if(QDELETED(I))
155+
return
156+
157+
if(!can_put_in_hand(I, hand_index))
158+
return
159+
160+
I.pickup(src)
161+
. = put_in_hand(I, hand_index, ignore_anim = ignore_anim)
162+
163+
if(!.)
164+
stack_trace("Somehow, someway, pickup_item failed put_in_hand().")
165+
dropItemToGround(I, silent = TRUE)
158166

159167
/mob/proc/put_in_hand(obj/item/I, hand_index, forced = FALSE, ignore_anim = TRUE)
160-
if(hand_index == null || (!forced && !can_put_in_hand(I, hand_index)))
168+
if(hand_index == null)
169+
return FALSE
170+
171+
if(!forced && !can_put_in_hand(I, hand_index))
161172
return FALSE
162173

163174
if(isturf(I.loc) && !ignore_anim)
164175
I.do_pickup_animation(src)
176+
165177
if(get_item_for_held_index(hand_index))
166178
dropItemToGround(get_item_for_held_index(hand_index), force = TRUE)
179+
167180
I.forceMove(src)
168181
held_items[hand_index] = I
169182
I.plane = ABOVE_HUD_PLANE
@@ -191,14 +204,30 @@
191204
/mob/proc/put_in_r_hand(obj/item/I)
192205
return put_in_hand(I, get_empty_held_index_for_side(RIGHT_HANDS))
193206

194-
/mob/proc/put_in_hand_check(obj/item/I)
195-
return FALSE //nonliving mobs don't have hands
207+
/mob/living/can_put_in_hand(obj/item/I, hand_index)
208+
if(!istype(I))
209+
return FALSE
196210

197-
/mob/living/put_in_hand_check(obj/item/I)
198-
if(istype(I) && ((mobility_flags & MOBILITY_PICKUP) || (I.item_flags & ABSTRACT)) \
199-
&& !(SEND_SIGNAL(src, COMSIG_LIVING_TRY_PUT_IN_HAND, I) & COMPONENT_LIVING_CANT_PUT_IN_HAND))
200-
return TRUE
201-
return FALSE
211+
if(hand_index > held_items.len)
212+
return FALSE
213+
214+
if(!((mobility_flags & MOBILITY_PICKUP) || (I.item_flags & ABSTRACT)))
215+
return FALSE
216+
217+
if(SEND_SIGNAL(src, COMSIG_LIVING_TRY_PUT_IN_HAND, I) & COMPONENT_LIVING_CANT_PUT_IN_HAND)
218+
return FALSE
219+
220+
if(!has_hand_for_held_index(hand_index))
221+
return FALSE
222+
223+
return !held_items[hand_index]
224+
225+
/mob/living/carbon/human/can_put_in_hand(obj/item/I, hand_index)
226+
. = ..()
227+
if(!.)
228+
return
229+
230+
return dna.species.can_equip(I, ITEM_SLOT_HANDS, TRUE, src)
202231

203232
//Puts the item into our active hand if possible. returns TRUE on success.
204233
/mob/proc/put_in_active_hand(obj/item/I, forced = FALSE, ignore_animation = TRUE)

code/modules/mob/living/silicon/silicon.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@
371371

372372
to_chat(src, span_notice("Automatic announcements [chosen_channel == "None" ? "will not use the radio." : "set to [chosen_channel]."]"))
373373

374-
/mob/living/silicon/put_in_hand_check() // This check is for borgs being able to receive items, not put them in others' hands.
374+
/mob/living/silicon/can_put_in_hand(I, hand_index)
375375
return FALSE
376376

377377
/mob/living/silicon/assess_threat(judgement_criteria, lasercolor = "", datum/callback/weaponcheck=null) //Secbots won't hunt silicon units

code/modules/mob/living/simple_animal/bot/cleanbot.dm

+2-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@
330330
if(HAS_TRAIT(src, TRAIT_HANDS_BLOCKED))
331331
return
332332
. = ..()
333-
if(ismopable(attack_target))
333+
if(ismopable(attack_target) || istype(attack_target, /obj/effect/decal/cleanable/blood))
334334
mode = BOT_CLEANING
335335
update_icon_state()
336336
var/turf/T = get_turf(attack_target)
@@ -346,6 +346,7 @@
346346
playsound(src, 'sound/effects/spray2.ogg', 50, TRUE, -6)
347347
attack_target.acid_act(75, 10)
348348
target = null
349+
349350
else if(istype(attack_target, /mob/living/basic/cockroach) || ismouse(attack_target))
350351
var/mob/living/living_target = attack_target
351352
if(!living_target.stat)

code/modules/mod/modules/module_kinesis.dm

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@
9595
if(isitem(grabbed_atom) && (mod.wearer in next_turf))
9696
var/obj/item/grabbed_item = grabbed_atom
9797
clear_grab()
98-
grabbed_item.pickup(mod.wearer)
99-
mod.wearer.put_in_hands(grabbed_item)
98+
mod.wearer.pickup_item(grabbed_item)
10099
return
100+
101101
var/pixel_x_change = 0
102102
var/pixel_y_change = 0
103103
var/direction = get_dir(grabbed_atom, next_turf)

code/modules/reagents/chemistry/reagents/medicine_reagents.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@
440440

441441
holder.remove_reagent(/datum/reagent/toxin/mindbreaker, 5)
442442

443-
C.adjustToxLoss(5 * removed, updating_health = FALSE) // It used to be incredibly deadly due to an oversight. Not anymore!
443+
C.adjustToxLoss(3 * removed, updating_health = FALSE) // It used to be incredibly deadly due to an oversight. Not anymore!
444444
APPLY_CHEM_EFFECT(C, CE_PAINKILLER, 20)
445445
APPLY_CHEM_EFFECT(C, CE_STIMULANT, 10)
446446
return TRUE

code/modules/reagents/reagent_containers/hypospray.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@
233233
base_icon_state = "stimpen"
234234
volume = 30
235235
amount_per_transfer_from_this = 30
236-
list_reagents = list(/datum/reagent/medicine/synaptizine = 8, /datum/reagent/medicine/dermaline = 8, /datum/reagent/medicine/meralyne = 8, /datum/reagent/medicine/leporazine = 6)
236+
list_reagents = list(/datum/reagent/medicine/synaptizine = 4, /datum/reagent/medicine/dermaline = 8, /datum/reagent/medicine/meralyne = 8, /datum/reagent/medicine/leporazine = 6)
237237

238238
/obj/item/reagent_containers/hypospray/medipen/survival/inject(mob/living/affected_mob, mob/user)
239239
if(DOING_INTERACTION(user, DOAFTER_SOURCE_SURVIVALPEN))

code/modules/research/machinery/_production.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ DEFINE_INTERACTABLE(/obj/machinery/rnd/production)
244244
if(!(D in internal_disk.read(DATA_IDX_DESIGNS)))
245245
CRASH("Tried to print a design we don't have! Potential exploit?")
246246

247-
playsound(src, 'goon/sounds/button.ogg')
247+
playsound(src, 'goon/sounds/button.ogg', 100)
248248
update_appearance(UPDATE_OVERLAYS)
249249
add_to_queue(D, amount, D.dangerous_construction)
250250
return TRUE

modular_pariah/master_files/code/game/gamemodes/objective.dm

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// For modularity, we hook into the update_explanation_text to be sure we have a target to register.
22
/datum/objective/assassinate/update_explanation_text()
3-
RegisterSignal(target, COMSIG_LIVING_DEATH, PROC_REF(register_target_death))
3+
RegisterSignal(target, COMSIG_LIVING_DEATH, PROC_REF(register_target_death), TRUE)
44
return ..()
5+
56
/datum/objective/assassinate/proc/register_target_death(mob/living/dead_guy, gibbed)
67
SIGNAL_HANDLER
78
completed = TRUE

0 commit comments

Comments
 (0)