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
This commit is contained in:
johnsonmt88@gmail.com
2013-01-05 03:56:24 +00:00
parent 9cf23741ca
commit 2c3ae32f04
18 changed files with 174 additions and 6 deletions

View File

@@ -1217,6 +1217,10 @@
reagents.add_reagent("pacid", round(potency, 1)) reagents.add_reagent("pacid", round(potency, 1))
force = round((5+potency/2.5), 1) force = round((5+potency/2.5), 1)
suicide_act(mob/user)
viewers(user) << "\red <b>[user] is eating some of the [src]! It looks like \he's trying to commit suicide.</b>"
return (BRUTELOSS|TOXLOSS)
// ************************************* // *************************************
// Pestkiller defines for hydroponics // Pestkiller defines for hydroponics
// ************************************* // *************************************
@@ -1284,6 +1288,10 @@
var/toxicity = 4 var/toxicity = 4
var/WeedKillStr = 2 var/WeedKillStr = 2
suicide_act(mob/user)
viewers(user) << "\red <b>[user] is huffing the [src]! It looks like \he's trying to commit suicide.</b>"
return (TOXLOSS)
/obj/item/weapon/pestspray // -- Skie /obj/item/weapon/pestspray // -- Skie
desc = "It's some pest eliminator spray! <I>Do not inhale!</I>" desc = "It's some pest eliminator spray! <I>Do not inhale!</I>"
icon = 'icons/obj/hydroponics.dmi' icon = 'icons/obj/hydroponics.dmi'
@@ -1299,6 +1307,10 @@
var/toxicity = 4 var/toxicity = 4
var/PestKillStr = 2 var/PestKillStr = 2
suicide_act(mob/user)
viewers(user) << "\red <b>[user] is huffing the [src]! It looks like \he's trying to commit suicide.</b>"
return (TOXLOSS)
/obj/item/weapon/minihoe // -- Numbers /obj/item/weapon/minihoe // -- Numbers
name = "mini hoe" name = "mini hoe"
desc = "It's used for removing weeds or scratching your back." desc = "It's used for removing weeds or scratching your back."

View File

@@ -223,6 +223,10 @@
desc = "A trap used to catch bears and other legged creatures." desc = "A trap used to catch bears and other legged creatures."
var/armed = 0 var/armed = 0
suicide_act(mob/user)
viewers(user) << "\red <b>[user] is putting the [src] on \his head! It looks like \he's trying to commit suicide.</b>"
return (BRUTELOSS)
/obj/item/weapon/legcuffs/beartrap/attack_self(mob/user as mob) /obj/item/weapon/legcuffs/beartrap/attack_self(mob/user as mob)
..() ..()
if(ishuman(user) && !user.stat && !user.restrained()) if(ishuman(user) && !user.stat && !user.restrained())
@@ -304,6 +308,11 @@
g_amt = 3750 g_amt = 3750
attack_verb = list("stabbed", "slashed", "sliced", "cut") attack_verb = list("stabbed", "slashed", "sliced", "cut")
suicide_act(mob/user)
viewers(user) << pick("/red <b>[user] is slitting \his wrists with the shard of glass! It looks like \he's trying to commit suicide.</b>", \
"\red <b>[user] is slitting \his throat with the shard of glass! It looks like \he's trying to commit suicide.</b>")
return (BRUTELOSS)
/obj/item/weapon/shard/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob) /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) playsound(loc, 'sound/weapons/bladeslice.ogg', 50, 1, -1)
return ..() return ..()
@@ -428,6 +437,9 @@
m_amt = 40 m_amt = 40
attack_verb = list("whipped", "lashed", "disciplined", "tickled") attack_verb = list("whipped", "lashed", "disciplined", "tickled")
suicide_act(mob/user)
viewers(user) << "\red <b>[user] is strangling \himself with the [src]! It looks like \he's trying to commit suicide.</b>"
return (OXYLOSS)
/obj/item/weapon/module /obj/item/weapon/module
icon = 'icons/obj/module.dmi' icon = 'icons/obj/module.dmi'

View File

@@ -61,6 +61,16 @@
/obj/item/blob_act() /obj/item/blob_act()
return 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() /obj/item/verb/move_to_top()
set name = "Move To Top" set name = "Move To Top"
set category = "Object" set category = "Object"

View File

