Skip to content

Commit

Permalink
8.15.24 bugs (#1070)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Kapu1178 authored Aug 25, 2024
1 parent e8a934a commit 8d98206
Show file tree
Hide file tree
Showing 16 changed files with 78 additions and 134 deletions.
2 changes: 1 addition & 1 deletion code/__DEFINES/three_dsix.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/// Have nicotine in your blood
#define SKILL_SOURCE_NICOTINE "Nicotine"
/// Have a nicotine withdrawl
#define SKILL_SOURCE_NICOTINE_WITHDRAWL "Nicottine withdrawl"
#define SKILL_SOURCE_NICOTINE_WITHDRAWL "Nicotine withdrawl"
/// Opiod Withdrawl
#define SKILL_SOURCE_OPIOD_WITHDRAWL "Opiod withdrawl"
/// Alchohol withdrawl
Expand Down
2 changes: 1 addition & 1 deletion code/game/alternate_appearance.dm
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ GLOBAL_LIST_EMPTY(active_alternate_appearances)

/datum/atom_hud/alternate_appearance/basic/remove_atom_from_hud(atom/A)
. = ..()
A.hud_list -= appearance_key
LAZYREMOVE(A.hud_list, appearance_key)
A.set_hud_image_inactive(appearance_key)
if(. && !QDELETED(src))
qdel(src)
Expand Down
6 changes: 5 additions & 1 deletion code/game/objects/items/cigs_lighters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,9 @@ CIGARETTE PACKETS ARE IN FANCY.DM
/obj/item/lighter/attack_self(mob/living/user)
if(!user.is_holding(src))
return ..()

user.changeNext_move(CLICK_CD_RAPID)

if(lit)
set_lit(FALSE)
if(fancy)
Expand All @@ -816,6 +819,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
return

set_lit(TRUE)

if(fancy)
user.visible_message(
span_notice("Without even breaking stride, [user] flips open and lights [src] in one smooth movement."),
Expand Down Expand Up @@ -845,7 +849,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
switch(result.outcome)
if(FAILURE, CRIT_FAILURE)
user.apply_damage(5, BURN, user.get_active_hand())
to_chat(user, result.create_tooltip("You burn yourself while lighting the lighter!"))
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."))
if(SUCCESS, CRIT_SUCCESS)
to_chat(user, result.create_tooltip("After a few attempts, you manage to light [src]."))
user.visible_message(span_notice("After a few attempts, [user] manages to light [src]."))
Expand Down
75 changes: 0 additions & 75 deletions code/game/objects/items/devices/scanners/health_analyzer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -307,44 +307,6 @@
desc = "A hand-held body scanner able to distinguish vital signs of the subject with high accuracy."
advanced = TRUE

/// Displays wounds with extended information on their status vs medscanners
/proc/woundscan(mob/user, mob/living/carbon/patient, obj/item/healthanalyzer/wound/scanner, advanced = FALSE)
if(!istype(patient) || user.incapacitated())
return

if(user.is_blind())
to_chat(user, span_warning("You realize that your scanner has no accessibility support for the blind!"))
return

var/data_string_list = ""
var/list/damaged_limbs = patient.get_damaged_bodyparts(TRUE, TRUE)
if(!length(damaged_limbs))
data_string_list += "No detectable limb injuries.\n"

sortTim(damaged_limbs, GLOBAL_PROC_REF(cmp_bodyparts_display_order))

for(var/obj/item/bodypart/limb as anything in damaged_limbs)
var/limb_string = "[capitalize(limb.body_zone)][(limb.bodytype & BODYTYPE_ROBOTIC) ? " <span style='font-weight: bold; color: [COLOR_MEDICAL_ROBOTIC]'>(Cybernetic)</span>" : ""]:"
if(limb.brute_dam)
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>\]"

if(limb.burn_dam)
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>\]"

if(limb.bodypart_flags & BP_BLEEDING)
limb_string += " \[<span style='font-weight: bold; color: [COLOR_MEDICAL_BRUTE]'>bleeding</span>\]"

data_string_list += (limb_string + "\n")

if(data_string_list == "")
if(istype(scanner))
// Only emit the cheerful scanner message if this scan came from a scanner
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!"))
else
to_chat(user, "<span class='notice ml-1'>No wounds detected in subject.</span>")
else
to_chat(user, jointext(data_string_list, ""), type = MESSAGE_TYPE_INFO)

