Skip to content

Commit

Permalink
Few fixes (#61)
Browse files Browse the repository at this point in the history
* Update snacks.dm

* Update living_health_procs.dm

* defib fixes
  • Loading branch information
Helg2 authored Aug 1, 2024
1 parent afe2607 commit d32dc3e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 39 deletions.
2 changes: 1 addition & 1 deletion code/__DEFINES/loadout.dm
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ GLOBAL_LIST_INIT(medic_gear_listed_products, list(
/obj/item/reagent_containers/hypospray/autoinjector/neuraline = list(CAT_MEDSUP, "Injector (Neuraline)", 14, "cyan"),
/obj/item/healthanalyzer/gloves = list(CAT_MEDSUP, "Health scanner gloves", 2, "yellow"),
/obj/item/defibrillator/gloves = list(CAT_MEDSUP, "Advanced medical gloves", 4, "yellow"),
/obj/item/defibrillator/advanced = list(CAT_FCSUP, "advanced emergency defibrillator", 4, "yellow"),
/obj/item/defibrillator/advanced = list(CAT_MEDSUP, "advanced emergency defibrillator", 4, "yellow"),
/obj/item/tweezers_advanced = list(CAT_MEDSUP, "Advanced Tweezers", 8, "yellow"),
/obj/effect/vendor_bundle/stretcher = list(CAT_MEDSUP, "Medivac Stretcher", 20, "yellow"),
))
Expand Down
48 changes: 18 additions & 30 deletions code/game/objects/items/defibrillator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@
name = "emergency defibrillator"
desc = "A handheld emergency defibrillator, used to restore fibrillating patients. Can optionally bring people back from the dead."
icon = 'icons/obj/items/defibrillator.dmi'
icon_state = "defib_full"
icon_state = "defib"
item_state = "defib"
flags_atom = CONDUCT
flags_item = NOBLUDGEON
flags_equip_slot = ITEM_SLOT_BELT
force = 5
throwforce = 6
w_class = WEIGHT_CLASS_NORMAL

var/ready = FALSE
///wether readying is needed
var/ready_needed = TRUE
var/advanced = FALSE
var/damage_threshold = 8 //This is the maximum non-oxy damage the defibrillator will heal to get a patient above -100, in all categories
var/charge_cost = 66 //How much energy is used.
///This is the maximum non-oxy damage the defibrillator will heal to get a patient above -100, in all categories
var/damage_threshold = 8
/// How much energy is used
var/charge_cost = 66
var/obj/item/cell/dcell = null
var/datum/effect_system/spark_spread/sparks
var/defib_cooldown = 0 //Cooldown for toggling the defib

///Cooldown for toggling the defib
var/defib_cooldown = 0

/obj/item/defibrillator/suicide_act(mob/user)
user.visible_message(span_danger("[user] is putting the live paddles on [user.p_their()] chest! It looks like [user.p_theyre()] trying to commit suicide."))
return (FIRELOSS)


/obj/item/defibrillator/Initialize(mapload)
. = ..()
sparks = new
Expand All @@ -35,15 +35,13 @@
set_dcell(new /obj/item/cell())
update_icon()


/obj/item/defibrillator/Destroy()
QDEL_NULL(sparks)
if(dcell)
UnregisterSignal(dcell, COMSIG_QDELETING)
QDEL_NULL(dcell)
return ..()


/obj/item/defibrillator/update_icon_state()
icon_state = initial(icon_state)
if(ready)
Expand All @@ -59,12 +57,10 @@
else
icon_state += "_empty"


/obj/item/defibrillator/examine(mob/user)
. = ..()
. += maybe_message_recharge_hint()


/**
* Message user with a hint to recharge defibrillator
* and how to do it if the battery is low.
Expand All @@ -83,7 +79,6 @@
return
return span_notice("[message] You can click-drag defibrillator on corpsman backpack to recharge it.")


/obj/item/defibrillator/attack_self(mob/living/carbon/human/user)
if(!ready_needed)
return
Expand Down Expand Up @@ -111,7 +106,6 @@
playsound(get_turf(src), 'sound/items/defib_safetyOff.ogg', 30, 0)
update_icon()


///Wrapper to guarantee powercells are properly nulled and avoid hard deletes.
/obj/item/defibrillator/proc/set_dcell(obj/item/cell/new_cell)
if(dcell)
Expand All @@ -120,7 +114,6 @@
if(dcell)
RegisterSignal(dcell, COMSIG_QDELETING, PROC_REF(on_cell_deletion))


///Called by the deletion of the referenced powercell.
/obj/item/defibrillator/proc/on_cell_deletion(obj/item/cell/source, force)
SIGNAL_HANDLER
Expand Down Expand Up @@ -189,15 +182,15 @@
user.visible_message(span_warning("[icon2html(src, viewers(user))] \The [src] buzzes: Vital signs detected. Aborting."))
return

if((HAS_TRAIT(H, TRAIT_UNDEFIBBABLE ) && !issynth(H)) || H.suiciding) //synthetic species have no expiration date
if((HAS_TRAIT(H, TRAIT_UNDEFIBBABLE) && !issynth(H)) || H.suiciding) //synthetic species have no expiration date
user.visible_message(span_warning("[icon2html(src, viewers(user))] \The [src] buzzes: Patient is braindead. No remedy possible."))
return

if(!H.has_working_organs() && !(H.species.species_flags & ROBOTIC_LIMBS))
user.visible_message(span_warning("[icon2html(src, viewers(user))] \The [src] buzzes: Patient's organs are too damaged to sustain life. Deliver patient to a MD for surgical intervention."))
return

if((H.wear_suit && H.wear_suit.flags_atom & CONDUCT))
if((H.wear_suit && H.wear_suit.flags_atom & CONDUCT && !advanced))
user.visible_message(span_warning("[icon2html(src, viewers(user))] \The [src] buzzes: Paddles registering >100,000 ohms, Possible cause: Suit or Armor interferring."))
return

Expand All @@ -222,21 +215,18 @@
sparks.start()
dcell.use(charge_cost)
update_icon()
/* ORIGINAL
playsound(get_turf(src), 'sound/items/defib_release.ogg', 25, 1)
*/
playsound(get_turf(src), 'sound/items/defib_release.ogg', 30, 0) //RUTGMC EDIT
playsound(get_turf(src), 'sound/items/defib_release.ogg', 30, 0)
user.visible_message(span_notice("[user] shocks [H] with the paddles."),
span_notice("You shock [H] with the paddles."))
H.visible_message(span_danger("[H]'s body convulses a bit."))
defib_cooldown = world.time + 10 //1 second cooldown before you can shock again

if(H.wear_suit && advanced == FALSE && H.wear_suit.flags_atom & CONDUCT)
if(H.wear_suit && H.wear_suit.flags_atom & CONDUCT && !advanced)
user.visible_message(span_warning("[icon2html(src, viewers(user))] \The [src] buzzes: Defibrillation failed: Paddles registering >100,000 ohms, Possible cause: Suit or Armor interferring."))
return

var/datum/internal_organ/heart/heart = H.get_organ_slot(ORGAN_SLOT_HEART)
if(!issynth(H) && !isrobot(H) && heart && prob(90) && advanced == FALSE)
if(!issynth(H) && !isrobot(H) && heart && prob(90) && !advanced)
heart.take_damage(5) //Allow the defibrillator to possibly worsen heart damage. Still rare enough to just be the "clone damage" of the defib

if(HAS_TRAIT(H, TRAIT_UNDEFIBBABLE) || H.suiciding)
Expand Down Expand Up @@ -310,7 +300,7 @@
H.handle_regular_hud_updates()
H.updatehealth() //One more time, so it doesn't show the target as dead on HUDs
H.dead_ticks = 0 //We reset the DNR time
H.initial_stage = 0 // RUTGMC ADDITION
H.initial_stage = 0
REMOVE_TRAIT(H, TRAIT_PSY_DRAINED, TRAIT_PSY_DRAINED)
if(user.client)
var/datum/personal_statistics/personal_statistics = GLOB.personal_statistics_list[user.ckey]
Expand All @@ -328,12 +318,12 @@
/obj/item/defibrillator/civi
name = "emergency defibrillator"
desc = "A handheld emergency defibrillator, used to restore fibrillating patients. Can optionally bring people back from the dead. Appears to be a civillian model."
icon_state = "civ_defib_full"
icon_state = "civ_defib"
item_state = "defib"

/obj/item/defibrillator/gloves
name = "advanced medical combat gloves"
desc = "Advanced medical gloves, these include small electrodes to defibrilate a patiant. No more bulky units!"
desc = "Advanced medical gloves, these include small electrodes to defibrilate a patiant. Ignores armor and doesn't deal any damage to the patient's heart!"
icon_state = "defib_gloves"
item_state = "defib_gloves"
ready = TRUE
Expand All @@ -354,7 +344,6 @@
max_heat_protection_temperature = GLOVES_MAX_HEAT_PROTECTION_TEMPERATURE
advanced = TRUE


/obj/item/defibrillator/gloves/equipped(mob/living/carbon/human/user, slot)
. = ..()
if(user.gloves == src)
Expand All @@ -376,11 +365,10 @@
/obj/item/defibrillator/gloves/update_icon_state()
return


/obj/item/defibrillator/advanced
name = "advanced emergency defibrillator"
desc = "A handheld advanced emergency defibrillator, used to restore fibrillating patients. Can optionally bring people back from the dead."
desc = "A handheld advanced emergency defibrillator, used to restore fibrillating patients. at the cost of increased charge consumption."
icon = 'icons/obj/items/defibrillator.dmi'
icon_state = "civ_defib_full"
icon_state = "civ_defib"
charge_cost = 100
advanced = TRUE
charge_cost = 100 //How much energy is used.
14 changes: 7 additions & 7 deletions code/game/objects/items/reagent_containers/food/snacks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
if(reagents.total_volume)
return

balloon_alert_to_viewers("eats \the [src]")
balloon_alert_to_viewers("eats \the [src]", ignored_mobs = M)

usr.dropItemToGround(src) //so icons update :[

Expand Down Expand Up @@ -71,23 +71,23 @@
if(ishuman(H) && (H.species.species_flags & ROBOTIC_LIMBS))
balloon_alert(user, "can't eat food")
return
if (fullness <= 50)
if(fullness <= 50)
balloon_alert(user, "hungrily chews [src]")
if (fullness > 50 && fullness <= 150)
if(fullness > 50 && fullness <= 150)
balloon_alert(user, "hungrily eats [src]")
if (fullness > 150 && fullness <= 350)
if(fullness > 150 && fullness <= 350)
balloon_alert(user, "takes bite of [src]")
if (fullness > 350 && fullness <= 550)
if(fullness > 350 && fullness <= 550)
balloon_alert(user, "unwillingly chews [src]")
if (fullness > 550)
if(fullness > 550)
balloon_alert(user, "cannot eat more of [src]")
return FALSE
else
var/mob/living/carbon/H = M
if(ishuman(H) && (H.species.species_flags & ROBOTIC_LIMBS))
balloon_alert(user, "can't eat food")
return
if (fullness <= 550)
if(fullness <= 550)
balloon_alert_to_viewers("tries to feed [M]")
else
balloon_alert_to_viewers("tries to feed [M] but can't")
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/living_health_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@
embedded.unembed_ourself()

// shut down various types of badness
setStaminaLoss(0)
setStaminaLoss(-50)
setToxLoss(0)
setOxyLoss(0)
setCloneLoss(0)
Expand Down

0 comments on commit d32dc3e

Please sign in to comment.