Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better species suicide support #3461

Merged
merged 1 commit into from
Feb 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
100 changes: 52 additions & 48 deletions code/game/verbs/suicide.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,54 @@
/mob/var/suiciding = 0

/mob/living/carbon/human/proc/do_suicide(damagetype, byitem)
var/threshold = (config.health_threshold_crit + config.health_threshold_dead) / 2
var/dmgamt = maxHealth - threshold

var/damage_mod = 1
switch(damagetype) //Sorry about the magic numbers.
//brute = 1, burn = 2, tox = 4, oxy = 8
if(15) //4 damage types
damage_mod = 4

if(6, 11, 13, 14) //3 damage types
damage_mod = 3

if(3, 5, 7, 9, 10, 12) //2 damage types
damage_mod = 2

if(1, 2, 4, 8) //1 damage type
damage_mod = 1

else //This should not happen, but if it does, everything should still work
damage_mod = 1

//Do dmgamt damage divided by the number of damage types applied.
if(damagetype & BRUTELOSS)
adjustBruteLoss(dmgamt / damage_mod)

if(damagetype & FIRELOSS)
adjustFireLoss(dmgamt / damage_mod)

if(damagetype & TOXLOSS)
adjustToxLoss(dmgamt / damage_mod)

if(damagetype & OXYLOSS)
adjustOxyLoss(dmgamt / damage_mod)

// Failing that...
if(!(damagetype & BRUTELOSS) && !(damagetype & FIRELOSS) && !(damagetype & TOXLOSS) && !(damagetype & OXYLOSS))
if(species.flags & NO_BREATHE)
// the ultimate fallback
take_overall_damage(max(dmgamt - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0), 0)
else
adjustOxyLoss(max(dmgamt - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0))

var/obj/item/organ/external/affected = get_organ("head")
if(affected)
affected.add_autopsy_data(byitem ? "Suicide by [byitem]" : "Suicide", dmgamt)

updatehealth()

/mob/living/carbon/human/verb/suicide()
set hidden = 1

Expand All @@ -24,56 +73,11 @@
if(held_item)
var/damagetype = held_item.suicide_act(src)
if(damagetype)
var/damage_mod = 1
switch(damagetype) //Sorry about the magic numbers.
//brute = 1, burn = 2, tox = 4, oxy = 8
if(15) //4 damage types
damage_mod = 4

if(6, 11, 13, 14) //3 damage types
damage_mod = 3

if(3, 5, 7, 9, 10, 12) //2 damage types
damage_mod = 2

if(1, 2, 4, 8) //1 damage type
damage_mod = 1

else //This should not happen, but if it does, everything should still work
damage_mod = 1

//Do 175 damage divided by the number of damage types applied.
if(damagetype & BRUTELOSS)
adjustBruteLoss(175/damage_mod)

if(damagetype & FIRELOSS)
adjustFireLoss(175/damage_mod)

if(damagetype & TOXLOSS)
adjustToxLoss(175/damage_mod)

if(damagetype & OXYLOSS)
adjustOxyLoss(175/damage_mod)

//If something went wrong, just do normal oxyloss
if(!(damagetype | BRUTELOSS) && !(damagetype | FIRELOSS) && !(damagetype | TOXLOSS) && !(damagetype | OXYLOSS))
adjustOxyLoss(max(175 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0))

var/obj/item/organ/external/affected = get_organ("head")
affected.add_autopsy_data("Suicide by [held_item]", 175)

updatehealth()
do_suicide(damagetype, held_item)
return


viewers(src) << pick("\red <b>[src] is attempting to bite \his tongue off! It looks like \he's trying to commit suicide.</b>", \
"\red <b>[src] is jamming \his thumbs into \his eye sockets! It looks like \he's trying to commit suicide.</b>", \
"\red <b>[src] is twisting \his own neck! It looks like \he's trying to commit suicide.</b>", \
"\red <b>[src] is holding \his breath! It looks like \he's trying to commit suicide.</b>")
adjustOxyLoss(max(175 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0))

var/obj/item/organ/external/affected = get_organ("head")
affected.add_autopsy_data("Suicide", 175)
viewers(src) << "<span class=danger>[src] [pick(species.suicide_messages)] It looks like they're trying to commit suicide.</span>"
do_suicide(0)

updatehealth()

Expand Down
3 changes: 3 additions & 0 deletions code/modules/mob/living/carbon/human/species/golem.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
has_organ = list(
"brain" = /obj/item/organ/brain/golem
)
suicide_messages = list(
"is crumbling into dust!",
"is smashing their body apart!")

/datum/species/golem/handle_post_spawn(var/mob/living/carbon/human/H)
if(H.mind)
Expand Down
5 changes: 5 additions & 0 deletions code/modules/mob/living/carbon/human/species/shadow.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
bodyflags = FEET_NOSLIP
dietflags = DIET_OMNI //the mutation process allowed you to now digest all foods regardless of initial race
reagent_tag = PROCESS_ORG
suicide_messages = list(
"is attempting to bite their tongue off!",
"is jamming their claws into their eye sockets!",
"is twisting their own neck!",
"is staring into the closest light source!")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What. This is genius.


