diff --git a/code/__defines/dcs/signals/signals_trasheating.dm b/code/__defines/dcs/signals/signals_trasheating.dm new file mode 100644 index 0000000000..fa1e42c737 --- /dev/null +++ b/code/__defines/dcs/signals/signals_trasheating.dm @@ -0,0 +1,16 @@ +// /obj/item signals for trasheater + +/// item eaten by a mob, called by /obj/proc/after_trash_eaten(var/mob/living/user) : (obj/item/thing, mob/eater) +#define COMSIG_GLOB_ITEM_TRASH_EATEN "!trash_eaten_by_mob" + +///called when an item is attempted to be eaten by a mob: (mob/living/user) +#define COMSIG_ITEM_TRASH_EATEN "item_trash_eaten" + #define COMSIG_ITEM_TRASH_EAT_DENY (1<<0) + #define COMSIG_ITEM_TRASH_EAT_FORCED (1<<1) +///called when a mob attempts to eat an item: (obj/item/thing) +#define COMSIG_MOB_TRASH_EATING "mob_trash_eating" +///called after the item is eaten: (mob/living/user) +#define COMSIG_ITEM_AFTER_TRASH_EAT "item_after_trash_eaten" + #define COMSIG_ITEM_AFTER_TRASH_EAT_HIDE_MESSAGE (1<<0) +///called after mob eats item: (obj/item/thing) +#define COMSIG_MOB_AFTER_TRASH_EATING "mob_after_trash_eating" diff --git a/code/game/objects/trash_eating.dm b/code/game/objects/trash_eating.dm index fcfdafe84a..58b8861807 100644 --- a/code/game/objects/trash_eating.dm +++ b/code/game/objects/trash_eating.dm @@ -1,6 +1,13 @@ // checks for when items are consumed by trash/ore eater /obj/item/proc/on_trash_eaten(var/mob/living/user) SHOULD_CALL_PARENT(TRUE) + + var/signal_results = SEND_SIGNAL(src, COMSIG_ITEM_TRASH_EATEN, user) | SEND_SIGNAL(user, COMSIG_MOB_TRASH_EATING, src) + if(signal_results & COMSIG_ITEM_TRASH_EAT_DENY) // A component attached to the item or the mob said we cannot eat this + return FALSE + if(signal_results & COMSIG_ITEM_TRASH_EAT_FORCED) // Ignore everything including blacklist, prefs and adminbus. Component is handling the rules. + return TRUE + if(is_type_in_list(src, GLOB.item_vore_blacklist) && !user.adminbus_trash) //If someone has adminbus, they can eat whatever they want. to_chat(user, span_warning("You are not allowed to eat this.")) return FALSE @@ -11,10 +18,22 @@ to_chat(user, span_warning("You really should not be eating this.")) message_admins("[key_name(user)] has attempted to ingest an uplink item. ([user ? ADMIN_JMP(user) : "null"])") return FALSE + return TRUE -/obj/item/proc/after_trash_eaten(var/mob/living/user) // Override for post-swallow messages - to_chat(src, span_notice("You can taste the flavor of garbage. Delicious.")) +/// Override this for post-swallow messages. Returns true if components on mob or item allow trash eating messages +/obj/proc/after_trash_eaten(var/mob/living/user) + SHOULD_CALL_PARENT(TRUE) + SEND_GLOBAL_SIGNAL(COMSIG_GLOB_ITEM_TRASH_EATEN, src, user) + var/signal_results = SEND_SIGNAL(src, COMSIG_ITEM_AFTER_TRASH_EAT, user) | SEND_SIGNAL(user, COMSIG_MOB_AFTER_TRASH_EATING, src) + if(signal_results & COMSIG_ITEM_AFTER_TRASH_EAT_HIDE_MESSAGE) + return FALSE // Deny messages + return TRUE + +/obj/item/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return + to_chat(user, span_notice("You can taste the flavor of garbage. Delicious.")) // PAI /obj/item/paicard/on_trash_eaten(var/mob/living/user) @@ -27,6 +46,8 @@ return TRUE /obj/item/paicard/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the sweet flavor of digital friendship.")) if(pai && pai.client && isbelly(loc)) var/obj/belly/B = loc @@ -42,6 +63,8 @@ return TRUE /obj/item/book/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the dry flavor of knowledge.")) // PDA @@ -68,6 +91,8 @@ return TRUE /obj/item/pda/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the sweet flavor of delicious technology.")) // ID @@ -91,6 +116,8 @@ return TRUE /obj/item/card/id/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the delicious flavour of a person's whole identity.")) // Shoes @@ -112,79 +139,123 @@ return TRUE /obj/item/capture_crystal/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return if(bound_mob && (bound_mob in contents)) if(isbelly(loc)) to_chat(user, span_notice("You can taste the the power of command.")) // Most trash has no special check, so the rest of these are just after_trash_eaten() /obj/item/flashlight/flare/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the flavor of spicy cardboard.")) /obj/item/flame/match/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the flavor of spicy cardboard.")) /obj/item/storage/box/matches/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the flavor of spicy cardboard.")) /obj/item/flashlight/glowstick/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You found out the glowy juice only tastes like regret.")) /obj/item/trash/cigbutt/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the flavor of bitter ash. Classy.")) /obj/item/clothing/mask/smokable/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return if(lit) to_chat(user, span_notice("You can taste the flavor of burning ash. Spicy!")) else to_chat(user, span_notice("You can taste the flavor of aromatic rolling paper and funny looks.")) /obj/item/paper/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the dry flavor of bureaucracy.")) /obj/item/dice/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the bitter flavor of cheating.")) /obj/item/roulette_ball/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the bitter flavor of cheating.")) /obj/item/lipstick/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the flavor of couture and style. Toddler at the make-up bag style.")) /obj/item/soap/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the bitter flavor of verbal purification.")) /obj/item/spacecash/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the flavor of wealth and reckless waste.")) /obj/item/storage/wallet/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the flavor of wealth and reckless waste.")) /obj/item/broken_bottle/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the flavor of pain. This can't possibly be healthy for your guts.")) /obj/item/material/shard/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the flavor of pain. This can't possibly be healthy for your guts.")) /obj/item/light/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return if(status == LIGHT_BROKEN) to_chat(user, span_notice("You can taste the flavor of pain. This can't possibly be healthy for your guts.")) else to_chat(user, span_notice("You can taste the flavor of really bad ideas.")) /obj/item/bikehorn/tinytether/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You feel a rush of power swallowing such a large, err, tiny structure.")) /obj/item/mmi/digital/posibrain/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the sweet flavor of digital friendship. Or maybe it is something else.")) /obj/item/aicard/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the sweet flavor of digital friendship. Or maybe it is something else.")) /obj/item/reagent_containers/food/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return if(!reagents?.total_volume) to_chat(user, span_notice("You can taste the flavor of garbage and leftovers. Delicious?")) else to_chat(user, span_notice("You can taste the flavor of gluttonous waste of food.")) /obj/item/clothing/accessory/collar/after_trash_eaten(var/mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the submissiveness in the wearer of [src]!")) diff --git a/modular_chomp/code/game/objects/trash_eating.dm b/modular_chomp/code/game/objects/trash_eating.dm index 2366d7cab7..d10d8d0e2a 100644 --- a/modular_chomp/code/game/objects/trash_eating.dm +++ b/modular_chomp/code/game/objects/trash_eating.dm @@ -1,33 +1,51 @@ -/obj/item/starcaster_news/after_trash_eaten(var/mob/living/user) +/obj/item/starcaster_news/after_trash_eaten(mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the dry flavor of digital garbage, oh wait its just the news.")) -/obj/item/newspaper/after_trash_eaten(var/mob/living/user) +/obj/item/newspaper/after_trash_eaten(mob/living/user) + if(!..(user)) + return to_chat(user, span_notice("You can taste the dry flavor of garbage, oh wait its just the news.")) -/obj/item/cell/after_trash_eaten(var/mob/living/user) +/obj/item/cell/after_trash_eaten(mob/living/user) + if(!..(user)) + return visible_message(span_warning("[user] sates their electric appetite with a [src]!")) to_chat(user, span_notice("You can taste the spicy flavor of electrolytes, yum.")) -/obj/item/walkpod/after_trash_eaten(var/mob/living/user) +/obj/item/walkpod/after_trash_eaten(mob/living/user) + if(!..(user)) + return visible_message(span_warning("[user] sates their musical appetite with a [src]!")) to_chat(user, span_notice("You can taste the jazzy flavor of music.")) -/obj/item/mail/junkmail/after_trash_eaten(var/mob/living/user) +/obj/item/mail/junkmail/after_trash_eaten(mob/living/user) + if(!..(user)) + return visible_message(span_warning("[user] devours the [src]!")) to_chat(user, span_notice("You can taste the flavor of the galactic postal service.")) -/obj/item/gun/energy/sizegun/after_trash_eaten(var/mob/living/user) +/obj/item/gun/energy/sizegun/after_trash_eaten(mob/living/user) + if(!..(user)) + return visible_message(span_warning("[user] devours the [src]!")) to_chat(user, span_notice("You didn't read the warning label, did you?")) -/obj/item/slow_sizegun/after_trash_eaten(var/mob/living/user) +/obj/item/slow_sizegun/after_trash_eaten(mob/living/user) + if(!..(user)) + return visible_message(span_warning("[user] devours the [src]!")) to_chat(user, span_notice("You taste the flavor of sunday driver bluespace.")) -/obj/item/laser_pointer/after_trash_eaten(var/mob/living/user) +/obj/item/laser_pointer/after_trash_eaten(mob/living/user) + if(!..(user)) + return visible_message(span_warning("[user] devours the [src]!")) to_chat(user, span_notice("You taste the flavor of a laser.")) -/obj/item/canvas/after_trash_eaten(var/mob/living/user) +/obj/item/canvas/after_trash_eaten(mob/living/user) + if(!..(user)) + return visible_message(span_warning("[user] devours the [src]!")) to_chat(user, span_notice("You taste the flavor of priceless artwork.")) diff --git a/vorestation.dme b/vorestation.dme index 730174b479..9c147402a0 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -233,6 +233,7 @@ #include "code\__defines\dcs\signals\signals_subsystem.dm" #include "code\__defines\dcs\signals\signals_techweb.dm" #include "code\__defines\dcs\signals\signals_tgui.dm" +#include "code\__defines\dcs\signals\signals_trasheating.dm" #include "code\__defines\dcs\signals\signals_turf.dm" #include "code\__defines\dcs\signals\signals_atom\signals_atom_main.dm" #include "code\__defines\dcs\signals\signals_atom\signals_atom_movable.dm"