Adds an item proc for accidental consumption and implements it in food containers (bread, cake, cheese) (#51925)

* cronch monch ow, i'm dyin bros

* oopsies

* also should've removed that

* first round of fixes, thanks bros

* fk

* Some post cleanup

* ?

* if-else begone

* gotta sweep sweep sweep

* proper math

* Update code/modules/projectiles/ammunition/_ammunition.dm

Co-authored-by: ラッピ from PSO2 <11748095+ExcessiveUseOfCobblestone@users.noreply.github.com>
This commit is contained in:
MrMelbert
2020-07-20 09:40:46 -04:00
committed by GitHub
co-authored by ラッピ from PSO2
parent db4d78e1ff
commit 789aa2b6ba
12 changed files with 393 additions and 16 deletions
+9
View File
@@ -141,3 +141,12 @@ Simple datum which is instanced once per type and is used for every object of sa
/datum/material/proc/on_removed_turf(turf/T, material_flags)
return
/**
* This proc is called when the mat is found in an item that's consumed by accident. see /obj/item/proc/on_accidental_consumption.
* Arguments
* * M - person consuming the mat
* * S - (optional) item the mat is contained in (NOT the item with the mat itself)
*/
/datum/material/proc/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
return FALSE
+94 -1
View File
@@ -7,6 +7,10 @@
sheet_type = /obj/item/stack/sheet/metal
value_per_unit = 0.0025
/datum/material/iron/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
M.apply_damage(10, BRUTE, BODY_ZONE_HEAD, wound_bonus = 5)
return TRUE
///Breaks extremely easily but is transparent.
/datum/material/glass
name = "glass"
@@ -20,6 +24,10 @@
beauty_modifier = 0.05
armor_modifiers = list("melee" = 0.2, "bullet" = 0.2, "laser" = 0, "energy" = 1, "bomb" = 0, "bio" = 0.2, "rad" = 0.2, "fire" = 1, "acid" = 0.2)
/datum/material/glass/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
M.apply_damage(10, BRUTE, BODY_ZONE_HEAD, wound_bonus = 5, sharpness = TRUE) //cronch
return TRUE
/*
Color matrices are like regular colors but unlike with normal colors, you can go over 255 on a channel.
Unless you know what you're doing, only use the first three numbers. They're in RGB order.
@@ -35,6 +43,10 @@ Unless you know what you're doing, only use the first three numbers. They're in
value_per_unit = 0.025
beauty_modifier = 0.075
/datum/material/silver/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
M.apply_damage(10, BRUTE, BODY_ZONE_HEAD, wound_bonus = 5)
return TRUE
///Slight force increase
/datum/material/gold
name = "gold"
@@ -47,6 +59,10 @@ Unless you know what you're doing, only use the first three numbers. They're in
beauty_modifier = 0.15
armor_modifiers = list("melee" = 1.1, "bullet" = 1.1, "laser" = 1.15, "energy" = 1.15, "bomb" = 1, "bio" = 1, "rad" = 1, "fire" = 0.7, "acid" = 1.1)
/datum/material/gold/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
M.apply_damage(10, BRUTE, BODY_ZONE_HEAD, wound_bonus = 5)
return TRUE
///Has no special properties
/datum/material/diamond
name = "diamond"
@@ -59,6 +75,10 @@ Unless you know what you're doing, only use the first three numbers. They're in
beauty_modifier = 0.3
armor_modifiers = list("melee" = 1.3, "bullet" = 1.3, "laser" = 0.6, "energy" = 1, "bomb" = 1.2, "bio" = 1, "rad" = 1, "fire" = 1, "acid" = 1)
/datum/material/diamond/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
M.apply_damage(15, BRUTE, BODY_ZONE_HEAD, wound_bonus = 7)
return TRUE
///Is slightly radioactive
/datum/material/uranium
name = "uranium"
@@ -78,6 +98,11 @@ Unless you know what you're doing, only use the first three numbers. They're in
. = ..()
qdel(source.GetComponent(/datum/component/radioactive))
/datum/material/uranium/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
M.reagents.add_reagent(/datum/reagent/uranium, rand(4, 6))
S?.reagents?.add_reagent(/datum/reagent/uranium, S.reagents.total_volume*(2/5))
return TRUE
///Adds firestacks on hit (Still needs support to turn into gas on destruction)
/datum/material/plasma
name = "plasma"
@@ -100,6 +125,11 @@ Unless you know what you're doing, only use the first three numbers. They're in
source.RemoveElement(/datum/element/firestacker, amount=1)
qdel(source.GetComponent(/datum/component/explodable))
/datum/material/plasma/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
M.reagents.add_reagent(/datum/reagent/toxin/plasma, rand(6, 8))
S?.reagents?.add_reagent(/datum/reagent/toxin/plasma, S.reagents.total_volume*(2/5))
return TRUE
///Can cause bluespace effects on use. (Teleportation) (Not yet implemented)
/datum/material/bluespace
name = "bluespace crystal"
@@ -111,6 +141,11 @@ Unless you know what you're doing, only use the first three numbers. They're in
sheet_type = /obj/item/stack/sheet/bluespace_crystal
value_per_unit = 0.15
/datum/material/bluespace/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
M.reagents.add_reagent(/datum/reagent/bluespace, rand(5, 8))
S?.reagents?.add_reagent(/datum/reagent/bluespace, S.reagents.total_volume*(2/5))
return TRUE
///Honks and slips
/datum/material/bananium
name = "bananium"
@@ -127,12 +162,15 @@ Unless you know what you're doing, only use the first three numbers. They're in
source.AddComponent(/datum/component/squeak, list('sound/items/bikehorn.ogg'=1), 50)
source.AddComponent(/datum/component/slippery, min(amount / 10, 80))
/datum/material/bananium/on_removed(atom/source, amount, material_flags)
. = ..()
qdel(source.GetComponent(/datum/component/slippery))
qdel(source.GetComponent(/datum/component/squeak))
/datum/material/bananium/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
M.reagents.add_reagent(/datum/reagent/consumable/banana, rand(8, 12))
S?.reagents?.add_reagent(/datum/reagent/consumable/banana, S.reagents.total_volume*(2/5))
return TRUE
///Mediocre force increase
/datum/material/titanium
@@ -146,6 +184,10 @@ Unless you know what you're doing, only use the first three numbers. They're in
beauty_modifier = 0.05
armor_modifiers = list("melee" = 1.35, "bullet" = 1.3, "laser" = 1.3, "energy" = 1.25, "bomb" = 1.25, "bio" = 1, "rad" = 1, "fire" = 0.7, "acid" = 1)
/datum/material/titanium/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
M.apply_damage(15, BRUTE, BODY_ZONE_HEAD, wound_bonus = 7)
return TRUE
/datum/material/runite
name = "runite"
desc = "Runite"
@@ -157,6 +199,10 @@ Unless you know what you're doing, only use the first three numbers. They're in
beauty_modifier = 0.5
armor_modifiers = list("melee" = 1.35, "bullet" = 2, "laser" = 0.5, "energy" = 1.25, "bomb" = 1.25, "bio" = 1, "rad" = 1, "fire" = 1.4, "acid" = 1) //rune is weak against magic lasers but strong against bullets. This is the combat triangle.
/datum/material/runite/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
M.apply_damage(20, BRUTE, BODY_ZONE_HEAD, wound_bonus = 10)
return TRUE
///Force decrease
/datum/material/plastic
name = "plastic"
@@ -169,6 +215,10 @@ Unless you know what you're doing, only use the first three numbers. They're in
beauty_modifier = -0.01
armor_modifiers = list("melee" = 1.5, "bullet" = 1.1, "laser" = 0.3, "energy" = 0.5, "bomb" = 1, "bio" = 1, "rad" = 1, "fire" = 1.1, "acid" = 1)
/datum/material/plastic/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
M.adjust_disgust(17)
return TRUE
///Force decrease and mushy sound effect. (Not yet implemented)
/datum/material/biomass
name = "biomass"
@@ -200,6 +250,15 @@ Unless you know what you're doing, only use the first three numbers. They're in
var/obj/wooden = source
wooden.resistance_flags &= ~FLAMMABLE
/datum/material/wood/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
M.apply_damage(5, BRUTE, BODY_ZONE_HEAD)
var/obj/item/reagent_containers/food/snacks/food_S = S
if(istype(food_S) && food_S?.tastes?.len)
food_S.tastes += "wood chips and sawdust"
food_S.tastes["wood chips and sawdust"] = 3
return TRUE
///Stronk force increase
/datum/material/adamantine
name = "adamantine"
@@ -212,6 +271,10 @@ Unless you know what you're doing, only use the first three numbers. They're in
beauty_modifier = 0.4
armor_modifiers = list("melee" = 1.5, "bullet" = 1.5, "laser" = 1.3, "energy" = 1.3, "bomb" = 1, "bio" = 1, "rad" = 1, "fire" = 2.5, "acid" = 1)
/datum/material/adamantine/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
M.apply_damage(20, BRUTE, BODY_ZONE_HEAD, wound_bonus = 10)
return TRUE
///RPG Magic.
/datum/material/mythril
name = "mythril"
@@ -234,6 +297,10 @@ Unless you know what you're doing, only use the first three numbers. They're in
if(istype(source, /obj/item))
qdel(source.GetComponent(/datum/component/fantasy))
/datum/material/mythril/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
M.apply_damage(20, BRUTE, BODY_ZONE_HEAD, wound_bonus = 10)
return TRUE
//formed when freon react with o2, emits a lot of plasma when heated
/datum/material/hot_ice
name = "hot ice"
@@ -253,6 +320,15 @@ Unless you know what you're doing, only use the first three numbers. They're in
qdel(source.GetComponent(/datum/component/hot_ice, "plasma", amount*150, amount*20+300))
return ..()
/datum/material/hot_ice/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
M.reagents.add_reagent(/datum/reagent/toxin/plasma, rand(5, 6))
S?.reagents?.add_reagent(/datum/reagent/toxin/plasma, S.reagents.total_volume*(3/5))
var/obj/item/reagent_containers/food/snacks/food_S = S
if(istype(food_S) && food_S?.tastes?.len)
food_S.tastes += "salt"
food_S.tastes["salt"] = 3
return TRUE
/datum/material/metalhydrogen
name = "Metal Hydrogen"
desc = "Solid metallic hydrogen. Some say it should be impossible"
@@ -265,6 +341,10 @@ Unless you know what you're doing, only use the first three numbers. They're in
strength_modifier = 1.2
armor_modifiers = list("melee" = 1.35, "bullet" = 1.3, "laser" = 1.3, "energy" = 1.25, "bomb" = 0.7, "bio" = 1, "rad" = 1, "fire" = 1.3, "acid" = 1)
/datum/material/metalhydrogen/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
M.apply_damage(15, BRUTE, BODY_ZONE_HEAD, wound_bonus = 7)
return TRUE
//I don't like sand. It's coarse, and rough, and irritating, and it gets everywhere.
/datum/material/sand
name = "sand"
@@ -280,6 +360,10 @@ Unless you know what you're doing, only use the first three numbers. They're in
turf_sound_override = FOOTSTEP_SAND
texture_layer_icon_state = "sand"
/datum/material/sand/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
M.adjust_disgust(17)
return TRUE
//And now for our lavaland dwelling friends, sand, but in stone form! Truly revolutionary.
/datum/material/sandstone
name = "sandstone"
@@ -305,6 +389,10 @@ Unless you know what you're doing, only use the first three numbers. They're in
turf_sound_override = FOOTSTEP_SAND
texture_layer_icon_state = "sand"
/datum/material/snow/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
M.reagents.add_reagent(/datum/reagent/water, rand(5, 10))
return TRUE
/datum/material/runedmetal
name = "runed metal"
desc = "Mir'ntrath barhah Nar'sie."
@@ -316,6 +404,11 @@ Unless you know what you're doing, only use the first three numbers. They're in
beauty_modifier = -0.15
texture_layer_icon_state = "runed"
/datum/material/runedmetal/on_accidental_mat_consumption(mob/living/carbon/M, obj/item/S)
M.reagents.add_reagent(/datum/reagent/fuel/unholywater, rand(8, 12))
M.apply_damage(10, BRUTE, BODY_ZONE_HEAD, wound_bonus = 5)
return TRUE
/datum/material/bronze
name = "bronze"
desc = "Clock Cult? Never heard of it."