/datum/species/shadow/handle_death(var/mob/living/carbon/human/H)
H.dust()
7 changes: 6 additions & 1 deletion code/modules/mob/living/carbon/human/species/skeleton.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@
heat_level_1 = 999999999
heat_level_2 = 999999999
heat_level_3 = 999999999
heat_level_3_breathe = 999999999
heat_level_3_breathe = 999999999

suicide_messages = list(
"is snapping their own bones!",
"is collapsing into a pile!",
"is twisting their skull off!")
5 changes: 5 additions & 0 deletions code/modules/mob/living/carbon/human/species/species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@

//Death vars.
var/death_message = "seizes up and falls limp, their eyes dead and lifeless..."
var/list/suicide_messages = list(
"is attempting to bite their tongue off!",
"is jamming their thumbs into their eye sockets!",
"is twisting their own neck!",
"is holding their breath!")

// Language/culture vars.
var/default_language = "Galactic Common" // Default language is used when 'say' is used without modifiers.
Expand Down
52 changes: 52 additions & 0 deletions code/modules/mob/living/carbon/human/species/station.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
flesh_color = "#34AF10"
reagent_tag = PROCESS_ORG
base_color = "#066000"

suicide_messages = list(
"is attempting to bite their tongue off!",
"is jamming their claws into their eye sockets!",
"is twisting their own neck!",
"is holding their breath!")

/datum/species/unathi/handle_death(var/mob/living/carbon/human/H)
H.stop_tail_wagging(1)
Expand Down Expand Up @@ -100,6 +106,12 @@
reagent_tag = PROCESS_ORG
flesh_color = "#AFA59E"
base_color = "#333333"

suicide_messages = list(
"is attempting to bite their tongue off!",
"is jamming their claws into their eye sockets!",
"is twisting their own neck!",
"is holding their breath!")

/datum/species/tajaran/handle_death(var/mob/living/carbon/human/H)
H.stop_tail_wagging(1)
Expand Down Expand Up @@ -135,6 +147,12 @@
reagent_tag = PROCESS_ORG
flesh_color = "#966464"
base_color = "#B43214"

suicide_messages = list(
"is attempting to bite their tongue off!",
"is jamming their claws into their eye sockets!",
"is twisting their own neck!",
"is holding their breath!")

/datum/species/vulpkanin/handle_death(var/mob/living/carbon/human/H)
H.stop_tail_wagging(1)
Expand Down Expand Up @@ -206,6 +224,13 @@
flesh_color = "#808D11"

reagent_tag = PROCESS_ORG

suicide_messages = list(
"is attempting to bite their tongue off!",
"is jamming their claws into their eye sockets!",
"is twisting their own neck!",
"is holding their breath!",
"is deeply inhaling oxygen!")

/datum/species/vox/handle_death(var/mob/living/carbon/human/H)
H.stop_tail_wagging(1)
Expand Down Expand Up @@ -292,6 +317,13 @@
"eyes" = /obj/item/organ/eyes,
"stack" = /obj/item/organ/stack/vox
)

suicide_messages = list(
"is attempting to bite their tongue off!",
"is jamming their claws into their eye sockets!",
"is twisting their own neck!",
"is holding their breath!",
"is huffing oxygen!")

/datum/species/kidan
name = "Kidan"
Expand All @@ -311,6 +343,12 @@
dietflags = DIET_HERB
blood_color = "#FB9800"
reagent_tag = PROCESS_ORG

suicide_messages = list(
"is attempting to bite their antenna off!",
"is jamming their claws into their eye sockets!",
"is twisting their own neck!",
"is holding their breath!")

/datum/species/slime
name = "Slime People"
Expand All @@ -333,6 +371,10 @@
has_organ = list(
"brain" = /obj/item/organ/brain/slime
)

suicide_messages = list(
"is melting into a puddle!",
"is turning a dull, brown color and melting into a puddle!")

/datum/species/grey
name = "Grey"
Expand Down Expand Up @@ -433,6 +475,10 @@
"l_foot" = list("path" = /obj/item/organ/external/diona/foot),
"r_foot" = list("path" = /obj/item/organ/external/diona/foot/right)
)

suicide_messages = list(
"is losing branches!",
"is pulling themselves apart!")

/datum/species/diona/can_understand(var/mob/other)
var/mob/living/simple_animal/diona/D = other
Expand Down Expand Up @@ -526,6 +572,12 @@
"l_foot" = list("path" = /obj/item/organ/external/foot/ipc),
"r_foot" = list("path" = /obj/item/organ/external/foot/right/ipc)
)

suicide_messages = list(
"is powering down!",
"is smashing their own monitor!",
"is twisting their own neck!",
"is blocking their ventilation port!")

/datum/species/machine/handle_death(var/mob/living/carbon/human/H)
H.h_style = ""
Expand Down