/proc/surgericalscan(mob/living/user, mob/living/carbon/target)
if(!istype(target) || user.incapacitated())
return
Expand Down Expand Up @@ -373,43 +335,6 @@

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

/obj/item/healthanalyzer/wound
name = "first aid analyzer"
icon_state = "adv_spectrometer"
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!"
var/next_encouragement
var/greedy

/obj/item/healthanalyzer/wound/attack_self(mob/user)
if(next_encouragement < world.time)
playsound(src, 'sound/machines/ping.ogg', 50, FALSE)
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", \
"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")
to_chat(user, span_notice("\The [src] makes a happy ping and [pick(encouragements)]!"))
next_encouragement = world.time + 10 SECONDS
greedy = FALSE
else if(!greedy)
to_chat(user, span_warning("\The [src] displays an eerily high-definition frowny face, chastizing you for asking it for too much encouragement."))
greedy = TRUE
else
playsound(src, 'sound/machines/buzz-sigh.ogg', 50, FALSE)
if(isliving(user))
var/mob/living/L = user
to_chat(L, span_warning("\The [src] makes a disappointed buzz and pricks your finger for being greedy. Ow!"))
L.adjustBruteLoss(4)
L.dropItemToGround(src)

/obj/item/healthanalyzer/wound/attack(mob/living/carbon/patient, mob/living/carbon/human/user)
add_fingerprint(user)
user.visible_message(span_notice("[user] scans [patient] for serious injuries."), span_notice("You scan [patient] for serious injuries."))

if(!istype(patient))
playsound(src, 'sound/machines/buzz-sigh.ogg', 30, TRUE)
to_chat(user, span_notice("\The [src] makes a sad buzz and briefly displays a frowny face, indicating it can't scan [patient]."))
return

woundscan(user, patient, src)

