Files
Bubberstation/code/game/objects/structures/loom.dm
SkyratBot 3a0491d3b4 [MIRROR] Small do-after refactor (#2074)
* Small do-after refactor (#55172)

This is an alternative to the PR Ryll made, it does some things similar e.g. the default limit of 1 interaction per target for a person, however, it refactors do_afters to support overrides for max interaction counts and unique sources.

For example, stripping uses the item being stripped as the source, allowing you to strip multiple items, but not the same item multiple times.

I've also fixed most other edge-cases this could cause where balance would be affected, but feel free to point out any I might've missed, this'll probably require some longer-term testmerging.

* Small do-after refactor

Co-authored-by: Qustinnus <Floydje123@hotmail.com>
2020-12-07 22:46:59 +01:00

40 lines
1.4 KiB
Plaintext

#define FABRIC_PER_SHEET 4
///This is a loom. It's usually made out of wood and used to weave fabric like durathread or cotton into their respective cloth types.
/obj/structure/loom
name = "loom"
desc = "A simple device used to weave cloth and other thread-based fabrics together into usable material."
icon = 'icons/obj/hydroponics/equipment.dmi'
icon_state = "loom"
density = TRUE
anchored = TRUE
/obj/structure/loom/attackby(obj/item/I, mob/user)
if(weave(I, user))
return
return ..()
/obj/structure/loom/wrench_act(mob/living/user, obj/item/I)
..()
default_unfasten_wrench(user, I, 5)
return TRUE
///Handles the weaving.
/obj/structure/loom/proc/weave(obj/item/stack/sheet/cotton/W, mob/user)
if(!istype(W))
return FALSE
if(!anchored)
user.show_message("<span class='notice'>The loom needs to be wrenched down.</span>", MSG_VISUAL)
return FALSE
if(W.amount < FABRIC_PER_SHEET)
user.show_message("<span class='notice'>You need at least [FABRIC_PER_SHEET] units of fabric before using this.</span>", MSG_VISUAL)
return FALSE
user.show_message("<span class='notice'>You start weaving \the [W.name] through the loom..</span>", MSG_VISUAL)
while(W.use_tool(src, user, W.pull_effort) && W.use(FABRIC_PER_SHEET))
new W.loom_result(drop_location())
user.show_message("<span class='notice'>You weave \the [W.name] into a workable fabric.</span>", MSG_VISUAL)
return TRUE
#undef FABRIC_PER_SHEET