Files
Bubberstation/code/game/objects/structures/loom.dm
John Willard 2db00c7dc5 standardizes default unfasten wrench (#65425)
I'll do more in the future but I'll limit myself to this because I'm tired, bored, and don't want to make so many PRs touching the same things that I have to deal with conflicts each time one is merged.
Just as an example, screwdriver's gotta be done as well, does the exact same thing wrenches do, I believe.
Standardizes (and touches) each time default_unfasten_wrench is used.

Fixes tool logs, since it relies on tool acts to exist, I'm trying to move as many tool acts to its proper proc. Like a spiritual successor to the tool superpack PRs.

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
2022-04-04 12:44:14 -07:00

51 lines
1.7 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/Initialize(mapload)
. = ..()
var/static/list/hovering_item_typechecks = list(
/obj/item/stack/sheet/cotton = list(
SCREENTIP_CONTEXT_LMB = "Weave",
),
)
AddElement(/datum/element/contextual_screentip_item_typechecks, hovering_item_typechecks)
/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/tool)
. = ..()
default_unfasten_wrench(user, tool, time = 0.5 SECONDS)
return TOOL_ACT_TOOLTYPE_SUCCESS
///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_notice("The loom needs to be wrenched down."), MSG_VISUAL)
return FALSE
if(W.amount < FABRIC_PER_SHEET)
user.show_message(span_notice("You need at least [FABRIC_PER_SHEET] units of fabric before using this."), MSG_VISUAL)
return FALSE
user.show_message(span_notice("You start weaving \the [W.name] through the loom.."), 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_notice("You weave \the [W.name] into a workable fabric."), MSG_VISUAL)
return TRUE
#undef FABRIC_PER_SHEET