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 05:19:31 -05:00
committed by GitHub
parent 4294d54712
commit e88e6eb37e
6 changed files with 138 additions and 94 deletions
+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