#undef SCANMODE_HEALTH
#undef SCANMODE_CHEM
#undef SCANMODE_SURGERY
Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/storage/medkit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
if(empty)
return
var/static/items_inside = list(
/obj/item/healthanalyzer/wound = 1,
/obj/item/stack/gauze = 1,
/obj/item/stack/medical/suture = 1,
/obj/item/stack/medical/ointment = 1,
Expand Down
48 changes: 27 additions & 21 deletions code/modules/grab/grab_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ GLOBAL_LIST_EMPTY(all_grabstates)
SHOULD_CALL_PARENT(TRUE)

G.remove_competing_grabs()
update_stage_effects(G, old_grab)

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

// What happens when you downgrade from one grab state to the next.
/datum/grab/proc/downgrade_effect(obj/item/hand_item/grab/G, datum/grab/old_grab)
update_stage_effects(G, old_grab)
return

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

remove_bodyzone_effects(G, G.target_zone)
if(G.is_grab_unique(src))
remove_unique_grab_effects(G)
remove_unique_grab_effects(G.affecting)

update_stage_effects(G, src, TRUE)

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

var/trait_source = ref(G)
var/atom/movable/affected_movable = G.affecting

switch(new_stage) // Current state.
if(GRAB_PASSIVE)
REMOVE_TRAIT(G.affecting, TRAIT_IMMOBILIZED, REF(G))
REMOVE_TRAIT(G.affecting, TRAIT_HANDS_BLOCKED, REF(G))
REMOVE_TRAIT(affected_movable, TRAIT_IMMOBILIZED, trait_source)
REMOVE_TRAIT(affected_movable, TRAIT_HANDS_BLOCKED, trait_source)
if(old_damage_stage >= GRAB_AGGRESSIVE)
REMOVE_TRAIT(G.affecting, TRAIT_AGGRESSIVE_GRAB, REF(G))
REMOVE_TRAIT(G.affecting, TRAIT_FLOORED, REF(G))
REMOVE_TRAIT(affected_movable, TRAIT_AGGRESSIVE_GRAB, trait_source)
REMOVE_TRAIT(affected_movable, TRAIT_FLOORED, trait_source)

if(GRAB_AGGRESSIVE)
if(old_damage_stage >= GRAB_NECK) // Grab got downgraded.
REMOVE_TRAIT(G.affecting, TRAIT_FLOORED, REF(G))
REMOVE_TRAIT(affected_movable, TRAIT_FLOORED, trait_source)
else // Grab got upgraded from a passive one.
ADD_TRAIT(G.affecting, TRAIT_IMMOBILIZED, REF(G))
ADD_TRAIT(G.affecting, TRAIT_HANDS_BLOCKED, REF(G))
ADD_TRAIT(G.affecting, TRAIT_AGGRESSIVE_GRAB, REF(G))
ADD_TRAIT(affected_movable, TRAIT_IMMOBILIZED, trait_source)
ADD_TRAIT(affected_movable, TRAIT_HANDS_BLOCKED, trait_source)
ADD_TRAIT(affected_movable, TRAIT_AGGRESSIVE_GRAB, trait_source)

if(GRAB_NECK, GRAB_KILL)
if(old_damage_stage < GRAB_AGGRESSIVE)
ADD_TRAIT(G.affecting, TRAIT_AGGRESSIVE_GRAB, REF(G))
ADD_TRAIT(affected_movable, TRAIT_AGGRESSIVE_GRAB, REF(G))
if(old_damage_stage <= GRAB_AGGRESSIVE)
ADD_TRAIT(G.affecting, TRAIT_FLOORED, REF(G))
ADD_TRAIT(G.affecting, TRAIT_HANDS_BLOCKED, REF(G))
ADD_TRAIT(G.affecting, TRAIT_IMMOBILIZED, REF(G))
ADD_TRAIT(affected_movable, TRAIT_FLOORED, REF(G))
ADD_TRAIT(affected_movable, TRAIT_HANDS_BLOCKED, REF(G))
ADD_TRAIT(affected_movable, TRAIT_IMMOBILIZED, REF(G))

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

/// Apply effects that should only be applied when a grab type is first used on a mob.
/datum/grab/proc/apply_unique_grab_effects(obj/item/hand_item/grab/G)
/datum/grab/proc/apply_unique_grab_effects(atom/movable/affecting)
SHOULD_CALL_PARENT(TRUE)
if(same_tile && ismob(G.affecting))
G.affecting.add_passmob(REF(G))
if(same_tile && ismob(affecting))
affecting.add_passmob(ref(src))

/// Remove effects added by apply_unique_grab_effects()
/datum/grab/proc/remove_unique_grab_effects(obj/item/hand_item/grab/G)
/datum/grab/proc/remove_unique_grab_effects(atom/movable/affecting)
SHOULD_CALL_PARENT(TRUE)
if(same_tile && ismob(G.affecting))
G.affecting.remove_passmob(REF(G))
if(same_tile && ismob(affecting))
affecting.remove_passmob(ref(src))

/// Handles special targeting like eyes and mouth being covered.
/// CLEAR OUT ANY EFFECTS USING remove_bodyzone_effects()
Expand Down
23 changes: 18 additions & 5 deletions code/modules/grab/grab_object.dm
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@

// Leave forensics
leave_forensic_traces()

/// Setup signals
var/obj/item/bodypart/BP = get_targeted_bodypart()
if(BP)
Expand Down Expand Up @@ -126,6 +127,11 @@
else
stack_trace("Grab (\ref[src]) qdeleted while not having an assailant.")

//DEBUG CODE
if(HAS_TRAIT_FROM(affecting, TRAIT_AGGRESSIVE_GRAB, ref(src)))
stack_trace("Somehow all other safeties failed and [affecting] still is marked as grabbed from a qdeling grab, removing!")
REMOVE_TRAIT(affecting, TRAIT_AGGRESSIVE_GRAB, ref(src))

affecting = null
assailant = null
current_grab = null
Expand All @@ -140,6 +146,9 @@

/obj/item/hand_item/grab/update_icon_state()
. = ..()
if(QDELING(src))
return

icon = current_grab.icon
if(current_grab.icon_state)
icon_state = current_grab.icon_state
Expand Down Expand Up @@ -289,13 +298,15 @@
return

var/datum/grab/upgrab = current_grab.upgrade(src)
if(!upgrab)
var/datum/grab/oldgrab = current_grab
if(!upgrab || QDELETED(src))
return

if(is_grab_unique(current_grab))
current_grab.remove_unique_grab_effects(src)
current_grab.remove_unique_grab_effects(affecting)

current_grab = upgrab
current_grab.update_stage_effects(src, oldgrab)

COOLDOWN_START(src, upgrade_cd, current_grab.upgrade_cooldown)

Expand All @@ -308,26 +319,28 @@
return

if(is_grab_unique(current_grab))
current_grab.apply_unique_grab_effects(src)
current_grab.apply_unique_grab_effects(affecting)

adjust_position()
update_appearance()

/obj/item/hand_item/grab/proc/downgrade(silent)
var/datum/grab/downgrab = current_grab.downgrade(src)
var/datum/grab/oldgrab = current_grab
if(!downgrab)
return

if(is_grab_unique(current_grab))
current_grab.remove_unique_grab_effects(src)
current_grab.remove_unique_grab_effects(affecting)

current_grab = downgrab
current_grab.update_stage_effects(src, oldgrab)

if(!current_grab.enter_as_down(src))
return

if(is_grab_unique(current_grab))
current_grab.apply_unique_grab_effects(src)
current_grab.apply_unique_grab_effects(affecting)

current_grab.enter_as_down(src, silent)
adjust_position()
Expand Down
14 changes: 7 additions & 7 deletions code/modules/grab/grabs/grab_aggressive.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@

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

/datum/grab/normal/aggressive/apply_unique_grab_effects(obj/item/hand_item/grab/G)
/datum/grab/normal/aggressive/apply_unique_grab_effects(atom/movable/affecting)
. = ..()
if(!isliving(G.affecting))
if(!isliving(affecting))
return

var/mob/living/L = G.affecting
RegisterSignal(G.affecting, COMSIG_LIVING_SET_BODY_POSITION, PROC_REF(target_bodyposition_change))
var/mob/living/L = affecting
RegisterSignal(L, COMSIG_LIVING_SET_BODY_POSITION, PROC_REF(target_bodyposition_change))

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

/datum/grab/normal/aggressive/remove_unique_grab_effects(obj/item/hand_item/grab/G)
/datum/grab/normal/aggressive/remove_unique_grab_effects(atom/movable/affecting)
. = ..()
UnregisterSignal(G.affecting, COMSIG_LIVING_SET_BODY_POSITION)
REMOVE_TRAIT(G.affecting, TRAIT_FLOORED, AGGRESSIVE_GRAB)
UnregisterSignal(affecting, COMSIG_LIVING_SET_BODY_POSITION)
REMOVE_TRAIT(affecting, TRAIT_FLOORED, AGGRESSIVE_GRAB)

/datum/grab/normal/aggressive/proc/target_bodyposition_change(mob/living/source)
if(source.body_position == LYING_DOWN)
Expand Down
10 changes: 5 additions & 5 deletions code/modules/grab/grabs/grab_neck.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
icon_state = "kill"
break_chance_table = list(3, 18, 45, 100)

/datum/grab/normal/neck/apply_unique_grab_effects(obj/item/hand_item/grab/G)
/datum/grab/normal/neck/apply_unique_grab_effects(atom/movable/affecting)
. = ..()
if(!isliving(G.affecting))
if(!isliving(affecting))
return

var/mob/living/L = G.affecting
var/mob/living/L = affecting
ADD_TRAIT(L, TRAIT_FLOORED, NECK_GRAB)

/datum/grab/normal/neck/remove_unique_grab_effects(obj/item/hand_item/grab/G)
/datum/grab/normal/neck/remove_unique_grab_effects(atom/movable/affecting)
. = ..()
REMOVE_TRAIT(G.affecting, TRAIT_FLOORED, NECK_GRAB)
REMOVE_TRAIT(affecting, TRAIT_FLOORED, NECK_GRAB)

/datum/grab/normal/neck/enter_as_up(obj/item/hand_item/grab/G, silent)
. = ..()
Expand Down
11 changes: 4 additions & 7 deletions code/modules/grab/grabs/grab_strangle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@
icon_state = "kill1"
break_chance_table = list(5, 20, 40, 80, 100)

/datum/grab/normal/kill/apply_unique_grab_effects(obj/item/hand_item/grab/G)
/datum/grab/normal/kill/apply_unique_grab_effects(atom/movable/affecting)
. = ..()
if(!isliving(G.affecting))
return
ADD_TRAIT(affecting, TRAIT_KILL_GRAB, KILL_GRAB)

ADD_TRAIT(G.affecting, TRAIT_KILL_GRAB, REF(G))

/datum/grab/normal/kill/remove_unique_grab_effects(obj/item/hand_item/grab/G)
/datum/grab/normal/kill/remove_unique_grab_effects(atom/movable/affecting)
. = ..()
REMOVE_TRAIT(G.affecting, TRAIT_KILL_GRAB, REF(G))
REMOVE_TRAIT(affecting, TRAIT_KILL_GRAB, KILL_GRAB)

/datum/grab/normal/kill/enter_as_up(obj/item/hand_item/grab/G, silent)
. = ..()
Expand Down
Loading

0 comments on commit 8d98206

Please sign in to comment.