From bf4212d24a4b1e9d3d09a4ada088c0f8b14d88bb Mon Sep 17 00:00:00 2001
From: Coolrune206 <71326864+Coolrune206@users.noreply.github.com>
Date: Thu, 19 Jan 2023 02:32:28 +1000
Subject: [PATCH] Soap stops swearing (#20162)
* technically functional
* technically functional
* more logically coded, credit to Contra and Mira
* yes this is more logical
* Sean and Fox reviews
* webeditor heresy
---
code/__HELPERS/traits.dm | 2 ++
code/_globalvars/traits.dm | 1 +
code/game/objects/items/weapons/soap.dm | 8 ++++-
code/modules/mob/living/carbon/human/say.dm | 31 +++++++++++++++++++
.../reagents/chemistry/reagents/food.dm | 14 +++++++++
5 files changed, 55 insertions(+), 1 deletion(-)
diff --git a/code/__HELPERS/traits.dm b/code/__HELPERS/traits.dm
index 26ce02ee6a3..576ac720c4d 100644
--- a/code/__HELPERS/traits.dm
+++ b/code/__HELPERS/traits.dm
@@ -196,8 +196,10 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_REPEATSURGERY "master_surgeon" // Lets you automatically repeat surgeries regardless of tool
#define TRAIT_EDIBLE_BUG "edible_bug" // Lets lizards and other animals that can eat bugs eat ya
#define TRAIT_ELITE_CHALLENGER "elite_challenger"
+#define TRAIT_SOAPY_MOUTH "soapy_mouth"
#define TRAIT_UNREVIVABLE "unrevivable" // Prevents changeling revival
+
//***** ITEM TRAITS *****//
/// Show what machine/door wires do when held.
#define TRAIT_SHOW_WIRE_INFO "show_wire_info"
diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm
index 34afa8c2664..78de11646d1 100644
--- a/code/_globalvars/traits.dm
+++ b/code/_globalvars/traits.dm
@@ -68,6 +68,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_EMOTE_MUTE" = TRAIT_EMOTE_MUTE,
"TRAIT_AI_UNTRACKABLE" = TRAIT_AI_UNTRACKABLE,
"TRAIT_ELITE_CHALLENGER" = TRAIT_ELITE_CHALLENGER,
+ "TRAIT_SOAPY_MOUTH" = TRAIT_SOAPY_MOUTH,
"TRAIT_UNREVIVABLE" = TRAIT_UNREVIVABLE
),
/obj/item = list(
diff --git a/code/game/objects/items/weapons/soap.dm b/code/game/objects/items/weapons/soap.dm
index cfaef04d9ca..3c282fe10ce 100644
--- a/code/game/objects/items/weapons/soap.dm
+++ b/code/game/objects/items/weapons/soap.dm
@@ -22,6 +22,8 @@
/obj/item/soap/afterattack(atom/target, mob/user, proximity)
if(!proximity)
return
+ if(user.zone_selected == "mouth") // cleaning out someone's mouth is a different act
+ return
if(target == user && user.a_intent == INTENT_GRAB && ishuman(target))
var/mob/living/carbon/human/muncher = user
if(muncher && isdrask(muncher))
@@ -33,6 +35,7 @@
times_eaten++
playsound(user.loc, 'sound/items/eatfood.ogg', 50, 0)
user.adjust_nutrition(5)
+ user.reagents.add_reagent("soapreagent", 3)
if(times_eaten < max_bites)
to_chat(user, "You take a bite of [src]. Delicious!")
else
@@ -54,7 +57,10 @@
/obj/item/soap/attack(mob/target as mob, mob/user as mob)
if(target && user && ishuman(target) && ishuman(user) && !target.stat && !user.stat && user.zone_selected == "mouth" )
- user.visible_message("\the [user] washes \the [target]'s mouth out with [name]!")
+ user.visible_message("[user] starts washing [target]'s mouth out with [name]!")
+ if(do_after(user, cleanspeed, target = target))
+ user.visible_message("[user] washes [target]'s mouth out with [name]!")
+ target.reagents.add_reagent("soapreagent", 6)
return
..()
diff --git a/code/modules/mob/living/carbon/human/say.dm b/code/modules/mob/living/carbon/human/say.dm
index 479ca8954be..79fb2341003 100644
--- a/code/modules/mob/living/carbon/human/say.dm
+++ b/code/modules/mob/living/carbon/human/say.dm
@@ -120,6 +120,30 @@
/mob/living/carbon/human/proc/GetSpecialVoice()
return special_voice
+GLOBAL_LIST_INIT(soapy_words, list(
+ "shit" = "shoot",
+ "shitter" = "toilet",
+ "fuck" = "phooey",
+ "fucking" = "flipping",
+ "fucker" = "individual dedicated to the continuation of their species",
+ "motherfucker" = "family time enjoyer",
+ "balls" = "baloney",
+ "whore" = "overly experienced individual",
+ "dumbass" = "sweet, misunderstood person",
+ "ass" = "backside",
+ "bastard" = "individual born out of wedlock",
+ "bitch" = "female dog",
+ "cock" = "chicken",
+ "cunt" = "countryman",
+ "damn" = "beaver-constructed river-blockade",
+ "dick" = "detective",
+ "hell" = "HFIL",
+ "jesus" = "jesús",
+ "pussy" = "pusillanimous",
+ "twat" = "honorable and esteemed individual",
+ "wanker" = "sanguine individual"
+ ))
+
/mob/living/carbon/human/handle_speech_problems(list/message_pieces, verb)
var/span = ""
var/obj/item/organ/internal/cyberimp/brain/speech_translator/translator = locate(/obj/item/organ/internal/cyberimp/brain/speech_translator) in internal_organs
@@ -151,6 +175,10 @@
if(hoers.voicechange)
S.message = pick("NEEIIGGGHHHH!", "NEEEIIIIGHH!", "NEIIIGGHH!", "HAAWWWWW!", "HAAAWWW!")
+ if(HAS_TRAIT(src, TRAIT_SOAPY_MOUTH))
+ var/static/regex/R = regex("\\b([GLOB.soapy_words.Join("|")])\\b", "gi")
+ S.message = R.Replace(S.message, /mob/living/carbon/human/proc/replace_speech)
+
if(dna)
for(var/mutation_type in active_mutations)
var/datum/mutation/mutation = GLOB.dna_mutations[mutation_type]
@@ -175,6 +203,9 @@
return list("verb" = verb)
+/mob/living/carbon/human/proc/replace_speech(matched)
+ return GLOB.soapy_words[lowertext(matched)]
+
/mob/living/carbon/human/handle_message_mode(message_mode, list/message_pieces, verb, used_radios)
switch(message_mode)
if("intercom")
diff --git a/code/modules/reagents/chemistry/reagents/food.dm b/code/modules/reagents/chemistry/reagents/food.dm
index 702f385c837..ebb7c06f9c0 100644
--- a/code/modules/reagents/chemistry/reagents/food.dm
+++ b/code/modules/reagents/chemistry/reagents/food.dm
@@ -908,6 +908,20 @@
if(volume >= 5 && !isspaceturf(T))
new /obj/item/reagent_containers/food/snacks/breadslice(T)
+/datum/reagent/soap
+ name = "Soap"
+ id = "soapreagent"
+ description = "Soap, fit to clean the mouth of a sailor."
+ reagent_state = SOLID
+ color = "#FFFFFF"
+ taste_description = "soap"
+
+/datum/reagent/soap/on_mob_add(mob/living/L)
+ ADD_TRAIT(L, TRAIT_SOAPY_MOUTH, id)
+
+/datum/reagent/soap/on_mob_delete(mob/living/L)
+ REMOVE_TRAIT(L, TRAIT_SOAPY_MOUTH, id)
+
///Vomit///
/datum/reagent/vomit