Skip to content

Commit 8d98206

Browse files
authored
8.15.24 bugs (#1070)
* cig fix and death debug * withdrawal runtimes * combohud runtime * minor grab runtime * add more grab debug code * more grab code things * fix linters * linters * honestly fuck it * flava * GRAB BUG FIX!! * remove wound analyzer * bad type
1 parent e8a934a commit 8d98206

File tree

16 files changed

+78
-134
lines changed

16 files changed

+78
-134
lines changed

code/__DEFINES/three_dsix.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/// Have nicotine in your blood
2121
#define SKILL_SOURCE_NICOTINE "Nicotine"
2222
/// Have a nicotine withdrawl
23-
#define SKILL_SOURCE_NICOTINE_WITHDRAWL "Nicottine withdrawl"
23+
#define SKILL_SOURCE_NICOTINE_WITHDRAWL "Nicotine withdrawl"
2424
/// Opiod Withdrawl
2525
#define SKILL_SOURCE_OPIOD_WITHDRAWL "Opiod withdrawl"
2626
/// Alchohol withdrawl

code/game/alternate_appearance.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ GLOBAL_LIST_EMPTY(active_alternate_appearances)
125125

126126
/datum/atom_hud/alternate_appearance/basic/remove_atom_from_hud(atom/A)
127127
. = ..()
128-
A.hud_list -= appearance_key
128+
LAZYREMOVE(A.hud_list, appearance_key)
129129
A.set_hud_image_inactive(appearance_key)
130130
if(. && !QDELETED(src))
131131
qdel(src)

code/game/objects/items/cigs_lighters.dm

+5-1
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,9 @@ CIGARETTE PACKETS ARE IN FANCY.DM
801801
/obj/item/lighter/attack_self(mob/living/user)
802802
if(!user.is_holding(src))
803803
return ..()
804+
805+
user.changeNext_move(CLICK_CD_RAPID)
806+
804807
if(lit)
805808
set_lit(FALSE)
806809
if(fancy)
@@ -816,6 +819,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
816819
return
817820

818821
set_lit(TRUE)
822+
819823
if(fancy)
820824
user.visible_message(
821825
span_notice("Without even breaking stride, [user] flips open and lights [src] in one smooth movement."),
@@ -845,7 +849,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
845849
switch(result.outcome)
846850
if(FAILURE, CRIT_FAILURE)
847851
user.apply_damage(5, BURN, user.get_active_hand())
848-
to_chat(user, result.create_tooltip("You burn yourself while lighting the lighter!"))
852+
to_chat(user, result.create_tooltip("Your eagerness to ignite [src] in a stylish fashion has shrouded your care. Your finger is bathed in the flame for a brief moment."))
849853
if(SUCCESS, CRIT_SUCCESS)
850854
to_chat(user, result.create_tooltip("After a few attempts, you manage to light [src]."))
851855
user.visible_message(span_notice("After a few attempts, [user] manages to light [src]."))

code/game/objects/items/devices/scanners/health_analyzer.dm

-75
Original file line numberDiff line numberDiff line change
@@ -307,44 +307,6 @@
307307
desc = "A hand-held body scanner able to distinguish vital signs of the subject with high accuracy."
308308
advanced = TRUE
309309

310-
/// Displays wounds with extended information on their status vs medscanners
311-
/proc/woundscan(mob/user, mob/living/carbon/patient, obj/item/healthanalyzer/wound/scanner, advanced = FALSE)
312-
if(!istype(patient) || user.incapacitated())
313-
return
314-
315-
if(user.is_blind())
316-
to_chat(user, span_warning("You realize that your scanner has no accessibility support for the blind!"))
317-
return
318-
319-
var/data_string_list = ""
320-
var/list/damaged_limbs = patient.get_damaged_bodyparts(TRUE, TRUE)
321-
if(!length(damaged_limbs))
322-
data_string_list += "No detectable limb injuries.\n"
323-
324-
sortTim(damaged_limbs, GLOBAL_PROC_REF(cmp_bodyparts_display_order))
325-
326-
for(var/obj/item/bodypart/limb as anything in damaged_limbs)
327-
var/limb_string = "[capitalize(limb.body_zone)][(limb.bodytype & BODYTYPE_ROBOTIC) ? " <span style='font-weight: bold; color: [COLOR_MEDICAL_ROBOTIC]'>(Cybernetic)</span>" : ""]:"
328-
if(limb.brute_dam)
329-
limb_string += " \[<span style='font-weight: bold; color: [COLOR_MEDICAL_BRUTE]'>[advanced ? "[limb.brute_dam]" + " points of" : get_wound_severity(limb.brute_ratio)] physical trauma</span>\]"
330-
331-
if(limb.burn_dam)
332-
limb_string += " \[<span style='font-weight: bold; color: [COLOR_MEDICAL_BURN]'>[advanced ? "[limb.burn_dam]" + " points of": get_wound_severity(limb.burn_ratio)] burns</span>\]"
333-
334-
if(limb.bodypart_flags & BP_BLEEDING)
335-
limb_string += " \[<span style='font-weight: bold; color: [COLOR_MEDICAL_BRUTE]'>bleeding</span>\]"
336-
337-
data_string_list += (limb_string + "\n")
338-
339-
if(data_string_list == "")
340-
if(istype(scanner))
341-
// Only emit the cheerful scanner message if this scan came from a scanner
342-
to_chat(user, span_notice("[scanner] makes a happy ping and briefly displays a smiley face with several exclamation points! It's really excited to report that [patient] has no wounds!"))
343-
else
344-
to_chat(user, "<span class='notice ml-1'>No wounds detected in subject.</span>")
345-
else
346-
to_chat(user, jointext(data_string_list, ""), type = MESSAGE_TYPE_INFO)
347-
348310
/proc/surgericalscan(mob/living/user, mob/living/carbon/target)
349311
if(!istype(target) || user.incapacitated())
350312
return
@@ -373,43 +335,6 @@
373335

374336
to_chat(user, jointext(data, "<br>"), type = MESSAGE_TYPE_INFO)
375337

376-
/obj/item/healthanalyzer/wound
377-
name = "first aid analyzer"
378-
icon_state = "adv_spectrometer"
379-
desc = "A prototype MeLo-Tech medical scanner used to diagnose injuries and recommend treatment for serious wounds, but offers no further insight into the patient's health. You hope the final version is less annoying to read!"
380-
var/next_encouragement
381-
var/greedy
382-
383-
/obj/item/healthanalyzer/wound/attack_self(mob/user)
384-
if(next_encouragement < world.time)
385-
playsound(src, 'sound/machines/ping.ogg', 50, FALSE)
386-
var/list/encouragements = list("briefly displays a happy face, gazing emptily at you", "briefly displays a spinning cartoon heart", "displays an encouraging message about eating healthy and exercising", \
387-
"reminds you that everyone is doing their best", "displays a message wishing you well", "displays a sincere thank-you for your interest in first-aid", "formally absolves you of all your sins")
388-
to_chat(user, span_notice("\The [src] makes a happy ping and [pick(encouragements)]!"))
389-
next_encouragement = world.time + 10 SECONDS
390-
greedy = FALSE
391-
else if(!greedy)
392-
to_chat(user, span_warning("\The [src] displays an eerily high-definition frowny face, chastizing you for asking it for too much encouragement."))
393-
greedy = TRUE
394-
else
395-
playsound(src, 'sound/machines/buzz-sigh.ogg', 50, FALSE)
396-
if(isliving(user))
397-
var/mob/living/L = user
398-
to_chat(L, span_warning("\The [src] makes a disappointed buzz and pricks your finger for being greedy. Ow!"))
399-
L.adjustBruteLoss(4)
400-
L.dropItemToGround(src)
401-
402-
/obj/item/healthanalyzer/wound/attack(mob/living/carbon/patient, mob/living/carbon/human/user)
403-
add_fingerprint(user)
404-
user.visible_message(span_notice("[user] scans [patient] for serious injuries."), span_notice("You scan [patient] for serious injuries."))
405-
406-
if(!istype(patient))
407-
playsound(src, 'sound/machines/buzz-sigh.ogg', 30, TRUE)
408-
to_chat(user, span_notice("\The [src] makes a sad buzz and briefly displays a frowny face, indicating it can't scan [patient]."))
409-
return
410-
411-
woundscan(user, patient, src)
412-
413338
#undef SCANMODE_HEALTH
414339
#undef SCANMODE_CHEM
415340
#undef SCANMODE_SURGERY

code/game/objects/items/storage/medkit.dm

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
if(empty)
4949
return
5050
var/static/items_inside = list(
51-
/obj/item/healthanalyzer/wound = 1,
5251
/obj/item/stack/gauze = 1,
5352
/obj/item/stack/medical/suture = 1,
5453
/obj/item/stack/medical/ointment = 1,

code/modules/grab/grab_datum.dm

+27-21
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ GLOBAL_LIST_EMPTY(all_grabstates)
185185
SHOULD_CALL_PARENT(TRUE)
186186

187187
G.remove_competing_grabs()
188-
update_stage_effects(G, old_grab)
189188

190189
// Conditions to see if upgrading is possible
191190
/datum/grab/proc/can_upgrade(obj/item/hand_item/grab/G)
@@ -212,7 +211,7 @@ GLOBAL_LIST_EMPTY(all_grabstates)
212211

213212
// What happens when you downgrade from one grab state to the next.
214213
/datum/grab/proc/downgrade_effect(obj/item/hand_item/grab/G, datum/grab/old_grab)
215-
update_stage_effects(G, old_grab)
214+
return
216215

217216
// Conditions to see if downgrading is possible
218217
/datum/grab/proc/can_downgrade(obj/item/hand_item/grab/G)
@@ -226,7 +225,7 @@ GLOBAL_LIST_EMPTY(all_grabstates)
226225

227226
remove_bodyzone_effects(G, G.target_zone)
228227
if(G.is_grab_unique(src))
229-
remove_unique_grab_effects(G)
228+
remove_unique_grab_effects(G.affecting)
230229

231230
update_stage_effects(G, src, TRUE)
232231

@@ -235,42 +234,49 @@ GLOBAL_LIST_EMPTY(all_grabstates)
235234
var/old_damage_stage = old_grab?.damage_stage || GRAB_PASSIVE
236235
var/new_stage = dropping_grab ? GRAB_PASSIVE : damage_stage
237236

237+
var/trait_source = ref(G)
238+
var/atom/movable/affected_movable = G.affecting
239+
238240
switch(new_stage) // Current state.
239241
if(GRAB_PASSIVE)
240-
REMOVE_TRAIT(G.affecting, TRAIT_IMMOBILIZED, REF(G))
241-
REMOVE_TRAIT(G.affecting, TRAIT_HANDS_BLOCKED, REF(G))
242+
REMOVE_TRAIT(affected_movable, TRAIT_IMMOBILIZED, trait_source)
243+
REMOVE_TRAIT(affected_movable, TRAIT_HANDS_BLOCKED, trait_source)
242244
if(old_damage_stage >= GRAB_AGGRESSIVE)
243-
REMOVE_TRAIT(G.affecting, TRAIT_AGGRESSIVE_GRAB, REF(G))
244-
REMOVE_TRAIT(G.affecting, TRAIT_FLOORED, REF(G))
245+
REMOVE_TRAIT(affected_movable, TRAIT_AGGRESSIVE_GRAB, trait_source)
246+
REMOVE_TRAIT(affected_movable, TRAIT_FLOORED, trait_source)
245247

246248
if(GRAB_AGGRESSIVE)
247249
if(old_damage_stage >= GRAB_NECK) // Grab got downgraded.
248-
REMOVE_TRAIT(G.affecting, TRAIT_FLOORED, REF(G))
250+
REMOVE_TRAIT(affected_movable, TRAIT_FLOORED, trait_source)
249251
else // Grab got upgraded from a passive one.
250-
ADD_TRAIT(G.affecting, TRAIT_IMMOBILIZED, REF(G))
251-
ADD_TRAIT(G.affecting, TRAIT_HANDS_BLOCKED, REF(G))
252-
ADD_TRAIT(G.affecting, TRAIT_AGGRESSIVE_GRAB, REF(G))
252+
ADD_TRAIT(affected_movable, TRAIT_IMMOBILIZED, trait_source)
253+
ADD_TRAIT(affected_movable, TRAIT_HANDS_BLOCKED, trait_source)
254+
ADD_TRAIT(affected_movable, TRAIT_AGGRESSIVE_GRAB, trait_source)
253255

254256
if(GRAB_NECK, GRAB_KILL)
255257
if(old_damage_stage < GRAB_AGGRESSIVE)
256-
ADD_TRAIT(G.affecting, TRAIT_AGGRESSIVE_GRAB, REF(G))
258+
ADD_TRAIT(affected_movable, TRAIT_AGGRESSIVE_GRAB, REF(G))
257259
if(old_damage_stage <= GRAB_AGGRESSIVE)
258-
ADD_TRAIT(G.affecting, TRAIT_FLOORED, REF(G))
259-
ADD_TRAIT(G.affecting, TRAIT_HANDS_BLOCKED, REF(G))
260-
ADD_TRAIT(G.affecting, TRAIT_IMMOBILIZED, REF(G))
260+
ADD_TRAIT(affected_movable, TRAIT_FLOORED, REF(G))
261+
ADD_TRAIT(affected_movable, TRAIT_HANDS_BLOCKED, REF(G))
262+
ADD_TRAIT(affected_movable, TRAIT_IMMOBILIZED, REF(G))
261263

264+
//DEBUG CODE
265+
if((new_stage < GRAB_AGGRESSIVE) && HAS_TRAIT_FROM_ONLY(affected_movable, TRAIT_AGGRESSIVE_GRAB, trait_source))
266+
stack_trace("AAAAAA a grab victim somehow still has trait_aggressive_grab when they shouldnt, removing it!")
267+
REMOVE_TRAIT(affected_movable, TRAIT_AGGRESSIVE_GRAB, trait_source)
262268

263269
/// Apply effects that should only be applied when a grab type is first used on a mob.
264-
/datum/grab/proc/apply_unique_grab_effects(obj/item/hand_item/grab/G)
270+
/datum/grab/proc/apply_unique_grab_effects(atom/movable/affecting)
265271
SHOULD_CALL_PARENT(TRUE)
266-
if(same_tile && ismob(G.affecting))
267-
G.affecting.add_passmob(REF(G))
272+
if(same_tile && ismob(affecting))
273+
affecting.add_passmob(ref(src))
268274

269275
/// Remove effects added by apply_unique_grab_effects()
270-
/datum/grab/proc/remove_unique_grab_effects(obj/item/hand_item/grab/G)
276+
/datum/grab/proc/remove_unique_grab_effects(atom/movable/affecting)
271277
SHOULD_CALL_PARENT(TRUE)
272-
if(same_tile && ismob(G.affecting))
273-
G.affecting.remove_passmob(REF(G))
278+
if(same_tile && ismob(affecting))
279+
affecting.remove_passmob(ref(src))
274280

275281
/// Handles special targeting like eyes and mouth being covered.
276282
/// CLEAR OUT ANY EFFECTS USING remove_bodyzone_effects()

code/modules/grab/grab_object.dm

+18-5
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292

9393
// Leave forensics
9494
leave_forensic_traces()
95+
9596
/// Setup signals
9697
var/obj/item/bodypart/BP = get_targeted_bodypart()
9798
if(BP)
@@ -126,6 +127,11 @@
126127
else
127128
stack_trace("Grab (\ref[src]) qdeleted while not having an assailant.")
128129

130+
//DEBUG CODE
131+
if(HAS_TRAIT_FROM(affecting, TRAIT_AGGRESSIVE_GRAB, ref(src)))
132+
stack_trace("Somehow all other safeties failed and [affecting] still is marked as grabbed from a qdeling grab, removing!")
133+
REMOVE_TRAIT(affecting, TRAIT_AGGRESSIVE_GRAB, ref(src))
134+
129135
affecting = null
130136
assailant = null
131137
current_grab = null
@@ -140,6 +146,9 @@
140146

141147
/obj/item/hand_item/grab/update_icon_state()
142148
. = ..()
149+
if(QDELING(src))
150+
return
151+
143152
icon = current_grab.icon
144153
if(current_grab.icon_state)
145154
icon_state = current_grab.icon_state
@@ -289,13 +298,15 @@
289298
return
290299

291300
var/datum/grab/upgrab = current_grab.upgrade(src)
292-
if(!upgrab)
301+
var/datum/grab/oldgrab = current_grab
302+
if(!upgrab || QDELETED(src))
293303
return
294304

295305
if(is_grab_unique(current_grab))
296-
current_grab.remove_unique_grab_effects(src)
306+
current_grab.remove_unique_grab_effects(affecting)
297307

298308
current_grab = upgrab
309+
current_grab.update_stage_effects(src, oldgrab)
299310

300311
COOLDOWN_START(src, upgrade_cd, current_grab.upgrade_cooldown)
301312

@@ -308,26 +319,28 @@
308319
return
309320

310321
if(is_grab_unique(current_grab))
311-
current_grab.apply_unique_grab_effects(src)
322+
current_grab.apply_unique_grab_effects(affecting)
312323

313324
adjust_position()
314325
update_appearance()
315326

316327
/obj/item/hand_item/grab/proc/downgrade(silent)
317328
var/datum/grab/downgrab = current_grab.downgrade(src)
329+
var/datum/grab/oldgrab = current_grab
318330
if(!downgrab)
319331
return
320332

321333
if(is_grab_unique(current_grab))
322-
current_grab.remove_unique_grab_effects(src)
334+
current_grab.remove_unique_grab_effects(affecting)
323335

324336
current_grab = downgrab
337+
current_grab.update_stage_effects(src, oldgrab)
325338

326339
if(!current_grab.enter_as_down(src))
327340
return
328341

329342
if(is_grab_unique(current_grab))
330-
current_grab.apply_unique_grab_effects(src)
343+
current_grab.apply_unique_grab_effects(affecting)
331344

332345
current_grab.enter_as_down(src, silent)
333346
adjust_position()

code/modules/grab/grabs/grab_aggressive.dm

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@
1616

1717
break_chance_table = list(5, 20, 40, 80, 100)
1818

19-
/datum/grab/normal/aggressive/apply_unique_grab_effects(obj/item/hand_item/grab/G)
19+
/datum/grab/normal/aggressive/apply_unique_grab_effects(atom/movable/affecting)
2020
. = ..()
21-
if(!isliving(G.affecting))
21+
if(!isliving(affecting))
2222
return
2323

24-
var/mob/living/L = G.affecting
25-
RegisterSignal(G.affecting, COMSIG_LIVING_SET_BODY_POSITION, PROC_REF(target_bodyposition_change))
24+
var/mob/living/L = affecting
25+
RegisterSignal(L, COMSIG_LIVING_SET_BODY_POSITION, PROC_REF(target_bodyposition_change))
2626

2727
if(L.body_position == LYING_DOWN)
2828
ADD_TRAIT(L, TRAIT_FLOORED, AGGRESSIVE_GRAB)
2929

30-
/datum/grab/normal/aggressive/remove_unique_grab_effects(obj/item/hand_item/grab/G)
30+
/datum/grab/normal/aggressive/remove_unique_grab_effects(atom/movable/affecting)
3131
. = ..()
32-
UnregisterSignal(G.affecting, COMSIG_LIVING_SET_BODY_POSITION)
33-
REMOVE_TRAIT(G.affecting, TRAIT_FLOORED, AGGRESSIVE_GRAB)
32+
UnregisterSignal(affecting, COMSIG_LIVING_SET_BODY_POSITION)
33+
REMOVE_TRAIT(affecting, TRAIT_FLOORED, AGGRESSIVE_GRAB)
3434

3535
/datum/grab/normal/aggressive/proc/target_bodyposition_change(mob/living/source)
3636
if(source.body_position == LYING_DOWN)

code/modules/grab/grabs/grab_neck.dm

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717
icon_state = "kill"
1818
break_chance_table = list(3, 18, 45, 100)
1919

20-
/datum/grab/normal/neck/apply_unique_grab_effects(obj/item/hand_item/grab/G)
20+
/datum/grab/normal/neck/apply_unique_grab_effects(atom/movable/affecting)
2121
. = ..()
22-
if(!isliving(G.affecting))
22+
if(!isliving(affecting))
2323
return
2424

25-
var/mob/living/L = G.affecting
25+
var/mob/living/L = affecting
2626
ADD_TRAIT(L, TRAIT_FLOORED, NECK_GRAB)
2727

28-
/datum/grab/normal/neck/remove_unique_grab_effects(obj/item/hand_item/grab/G)
28+
/datum/grab/normal/neck/remove_unique_grab_effects(atom/movable/affecting)
2929
. = ..()
30-
REMOVE_TRAIT(G.affecting, TRAIT_FLOORED, NECK_GRAB)
30+
REMOVE_TRAIT(affecting, TRAIT_FLOORED, NECK_GRAB)
3131

3232
/datum/grab/normal/neck/enter_as_up(obj/item/hand_item/grab/G, silent)
3333
. = ..()

code/modules/grab/grabs/grab_strangle.dm

+4-7
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,13 @@
1515
icon_state = "kill1"
1616
break_chance_table = list(5, 20, 40, 80, 100)
1717

18-
/datum/grab/normal/kill/apply_unique_grab_effects(obj/item/hand_item/grab/G)
18+
/datum/grab/normal/kill/apply_unique_grab_effects(atom/movable/affecting)
1919
. = ..()
20-
if(!isliving(G.affecting))
21-
return
20+
ADD_TRAIT(affecting, TRAIT_KILL_GRAB, KILL_GRAB)
2221

23-
ADD_TRAIT(G.affecting, TRAIT_KILL_GRAB, REF(G))
24-
25-
/datum/grab/normal/kill/remove_unique_grab_effects(obj/item/hand_item/grab/G)
22+
/datum/grab/normal/kill/remove_unique_grab_effects(atom/movable/affecting)
2623
. = ..()
27-
REMOVE_TRAIT(G.affecting, TRAIT_KILL_GRAB, REF(G))
24+
REMOVE_TRAIT(affecting, TRAIT_KILL_GRAB, KILL_GRAB)
2825

2926
/datum/grab/normal/kill/enter_as_up(obj/item/hand_item/grab/G, silent)
3027
. = ..()

0 commit comments

Comments
 (0)