Unglogs Soap and makes it work similar to how it used to (#17868)

* real

* I forgot to save DMI changes ! epic

* Soap names, afterattack() cleanup and lye, Oh my!

fnnuy

* Better handling of conflicting recipes.

oiter
This commit is contained in:
Reo Lozzot
2025-07-01 03:19:31 -07:00
committed by GitHub
parent 4294d54712
commit e88e6eb37e
6 changed files with 138 additions and 94 deletions
+2
View File
@@ -374,6 +374,8 @@
#define REAGENT_ID_AMMONIA "ammonia"
#define REAGENT_DIETHYLAMINE "Diethylamine"
#define REAGENT_ID_DIETHYLAMINE "diethylamine"
#define REAGENT_LYE "Lye"
#define REAGENT_ID_LYE "lye"
#define REAGENT_FLUOROSURFACTANT "Fluorosurfactant"
#define REAGENT_ID_FLUOROSURFACTANT "fluorosurfactant"
#define REAGENT_FOAMINGAGENT "Foaming agent"
+89 -94
View File
@@ -4,7 +4,7 @@
gender = PLURAL
icon = 'icons/obj/soap.dmi'
icon_state = "soap"
flags = NOCONDUCT
flags = NOCONDUCT | NOBLUDGEON
w_class = ITEMSIZE_SMALL
slot_flags = SLOT_HOLSTER
throwforce = 0
@@ -14,205 +14,200 @@
var/randomize = TRUE
var/square_chance = 10
var/cleanspeed = 35
var/uses = 100
var/bites = 0
/obj/item/soap/Initialize(mapload)
if(randomize && prob(square_chance))
icon_state = "[icon_state]-alt"
create_reagents(5)
wet()
. = ..()
/obj/item/soap/examine(mob/user)
. = ..()
var/max_uses = initial(uses)
var/msg = "It looks like it just came out of the package."
if(uses != max_uses)
var/percentage_left = uses / max_uses
switch(percentage_left)
if(0 to 0.15)
msg = "There's just a tiny bit left of what it used to be, you're not sure it'll last much longer."
if(0.15 to 0.30)
msg = "It's dissolved quite a bit, but there's still some life to it."
if(0.30 to 0.50)
msg = "It's past its prime, but it's definitely still good."
if(0.50 to 0.75)
msg = "It's started to get a little smaller than it used to be, but it'll definitely still last for a while."
else
msg = "It's seen some light use, but it's still pretty fresh."
. += span_notice("[msg]")
/obj/item/soap/proc/wet()
reagents.add_reagent(REAGENT_ID_CLEANER, 5)
/obj/item/soap/proc/wet(var/cleaner = FALSE)
if(cleaner)
reagents.add_reagent(REAGENT_ID_CLEANER, 5)
else
reagents.add_reagent(REAGENT_ID_WATER, 5) //full of wet...
/obj/item/soap/Crossed(atom/movable/AM as mob|obj)
if(AM.is_incorporeal())
return
if(isliving(AM))
var/mob/living/M = AM
M.slip("the [src.name]",3)
M.slip("\the [src.name]",3)
/obj/item/soap/afterattack(atom/target, mob/user as mob, proximity)
. = ..()
if(ishuman(target) && user.zone_sel.selecting == O_MOUTH)
if(target == user)
to_chat(user, span_warning("You raise the soap to your mouth and prepare to take a bite..."))
if(do_after(user, 5)) //Mercy against accidental chomps
user.visible_message(span_notice("[user] takes a bite out of [src]!"), span_notice("You gnaw on [src]! This can't be good for you..."))
var/mob/living/carbon/C = user
playsound(get_turf(C), 'sound/items/eatfood.ogg', 25, 0)
C.ingested.add_reagent(/datum/reagent/toxin, 0.5) //normally formaldehyde, and 2 units of it. Toxin is being subsituted and is 4 times as toxic, hence a quarter of the normal amount.
C.ingested.add_reagent(/datum/reagent/chloralhydrate, 3)
reagents.trans_to_holder(C.ingested, 1)
bites++
if(bites >= 5)
qdel(src)
else
user.visible_message(span_danger("\The [user] washes \the [target]'s mouth out with \the [src]!"))
//Add pieface cleaning here if that ever gets ported.
user.setClickCooldown(DEFAULT_QUICK_COOLDOWN)
return
if(!proximity)
return
//I couldn't feasibly fix the overlay bugs caused by cleaning items we are wearing.
//So this is a workaround. This also makes more sense from an IC standpoint. ~Carn
if(user.client && (target in user.client.screen))
to_chat(user, span_warning("You need to take that [target.name] off before cleaning it."))
to_chat(user, span_warning("You need to take that [target] off before cleaning it."))
else if(istype(target,/obj/effect/decal/cleanable))
user.visible_message("[user] begins to scrub \the [target.name] out with [src].", span_warning("You begin to scrub \the [target.name] out with [src]..."))
user.visible_message("[user] begins to scrub \the [target] out with [src].", span_warning("You begin to scrub \the [target] out with [src]..."))
if(do_after(user, src.cleanspeed, target = target))
to_chat(user, span_notice("You scrub \the [target.name] out."))
to_chat(user, span_notice("You scrub \the [target] out."))
qdel(target)
decreaseUses(user)
else if(istype(target,/turf))
user.visible_message("[user] begins to scrub \the [target.name] out with [src].", span_warning("You begin to scrub \the [target.name] out with [src]..."))
if(do_after(user, src.cleanspeed, target = target))
to_chat(user, span_notice("You scrub \the [target.name] clean."))
var/turf/T = target
T.wash(CLEAN_SCRUB)
reagents.trans_to_turf(T, 1, 10)
decreaseUses(user)
else if(ishuman(target) && user.zone_sel.selecting == O_MOUTH)
if(target == user)
var/mob/living/carbon/human/H = user
to_chat(user, span_notice("You take a bite of \the [src] and swallow it."))
reagents.trans_to_holder(H.ingested, 1)
else
user.visible_message(span_danger("\The [user] washes \the [target]'s mouth out with \the [src]!"))
user.setClickCooldown(DEFAULT_QUICK_COOLDOWN)
decreaseUses(user, 5)
else if(istype(target,/obj/structure/sink))
to_chat(user, span_notice("You wet \the [src] in the sink."))
wet()
else
if(istype(target,/turf))
if(reagents.has_reagent(REAGENT_ID_WATER, 1) || reagents.has_reagent(REAGENT_ID_CLEANER, 1)) //Instant floorcleaning with wetness
user.visible_message("[user] effortlessly scrubs \the [target] out with wet [src]", span_notice("You effortlessly scrub \the [target]"))
var/turf/T = target
T.wash(CLEAN_SCRUB)
reagents.trans_to_turf(T, 1, 10)
return
user.visible_message("[user] begins to scrub \the [target] out with [src].", span_warning("You begin to scrub \the [target] out with [src]..."))
if(do_after(user, src.cleanspeed, target = target))
to_chat(user, span_notice("You scrub \the [target] clean."))
var/turf/T = target
T.wash(CLEAN_SCRUB)
reagents.trans_to_turf(T, 1, 10)
return
user.visible_message("[user] begins to clean \the [target.name] with [src]...", span_notice("You begin to clean \the [target.name] with [src]..."))
if(do_after(user, src.cleanspeed, target = target))
target.wash(CLEAN_SCRUB)
decreaseUses(user)
return
/obj/item/soap/proc/decreaseUses(mob/user, var/used_up = 1)
uses -= used_up
if(uses <= 0)
to_chat(user, span_warning("[src] crumbles into tiny bits!"))
qdel(src)
/obj/item/soap/nanotrasen
name = "Soap (Nanotrasen)"
desc = "A NanoTrasen-brand bar of soap. Smells of phoron, a years-old marketing gimmick."
desc = ""
icon_state = "soapnt"
cleanspeed = 28
uses = 300 // Good soap, good soap
cleanspeed = 28 //janitor gets this
/obj/item/soap/nanotrasen/examine(mob/user)
. = ..()
if(prob(1)) // Mandela effect
. += "A heavy duty bar of Nanotrasen brand soap. Smells of plasma, a years-old marketing gimmick."
else
. += "A heavy duty bar of Nanotrasen brand soap. Smells of phoron, a years-old marketing gimmick."
/obj/item/soap/homemade
desc = "A homemade bar of soap. Smells of... well..."
icon_state = "soapgibs"
cleanspeed = 30 // faster to reward chemists for going to the effort
randomize = FALSE //No square sprite for it.
/obj/item/soap/deluxe
name = "Soap (Deluxe)"
desc = "A deluxe Waffle Co. brand bar of soap. Smells of high-class luxury."
icon_state = "soapdeluxe"
uses = 150 // Good soap
cleanspeed = 20 // But fast too
/obj/item/soap/deluxe/Initialize(mapload)
. = ..()
desc = "A deluxe Waffle Co. brand bar of soap. Smells of [pick("lavender", "vanilla", "strawberry", "chocolate" ,"space")]."
cleanspeed = 20 //captain gets one of these
/obj/item/soap/syndie
name = "Soap (Syndicate)"
desc = "An untrustworthy bar of soap. Smells of fear."
desc = "An untrustworthy bar of soap made of strong chemical agents that dissolve blood faster. Smells of fear."
icon_state = "soapsyndie"
cleanspeed = 5 // Nyoom soap
cleanspeed = 5 //faster than mop so it is useful for traitors who want to clean crime scenes
/obj/item/soap/space_soap
name = "Soap (Space)"
desc = "Smells like hot metal and walnuts."
desc = "A space-like bar of soap. Smells like hot metal and walnuts."
icon_state = "space_soap"
/obj/item/soap/water_soap
name = "Soap (Pool)"
desc = "Smells like chlorine."
desc = "A watery bar of soap. Smells like chlorine."
icon_state = "water_soap"
/obj/item/soap/fire_soap
name = "Soap (Fire)"
desc = "Smells like a campfire."
desc = "A firey bar of soap. Smells like a campfire."
icon_state = "fire_soap"
/obj/item/soap/rainbow_soap
name = "Soap (Rainbow)"
desc = "Smells sickly sweet."
desc = "A rainbow bar of soap. Smells sickly sweet."
icon_state = "rainbow_soap"
/obj/item/soap/diamond_soap
name = "Soap (Diamond)"
desc = "Smells like saffron and vanilla."
desc = "A diamond-like bar of soap. Smells like saffron and vanilla."
icon_state = "diamond_soap"
/obj/item/soap/uranium_soap
name = "Soap (Uranium)"
desc = "Smells not great... Not terrible."
desc = "An irradiated bar of soap. Smells not great... Not terrible."
icon_state = "uranium_soap"
/obj/item/soap/silver_soap
name = "Soap (Silver)"
desc = "Smells like birch and amaranth."
desc = "A silvery bar of soap. Smells like birch and amaranth."
icon_state = "silver_soap"
/obj/item/soap/brown_soap
name = "Soap (Brown)"
desc = "Smells like cinnamon and cognac."
desc = "A brown bar of soap. Smells like cinnamon and cognac."
icon_state = "brown_soap"
/obj/item/soap/white_soap
name = "Soap (Nutty)"
desc = "Smells like nutmeg and oats."
name = "Soap (White)"
desc = "A white bar of soap. Smells like nutmeg and oats."
icon_state = "white_soap"
/obj/item/soap/grey_soap
name = "Soap (Grey)"
desc = "Smells like bergamot and lilies."
desc = "A grey bar of soap. Smells like bergamot and lilies."
icon_state = "grey_soap"
/obj/item/soap/pink_soap
name = "Soap (Gum)"
desc = "Smells like bubblegum."
name = "Soap (Pink)"
desc = "A pink bar of soap. Smells like bubblegum."
icon_state = "pink_soap"
/obj/item/soap/purple_soap
name = "Soap (Lavender)"
desc = "Smells like lavender."
name = "Soap (Purple)"
desc = "A purple bar of soap. Smells like lavender."
icon_state = "purple_soap"
/obj/item/soap/blue_soap
name = "Soap (Blue)"
desc = "Smells like cardamom."
desc = "A blue bar of soap. Smells like cardamom."
icon_state = "blue_soap"
/obj/item/soap/cyan_soap
name = "Soap (Berries)"
desc = "Smells like bluebells and peaches."
name = "Soap (Cyan)"
desc = "A cyan bar of soap. Smells like bluebells and peaches."
icon_state = "cyan_soap"
/obj/item/soap/green_soap
name = "Soap (Grass)"
desc = "Smells like a freshly mowed lawn."
name = "Soap (Green)"
desc = "A green bar of soap. Smells like a freshly mowed lawn."
icon_state = "green_soap"
/obj/item/soap/yellow_soap
name = "Soap (Lemon)"
desc = "Smells like citron and ginger."
name = "Soap (Yellow)"
desc = "A yellow bar of soap. Smells like citron and ginger."
icon_state = "yellow_soap"
/obj/item/soap/orange_soap
name = "Soap (Orange)"
desc = "Smells like oranges and dark chocolate."
desc = "An orange bar of soap. Smells like oranges and dark chocolate."
icon_state = "orange_soap"
/obj/item/soap/red_soap
name = "Soap (Orange)"
desc = "Smells like cherries."
name = "Soap (Red)"
desc = "A red bar of soap. Smells like cherries."
icon_state = "red_soap"
/obj/item/soap/golden_soap
name = "Soap (Honey)"
desc = "Smells like honey."
name = "Soap (Gold)"
desc = "A golden bar of soap. Smells like honey."
icon_state = "golden_soap"
@@ -605,6 +605,12 @@
to_chat(user, span_notice("You wet \the [O] in \the [src]."))
playsound(src, 'sound/effects/slosh.ogg', 25, 1)
return
else if(istype(O, /obj/item/soap))
var/obj/item/soap/soap = O
to_chat(user, span_notice("You wet \the [O] in \the [src]"))
soap.wet()
O.wash(CLEAN_SCRUB)
return
var/turf/location = user.loc
if(!isturf(location)) return
@@ -76,6 +76,7 @@
id = REAGENT_ID_WATER
result = REAGENT_ID_WATER
required_reagents = list(REAGENT_ID_OXYGEN = 1, REAGENT_ID_HYDROGEN = 2)
inhibitors = list(REAGENT_ID_SODIUM = 1) // So it doesnt turn into water when you try to make lye.
result_amount = 1
/decl/chemical_reaction/instant/thermite
@@ -439,6 +440,13 @@
required_reagents = list (REAGENT_ID_AMMONIA = 1, REAGENT_ID_ETHANOL = 1)
result_amount = 2
/decl/chemical_reaction/instant/lye
name = REAGENT_LYE
id = REAGENT_ID_LYE
result = REAGENT_ID_LYE
required_reagents = list(REAGENT_ID_SODIUM = 1, REAGENT_ID_HYDROGEN = 1, REAGENT_ID_OXYGEN = 1)
result_amount = 3
/decl/chemical_reaction/instant/left4zed
name = "Left4Zed"
id = REAGENT_ID_LEFT4ZED
@@ -637,6 +645,31 @@
new /obj/item/stack/material/plastic(get_turf(holder.my_atom), created_volume)
return
/decl/chemical_reaction/instant/soapification
name = "Soapification"
id = "soapification"
result = null
required_reagents = list(REAGENT_ID_COOKINGOIL = 10, REAGENT_ID_LYE = 2)
result_amount = 1
/decl/chemical_reaction/instant/soapification/on_reaction(var/datum/reagents/holder, var/created_volume)
for(var/i = 1, i <= created_volume, i++)
new /obj/item/soap(get_turf(holder.my_atom))
/decl/chemical_reaction/instant/soapification/alt
name = "Soapification2"
id = "soapification2"
required_reagents = list(REAGENT_ID_CORNOIL = 10, REAGENT_ID_LYE = 2)
/decl/chemical_reaction/instant/soapification/gibs // a bit less convinient and grosser, but it makes more potent soap.
name = "Soapification Gibs"
id = "soapificationgibs"
required_reagents = list(REAGENT_ID_PROTEIN = 10, REAGENT_ID_LYE = 10) //Change the protein to liquid gibs if/when those get ported. Thanks.
/decl/chemical_reaction/instant/soapification/gibs/on_reaction(datum/reagents/holder, created_volume)
for(var/i = 1, i <= created_volume, i++)
new /obj/item/soap/homemade(get_turf(holder.my_atom))
/*Carpet Creation*/
/decl/chemical_reaction/instant/carpetify
+8
View File
@@ -390,6 +390,14 @@
reagent_state = LIQUID
color = "#604030"
/datum/reagent/lye
name = REAGENT_LYE
id = REAGENT_ID_LYE
description = "Also known as sodium hydroxide. As a profession making this is somewhat underwhelming."
taste_description = "acid"
reagent_state = LIQUID
color = "#FFFFD6" // very very light yellow"
/datum/reagent/fluorosurfactant // Foam precursor
name = REAGENT_FLUOROSURFACTANT
id = REAGENT_ID_FLUOROSURFACTANT
Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 23 KiB