@@ -193,7 +193,7 @@
* Toy crossbow * Toy crossbow
*/ */
/obj/item/toy/crossbow /obj/item/toy/crossbow
name = "foam dart crossbow" name = "foam dart crossbow"
desc = "A weapon favored by many overactive children. Ages 8 and up." desc = "A weapon favored by many overactive children. Ages 8 and up."
icon = 'icons/obj/gun.dmi' icon = 'icons/obj/gun.dmi'
@@ -368,6 +368,10 @@
var/instant = 0 var/instant = 0
var/colourName = "red" //for updateIcon purposes var/colourName = "red" //for updateIcon purposes
suicide_act(mob/user)
viewers(user) << "\red <b>[user] is jaming the [src] up \his nose and into \his brain. It looks like \he's trying to commit suicide.</b>"
return (BRUTELOSS|OXYLOSS)
/* /*
* Snap pops * Snap pops
*/ */

View File

@@ -81,6 +81,12 @@
force = 10.0 force = 10.0
throwforce = 10.0 throwforce = 10.0
suicide_act(mob/user)
viewers(user) << pick("\red <b>[user] is slitting \his wrists with the [src]! It looks like \he's trying to commit suicide.</b>", \
"\red <b>[user] is slitting \his throat with the [src]! It looks like \he's trying to commit suicide.</b>", \
"\red <b>[user] is slitting \his stomach open with the [src]! It looks like \he's trying to commit seppuku.</b>")
return (BRUTELOSS)
/obj/item/weapon/kitchen/utensil/knife/attack(target as mob, mob/living/user as mob) /obj/item/weapon/kitchen/utensil/knife/attack(target as mob, mob/living/user as mob)
if ((CLUMSY in user.mutations) && prob(50)) if ((CLUMSY in user.mutations) && prob(50))
user << "\red You accidentally cut yourself with the [src]." user << "\red You accidentally cut yourself with the [src]."
@@ -107,6 +113,12 @@
origin_tech = "materials=1" origin_tech = "materials=1"
attack_verb = list("slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") attack_verb = list("slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
suicide_act(mob/user)
viewers(user) << pick("\red <b>[user] is slitting \his wrists with the [src]! It looks like \he's trying to commit suicide.</b>", \
"\red <b>[user] is slitting \his throat with the [src]! It looks like \he's trying to commit suicide.</b>", \
"\red <b>[user] is slitting \his stomach open with the [src]! It looks like \he's trying to commit seppuku.</b>")
return (BRUTELOSS)
/obj/item/weapon/kitchenknife/ritual /obj/item/weapon/kitchenknife/ritual
name = "ritual knife" name = "ritual knife"
desc = "The unearthly energies that once powered this blade are now dormant." desc = "The unearthly energies that once powered this blade are now dormant."

View File

@@ -1,6 +1,11 @@
/obj/item/weapon/melee/energy /obj/item/weapon/melee/energy
var/active = 0 var/active = 0
suicide_act(mob/user)
viewers(user) << pick("\red <b>[user] is slitting \his stomach open with the [src]! It looks like \he's trying to commit seppuku.</b>", \
"\red <b>[user] is falling on the [src]! It looks like \he's trying to commit suicide.</b>")
return (BRUTELOSS|FIRELOSS)
/obj/item/weapon/melee/energy/axe /obj/item/weapon/melee/energy/axe
name = "energy axe" name = "energy axe"
desc = "An energised battle axe." desc = "An energised battle axe."
@@ -14,6 +19,10 @@
origin_tech = "combat=3" origin_tech = "combat=3"
attack_verb = list("attacked", "chopped", "cleaved", "torn", "cut") attack_verb = list("attacked", "chopped", "cleaved", "torn", "cut")
suicide_act(mob/user)
viewers(user) << "\red <b>[user] swings the [src] towards /his head! It looks like \he's trying to commit suicide.</b>"
return (BRUTELOSS|FIRELOSS)
/obj/item/weapon/melee/energy/sword /obj/item/weapon/melee/energy/sword
color color
name = "energy sword" name = "energy sword"

View File

@@ -9,4 +9,8 @@
throwforce = 7 throwforce = 7
w_class = 3 w_class = 3
origin_tech = "combat=4" origin_tech = "combat=4"
attack_verb = list("flogged", "whipped", "lashed", "disciplined") attack_verb = list("flogged", "whipped", "lashed", "disciplined")
suicide_act(mob/user)
viewers(user) << "\red <b>[user] is strangling \himself with the [src]! It looks like \he's trying to commit suicide.</b>"
return (OXYLOSS)

View File

@@ -21,6 +21,10 @@
var/construction_cost = list("metal"=750,"glass"=75) var/construction_cost = list("metal"=750,"glass"=75)
var/construction_time=100 var/construction_time=100
suicide_act(mob/user)
viewers(user) << "\red <b>[user] is licking the electrodes of the [src]! It looks like \he's trying to commit suicide.</b>"
return (FIRELOSS)
/obj/item/weapon/cell/crap /obj/item/weapon/cell/crap
name = "\improper Nanotrasen brand rechargable AA battery" name = "\improper Nanotrasen brand rechargable AA battery"
desc = "You can't top the plasma top." //TOTALLY TRADEMARK INFRINGEMENT desc = "You can't top the plasma top." //TOTALLY TRADEMARK INFRINGEMENT

View File

@@ -12,6 +12,9 @@
var/status = 0 var/status = 0
origin_tech = "combat=2" origin_tech = "combat=2"
suicide_act(mob/user)
viewers(user) << "\red <b>[user] is putting the live [src] in \his mouth! It looks like \he's trying to commit suicide.</b>"
return (FIRELOSS)
/obj/item/weapon/melee/baton/update_icon() /obj/item/weapon/melee/baton/update_icon()
if(status) if(status)

View File

@@ -294,7 +294,10 @@
origin_tech = "materials=1;biotech=1" origin_tech = "materials=1;biotech=1"
attack_verb = list("drilled") attack_verb = list("drilled")
suicide_act(mob/user)
viewers(user) << pick("/red <b>[user] is pressing the [src] to \his temple and activating it! It looks like \he's trying to commit suicide.</b>", \
"/red <b>[user] is pressing [src] to \his chest and activating it! It looks like \he's trying to commit suicide.</b>")
return (BRUTELOSS)
/* /*
* Scalpel * Scalpel
*/ */
@@ -314,6 +317,12 @@
origin_tech = "materials=1;biotech=1" origin_tech = "materials=1;biotech=1"
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
suicide_act(mob/user)
viewers(user) << pick("\red <b>[user] is slitting \his wrists with the [src]! It looks like \he's trying to commit suicide.</b>", \
"\red <b>[user] is slitting \his throat with the [src]! It looks like \he's trying to commit suicide.</b>", \
"\red <b>[user] is slitting \his stomach open with the [src]! It looks like \he's trying to commit seppuku.</b>")
return (BRUTELOSS)
/obj/item/weapon/scalpel/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob) /obj/item/weapon/scalpel/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
if(!istype(M)) if(!istype(M))
return ..() return ..()

