From 2c3ae32f045b557fb983ab0bdce25aee66eed812 Mon Sep 17 00:00:00 2001 From: "johnsonmt88@gmail.com" Date: Sat, 5 Jan 2013 03:56:24 +0000 Subject: [PATCH] You can now commit suicide using certain items! There will be more items to come, this really just lays the groundwork. Credit goes to CodenameB and Spike68 for the original proposed commit. Althought it ended up changing, this commit still uses all of their suicide messages. Thanks to carn for pseudo-coding the base of the system that I ended up using to implement this. The suicide verb checks the item in your active hand and calls that item's suicide_act(). (/obj/item/proc/suicide_act(mob/user)) The proc displays the suicide message to any viewers and returns a damage type. The suicide verb then applies 175 damage to the mob divided by the number of damage types. If the proc returns null (meaning that the item does not have a suicide_act() defined) the regular suicide occurs. To any coder wanting to add items to this: - You MUST return one or more damage types. "return (BRUTELOSS|FIRELOSS)" for example. - Please do not manually type in the item's name; use [src] to refrence an it instead. It'll save time down the road if an item gets renamed. It also helps handle any child of that item without copy/pasting the proc to each child. - Please do not use 'usr' for anything. Parrots can now see which item they are holding onto in the stat panel. The toy crossbow should once again work properly. Fixes Issue 1227. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5468 316c924e-a436-60f5-8080-3fe189b3f50e --- code/defines/obj/hydro.dm | 12 +++++ code/defines/obj/weapon.dm | 12 +++++ code/game/objects/items.dm | 10 ++++ code/game/objects/items/toys.dm | 6 ++- code/game/objects/items/weapons/kitchen.dm | 12 +++++ .../objects/items/weapons/melee/energy.dm | 9 ++++ code/game/objects/items/weapons/melee/misc.dm | 6 ++- .../game/objects/items/weapons/power_cells.dm | 4 ++ code/game/objects/items/weapons/stunbaton.dm | 3 ++ .../objects/items/weapons/surgery_tools.dm | 11 ++++- code/game/objects/items/weapons/tools.dm | 5 ++ code/game/objects/items/weapons/trashbag.dm | 4 ++ code/game/objects/items/weapons/weaponry.dm | 20 ++++++++ code/game/verbs/suicide.dm | 49 ++++++++++++++++++- .../mob/living/carbon/human/examine.dm | 2 +- .../mob/living/simple_animal/parrot.dm | 4 ++ code/modules/power/cable.dm | 4 ++ code/setup.dm | 7 +++ 18 files changed, 174 insertions(+), 6 deletions(-) diff --git a/code/defines/obj/hydro.dm b/code/defines/obj/hydro.dm index 731a4b2c33..f3fd55b667 100644 --- a/code/defines/obj/hydro.dm +++ b/code/defines/obj/hydro.dm @@ -1217,6 +1217,10 @@ reagents.add_reagent("pacid", round(potency, 1)) force = round((5+potency/2.5), 1) + suicide_act(mob/user) + viewers(user) << "\red [user] is eating some of the [src]! It looks like \he's trying to commit suicide." + return (BRUTELOSS|TOXLOSS) + // ************************************* // Pestkiller defines for hydroponics // ************************************* @@ -1284,6 +1288,10 @@ var/toxicity = 4 var/WeedKillStr = 2 + suicide_act(mob/user) + viewers(user) << "\red [user] is huffing the [src]! It looks like \he's trying to commit suicide." + return (TOXLOSS) + /obj/item/weapon/pestspray // -- Skie desc = "It's some pest eliminator spray! Do not inhale!" icon = 'icons/obj/hydroponics.dmi' @@ -1299,6 +1307,10 @@ var/toxicity = 4 var/PestKillStr = 2 + suicide_act(mob/user) + viewers(user) << "\red [user] is huffing the [src]! It looks like \he's trying to commit suicide." + return (TOXLOSS) + /obj/item/weapon/minihoe // -- Numbers name = "mini hoe" desc = "It's used for removing weeds or scratching your back." diff --git a/code/defines/obj/weapon.dm b/code/defines/obj/weapon.dm index 86e0bd3265..55d530bd9e 100644 --- a/code/defines/obj/weapon.dm +++ b/code/defines/obj/weapon.dm @@ -223,6 +223,10 @@ desc = "A trap used to catch bears and other legged creatures." var/armed = 0 + suicide_act(mob/user) + viewers(user) << "\red [user] is putting the [src] on \his head! It looks like \he's trying to commit suicide." + return (BRUTELOSS) + /obj/item/weapon/legcuffs/beartrap/attack_self(mob/user as mob) ..() if(ishuman(user) && !user.stat && !user.restrained()) @@ -304,6 +308,11 @@ g_amt = 3750 attack_verb = list("stabbed", "slashed", "sliced", "cut") + suicide_act(mob/user) + viewers(user) << pick("/red [user] is slitting \his wrists with the shard of glass! It looks like \he's trying to commit suicide.", \ + "\red [user] is slitting \his throat with the shard of glass! It looks like \he's trying to commit suicide.") + return (BRUTELOSS) + /obj/item/weapon/shard/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob) playsound(loc, 'sound/weapons/bladeslice.ogg', 50, 1, -1) return ..() @@ -428,6 +437,9 @@ m_amt = 40 attack_verb = list("whipped", "lashed", "disciplined", "tickled") + suicide_act(mob/user) + viewers(user) << "\red [user] is strangling \himself with the [src]! It looks like \he's trying to commit suicide." + return (OXYLOSS) /obj/item/weapon/module icon = 'icons/obj/module.dmi' diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 8c2adf0fcd..cccaee943e 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -61,6 +61,16 @@ /obj/item/blob_act() return +//user: The mob that is suiciding +//damagetype: The type of damage the item will inflict on the user +//bruteloss = 1 +//fireloss = 2 +//toxloss = 4 +//oxyloss = 8 +//This proc will return an array. The first element of the list should always be the suicide message that players will see, next is the damagetype +/obj/item/proc/suicide_act(mob/user) + return + /obj/item/verb/move_to_top() set name = "Move To Top" set category = "Object" diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index 7ed87a53c5..60d6b1bf22 100644 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -193,7 +193,7 @@ * Toy crossbow */ - /obj/item/toy/crossbow +/obj/item/toy/crossbow name = "foam dart crossbow" desc = "A weapon favored by many overactive children. Ages 8 and up." icon = 'icons/obj/gun.dmi' @@ -368,6 +368,10 @@ var/instant = 0 var/colourName = "red" //for updateIcon purposes + suicide_act(mob/user) + viewers(user) << "\red [user] is jaming the [src] up \his nose and into \his brain. It looks like \he's trying to commit suicide." + return (BRUTELOSS|OXYLOSS) + /* * Snap pops */ diff --git a/code/game/objects/items/weapons/kitchen.dm b/code/game/objects/items/weapons/kitchen.dm index 7f8af11161..1233fa7517 100644 --- a/code/game/objects/items/weapons/kitchen.dm +++ b/code/game/objects/items/weapons/kitchen.dm @@ -81,6 +81,12 @@ force = 10.0 throwforce = 10.0 + suicide_act(mob/user) + viewers(user) << pick("\red [user] is slitting \his wrists with the [src]! It looks like \he's trying to commit suicide.", \ + "\red [user] is slitting \his throat with the [src]! It looks like \he's trying to commit suicide.", \ + "\red [user] is slitting \his stomach open with the [src]! It looks like \he's trying to commit seppuku.") + return (BRUTELOSS) + /obj/item/weapon/kitchen/utensil/knife/attack(target as mob, mob/living/user as mob) if ((CLUMSY in user.mutations) && prob(50)) user << "\red You accidentally cut yourself with the [src]." @@ -107,6 +113,12 @@ origin_tech = "materials=1" attack_verb = list("slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") + suicide_act(mob/user) + viewers(user) << pick("\red [user] is slitting \his wrists with the [src]! It looks like \he's trying to commit suicide.", \ + "\red [user] is slitting \his throat with the [src]! It looks like \he's trying to commit suicide.", \ + "\red [user] is slitting \his stomach open with the [src]! It looks like \he's trying to commit seppuku.") + return (BRUTELOSS) + /obj/item/weapon/kitchenknife/ritual name = "ritual knife" desc = "The unearthly energies that once powered this blade are now dormant." diff --git a/code/game/objects/items/weapons/melee/energy.dm b/code/game/objects/items/weapons/melee/energy.dm index 3b277e1abc..a5f74e0344 100644 --- a/code/game/objects/items/weapons/melee/energy.dm +++ b/code/game/objects/items/weapons/melee/energy.dm @@ -1,6 +1,11 @@ /obj/item/weapon/melee/energy var/active = 0 + suicide_act(mob/user) + viewers(user) << pick("\red [user] is slitting \his stomach open with the [src]! It looks like \he's trying to commit seppuku.", \ + "\red [user] is falling on the [src]! It looks like \he's trying to commit suicide.") + return (BRUTELOSS|FIRELOSS) + /obj/item/weapon/melee/energy/axe name = "energy axe" desc = "An energised battle axe." @@ -14,6 +19,10 @@ origin_tech = "combat=3" attack_verb = list("attacked", "chopped", "cleaved", "torn", "cut") + suicide_act(mob/user) + viewers(user) << "\red [user] swings the [src] towards /his head! It looks like \he's trying to commit suicide." + return (BRUTELOSS|FIRELOSS) + /obj/item/weapon/melee/energy/sword color name = "energy sword" diff --git a/code/game/objects/items/weapons/melee/misc.dm b/code/game/objects/items/weapons/melee/misc.dm index 2d09e6036b..30ed99b4b7 100644 --- a/code/game/objects/items/weapons/melee/misc.dm +++ b/code/game/objects/items/weapons/melee/misc.dm @@ -9,4 +9,8 @@ throwforce = 7 w_class = 3 origin_tech = "combat=4" - attack_verb = list("flogged", "whipped", "lashed", "disciplined") \ No newline at end of file + attack_verb = list("flogged", "whipped", "lashed", "disciplined") + + suicide_act(mob/user) + viewers(user) << "\red [user] is strangling \himself with the [src]! It looks like \he's trying to commit suicide." + return (OXYLOSS) \ No newline at end of file diff --git a/code/game/objects/items/weapons/power_cells.dm b/code/game/objects/items/weapons/power_cells.dm index 3336e6c208..7d4c50a01f 100644 --- a/code/game/objects/items/weapons/power_cells.dm +++ b/code/game/objects/items/weapons/power_cells.dm @@ -21,6 +21,10 @@ var/construction_cost = list("metal"=750,"glass"=75) var/construction_time=100 + suicide_act(mob/user) + viewers(user) << "\red [user] is licking the electrodes of the [src]! It looks like \he's trying to commit suicide." + return (FIRELOSS) + /obj/item/weapon/cell/crap name = "\improper Nanotrasen brand rechargable AA battery" desc = "You can't top the plasma top." //TOTALLY TRADEMARK INFRINGEMENT diff --git a/code/game/objects/items/weapons/stunbaton.dm b/code/game/objects/items/weapons/stunbaton.dm index 39584aea53..d9c8d96f3a 100644 --- a/code/game/objects/items/weapons/stunbaton.dm +++ b/code/game/objects/items/weapons/stunbaton.dm @@ -12,6 +12,9 @@ var/status = 0 origin_tech = "combat=2" + suicide_act(mob/user) + viewers(user) << "\red [user] is putting the live [src] in \his mouth! It looks like \he's trying to commit suicide." + return (FIRELOSS) /obj/item/weapon/melee/baton/update_icon() if(status) diff --git a/code/game/objects/items/weapons/surgery_tools.dm b/code/game/objects/items/weapons/surgery_tools.dm index 4a28f6a29b..d8e0f1db99 100644 --- a/code/game/objects/items/weapons/surgery_tools.dm +++ b/code/game/objects/items/weapons/surgery_tools.dm @@ -294,7 +294,10 @@ origin_tech = "materials=1;biotech=1" attack_verb = list("drilled") - + suicide_act(mob/user) + viewers(user) << pick("/red [user] is pressing the [src] to \his temple and activating it! It looks like \he's trying to commit suicide.", \ + "/red [user] is pressing [src] to \his chest and activating it! It looks like \he's trying to commit suicide.") + return (BRUTELOSS) /* * Scalpel */ @@ -314,6 +317,12 @@ origin_tech = "materials=1;biotech=1" attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") + suicide_act(mob/user) + viewers(user) << pick("\red [user] is slitting \his wrists with the [src]! It looks like \he's trying to commit suicide.", \ + "\red [user] is slitting \his throat with the [src]! It looks like \he's trying to commit suicide.", \ + "\red [user] is slitting \his stomach open with the [src]! It looks like \he's trying to commit seppuku.") + return (BRUTELOSS) + /obj/item/weapon/scalpel/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob) if(!istype(M)) return ..() diff --git a/code/game/objects/items/weapons/tools.dm b/code/game/objects/items/weapons/tools.dm index 95bec1f9e2..520bc80371 100644 --- a/code/game/objects/items/weapons/tools.dm +++ b/code/game/objects/items/weapons/tools.dm @@ -48,6 +48,11 @@ m_amt = 75 attack_verb = list("stabbed") + suicide_act(mob/user) + viewers(user) << pick("\red [user] is stabbing the [src] into \his temple! It looks like \he's trying to commit suicide.", \ + "\red [user] is stabbing the [src] into \his heart! It looks like \he's trying to commit suicide.") + return(BRUTELOSS) + /obj/item/weapon/screwdriver/New() switch(pick("red","blue","purple","brown","green","cyan","yellow")) if ("red") diff --git a/code/game/objects/items/weapons/trashbag.dm b/code/game/objects/items/weapons/trashbag.dm index 0699132108..de2a64d001 100644 --- a/code/game/objects/items/weapons/trashbag.dm +++ b/code/game/objects/items/weapons/trashbag.dm @@ -10,6 +10,10 @@ var/mode = 1 //0 = pick one at a time, 1 = pick all on tile var/capacity = 25 //the amount of trash it can carry. + suicide_act(mob/user) + viewers(user) << "/red [user] has put the [src] over \his head and is starting to hyperventilate! It looks like \he's trying to commit suicide." + return(OXYLOSS) + /obj/item/weapon/trashbag/update_icon() if(contents.len == 0) icon_state = "trashbag0" diff --git a/code/game/objects/items/weapons/weaponry.dm b/code/game/objects/items/weapons/weaponry.dm index f1bcd25aaa..229b739385 100644 --- a/code/game/objects/items/weapons/weaponry.dm +++ b/code/game/objects/items/weapons/weaponry.dm @@ -11,6 +11,10 @@ throw_range = 15 attack_verb = list("banned") + suicide_act(mob/user) + viewers(user) << "\red [user] is hitting \himself with the [src]! It looks like \he's trying to ban \himself from life." + return (BRUTELOSS|FIRELOSS|TOXLOSS|OXYLOSS) + /obj/item/weapon/nullrod name = "null rod" desc = "A rod of pure obsidian, its very presence disrupts and dampens the powers of Nar-Sie's followers." @@ -24,6 +28,10 @@ throwforce = 10 w_class = 1 + suicide_act(mob/user) + viewers(user) << "\red [user] is impaling \himself with the [src]! It looks like \he's trying to commit suicide." + return (BRUTELOSS|FIRELOSS) + /obj/item/weapon/sord name = "\improper SORD" desc = "This thing is so unspeakably shitty you are having a hard time even holding it." @@ -36,6 +44,10 @@ w_class = 3 attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") + suicide_act(mob/user) + viewers(user) << "\red [user] is impaling \himself with the [src]! It looks like \he's trying to commit suicide." + return(BRUTELOSS) + /obj/item/weapon/sord/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob) playsound(loc, 'sound/weapons/bladeslice.ogg', 50, 1, -1) return ..() @@ -55,6 +67,10 @@ IsShield() return 1 + suicide_act(mob/user) + viewers(user) << "\red [user] is falling on the [src]! It looks like \he's trying to commit suicide." + return(BRUTELOSS) + /obj/item/weapon/claymore/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob) playsound(loc, 'sound/weapons/bladeslice.ogg', 50, 1, -1) return ..() @@ -71,6 +87,10 @@ w_class = 3 attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") + suicide_act(mob/user) + viewers(user) << "\red [user] is slitting \his stomach open with the [src]! It looks like \he's trying to commit seppuku." + return(BRUTELOSS) + /obj/item/weapon/katana/IsShield() return 1 diff --git a/code/game/verbs/suicide.dm b/code/game/verbs/suicide.dm index 38629d9d6c..52fd93f0a4 100644 --- a/code/game/verbs/suicide.dm +++ b/code/game/verbs/suicide.dm @@ -22,8 +22,53 @@ src << "You can't commit suicide whilst restrained! ((You can type Ghost instead however.))" return suiciding = 1 - //instead of killing them instantly, just put them at -175 health and let 'em gasp for a while - viewers(src) << "\red [src] is attempting to bite \his tongue. It looks like \he's trying to commit suicide." + var/obj/item/held_item = get_active_hand() + 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)) + + updatehealth() + return + + + viewers(src) << pick("\red [src] is attempting to bite \his tongue off! It looks like \he's trying to commit suicide.", \ + "\red [src] is jamming \his thumbs into \his eye sockets! It looks like \he's trying to commit suicide.", \ + "\red [src] is twisting \his own neck! It looks like \he's trying to commit suicide.", \ + "\red [src] is holding \his breath! It looks like \he's trying to commit suicide.") adjustOxyLoss(max(175 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0)) updatehealth() diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index c2f6a904b6..33e2b5185b 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -191,7 +191,7 @@ msg += "[t_He] [t_is] twitching ever so slightly.\n" if(suiciding) - msg += "[t_He] [t_has] bitten off [t_his] own tongue and [t_has] suffered major bloodloss!\n" + msg += "[t_He] appears to have commited suicide... there is no hope of recovery.\n" if(stat == DEAD || (status_flags & FAKEDEATH)) if(brain_op_stage != 4)//Only perform these checks if there is no brain diff --git a/code/modules/mob/living/simple_animal/parrot.dm b/code/modules/mob/living/simple_animal/parrot.dm index c6c33b4a72..931c88587f 100644 --- a/code/modules/mob/living/simple_animal/parrot.dm +++ b/code/modules/mob/living/simple_animal/parrot.dm @@ -106,6 +106,10 @@ walk(src,0) ..() +/mob/living/simple_animal/parrot/Stat() + ..() + stat("Held Item", held_item) + /* * Inventory */ diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index fd99360fc0..f44939e5ea 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -172,6 +172,10 @@ item_state = "coil_red" attack_verb = list("whipped", "lashed", "disciplined", "flogged") + suicide_act(mob/user) + viewers(user) << "\red [user] is strangling \himself with the [src]! It looks like \he's trying to commit suicide." + return(OXYLOSS) + /obj/item/weapon/cable_coil/New(loc, length = MAXCOIL, var/param_color = null) ..() diff --git a/code/setup.dm b/code/setup.dm index 44ece34e80..ed10df76b6 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -409,6 +409,7 @@ var/list/global_mutations = list() // list of hidden mutation things //Damage things //TODO: merge these down to reduce on defines +//Way to waste perfectly good damagetype names (BRUTE) on this... If you were really worried about case sensitivity, you could have just used lowertext(damagetype) in the proc... #define BRUTE "brute" #define BURN "fire" #define TOX "tox" @@ -424,6 +425,12 @@ var/list/global_mutations = list() // list of hidden mutation things #define EYE_BLUR "eye_blur" #define DROWSY "drowsy" +//I hate adding defines like this but I'd much rather deal with bitflags than lists and string searches +#define BRUTELOSS 1 +#define FIRELOSS 2 +#define TOXLOSS 4 +#define OXYLOSS 8 + //Bitflags defining which status effects could be or are inflicted on a mob #define CANSTUN 1 #define CANWEAKEN 2