View File

@@ -48,6 +48,11 @@
m_amt = 75 m_amt = 75
attack_verb = list("stabbed") attack_verb = list("stabbed")
suicide_act(mob/user)
viewers(user) << pick("\red <b>[user] is stabbing the [src] into \his temple! It looks like \he's trying to commit suicide.</b>", \
"\red <b>[user] is stabbing the [src] into \his heart! It looks like \he's trying to commit suicide.</b>")
return(BRUTELOSS)
/obj/item/weapon/screwdriver/New() /obj/item/weapon/screwdriver/New()
switch(pick("red","blue","purple","brown","green","cyan","yellow")) switch(pick("red","blue","purple","brown","green","cyan","yellow"))
if ("red") if ("red")

View File

@@ -10,6 +10,10 @@
var/mode = 1 //0 = pick one at a time, 1 = pick all on tile var/mode = 1 //0 = pick one at a time, 1 = pick all on tile
var/capacity = 25 //the amount of trash it can carry. var/capacity = 25 //the amount of trash it can carry.
suicide_act(mob/user)
viewers(user) << "/red <b>[user] has put the [src] over \his head and is starting to hyperventilate! It looks like \he's trying to commit suicide.</b>"
return(OXYLOSS)
/obj/item/weapon/trashbag/update_icon() /obj/item/weapon/trashbag/update_icon()
if(contents.len == 0) if(contents.len == 0)
icon_state = "trashbag0" icon_state = "trashbag0"

View File

@@ -11,6 +11,10 @@
throw_range = 15 throw_range = 15
attack_verb = list("banned") attack_verb = list("banned")
suicide_act(mob/user)
viewers(user) << "\red <b>[user] is hitting \himself with the [src]! It looks like \he's trying to ban \himself from life.</b>"
return (BRUTELOSS|FIRELOSS|TOXLOSS|OXYLOSS)
/obj/item/weapon/nullrod /obj/item/weapon/nullrod
name = "null rod" name = "null rod"
desc = "A rod of pure obsidian, its very presence disrupts and dampens the powers of Nar-Sie's followers." 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 throwforce = 10
w_class = 1 w_class = 1
suicide_act(mob/user)
viewers(user) << "\red <b>[user] is impaling \himself with the [src]! It looks like \he's trying to commit suicide.</b>"
return (BRUTELOSS|FIRELOSS)
/obj/item/weapon/sord /obj/item/weapon/sord
name = "\improper SORD" name = "\improper SORD"
desc = "This thing is so unspeakably shitty you are having a hard time even holding it." desc = "This thing is so unspeakably shitty you are having a hard time even holding it."
@@ -36,6 +44,10 @@
w_class = 3 w_class = 3
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
suicide_act(mob/user)
viewers(user) << "\red <b>[user] is impaling \himself with the [src]! It looks like \he's trying to commit suicide.</b>"
return(BRUTELOSS)
/obj/item/weapon/sord/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob) /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) playsound(loc, 'sound/weapons/bladeslice.ogg', 50, 1, -1)
return ..() return ..()
@@ -55,6 +67,10 @@
IsShield() IsShield()
return 1 return 1
suicide_act(mob/user)
viewers(user) << "\red <b>[user] is falling on the [src]! It looks like \he's trying to commit suicide.</b>"
return(BRUTELOSS)
/obj/item/weapon/claymore/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob) /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) playsound(loc, 'sound/weapons/bladeslice.ogg', 50, 1, -1)
return ..() return ..()
@@ -71,6 +87,10 @@
w_class = 3 w_class = 3
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
suicide_act(mob/user)
viewers(user) << "\red <b>[user] is slitting \his stomach open with the [src]! It looks like \he's trying to commit seppuku.</b>"
return(BRUTELOSS)
/obj/item/weapon/katana/IsShield() /obj/item/weapon/katana/IsShield()
return 1 return 1

View File

@@ -22,8 +22,53 @@
src << "You can't commit suicide whilst restrained! ((You can type Ghost instead however.))" src << "You can't commit suicide whilst restrained! ((You can type Ghost instead however.))"
return return
suiciding = 1 suiciding = 1
//instead of killing them instantly, just put them at -175 health and let 'em gasp for a while var/obj/item/held_item = get_active_hand()
viewers(src) << "\red <b>[src] is attempting to bite \his tongue. It looks like \he's trying to commit suicide.</b>" 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 <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)) adjustOxyLoss(max(175 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0))
updatehealth() updatehealth()

View File

@@ -191,7 +191,7 @@
msg += "<span class='warning'>[t_He] [t_is] twitching ever so slightly.</span>\n" msg += "<span class='warning'>[t_He] [t_is] twitching ever so slightly.</span>\n"
if(suiciding) if(suiciding)
msg += "<span class='warning'>[t_He] [t_has] bitten off [t_his] own tongue and [t_has] suffered major bloodloss!</span>\n" msg += "<span class='warning'>[t_He] appears to have commited suicide... there is no hope of recovery.</span>\n"
if(stat == DEAD || (status_flags & FAKEDEATH)) if(stat == DEAD || (status_flags & FAKEDEATH))
if(brain_op_stage != 4)//Only perform these checks if there is no brain if(brain_op_stage != 4)//Only perform these checks if there is no brain

View File

@@ -106,6 +106,10 @@
walk(src,0) walk(src,0)
..() ..()
/mob/living/simple_animal/parrot/Stat()
..()
stat("Held Item", held_item)
/* /*
* Inventory * Inventory
*/ */

View File

@@ -172,6 +172,10 @@
item_state = "coil_red" item_state = "coil_red"
attack_verb = list("whipped", "lashed", "disciplined", "flogged") attack_verb = list("whipped", "lashed", "disciplined", "flogged")
suicide_act(mob/user)
viewers(user) << "\red <b>[user] is strangling \himself with the [src]! It looks like \he's trying to commit suicide.</b>"
return(OXYLOSS)
/obj/item/weapon/cable_coil/New(loc, length = MAXCOIL, var/param_color = null) /obj/item/weapon/cable_coil/New(loc, length = MAXCOIL, var/param_color = null)
..() ..()

View File

@@ -409,6 +409,7 @@ var/list/global_mutations = list() // list of hidden mutation things
//Damage things //TODO: merge these down to reduce on defines //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 BRUTE "brute"
#define BURN "fire" #define BURN "fire"
#define TOX "tox" #define TOX "tox"
@@ -424,6 +425,12 @@ var/list/global_mutations = list() // list of hidden mutation things
#define EYE_BLUR "eye_blur" #define EYE_BLUR "eye_blur"
#define DROWSY "drowsy" #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 //Bitflags defining which status effects could be or are inflicted on a mob
#define CANSTUN 1 #define CANSTUN 1
#define CANWEAKEN 2 #define CANWEAKEN 2