mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
Fixes a possible dupe bug with looming (#76059)
## About The Pull Request Title. Adds a second amount check to once the do_after() is done to prevent a possible epic dupe minecraft pay to win server lag machine server crash glitch. ## Why It's Good For The Game Bugs are bad ## Changelog 🆑 fix: You can no longer make extra cloth when looming cotton by spamming do afters. /🆑
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
/// How much of item do we need to loom, will be ignored if item isnt a stack
|
||||
var/required_amount
|
||||
/// What thing we look for triggering the loom process (usually a loom)
|
||||
var/obj/target_type
|
||||
var/atom/loom_type
|
||||
/// What verb best fits the action of processing whatever the item is, for example "spun [thing]"
|
||||
var/process_completion_verb
|
||||
/// If the target needs to be anchored
|
||||
@@ -19,7 +19,7 @@
|
||||
obj/item/target,
|
||||
resulting_atom = /obj/item/stack/sheet/cloth,
|
||||
required_amount = 4,
|
||||
target_type = /obj/structure/loom,
|
||||
loom_type = /obj/structure/loom,
|
||||
process_completion_verb = "spun",
|
||||
target_needs_anchoring = TRUE,
|
||||
loom_time = 1 SECONDS
|
||||
@@ -30,7 +30,7 @@
|
||||
return ELEMENT_INCOMPATIBLE
|
||||
src.resulting_atom = resulting_atom
|
||||
src.required_amount = required_amount
|
||||
src.target_type = target_type
|
||||
src.loom_type = loom_type
|
||||
src.process_completion_verb = process_completion_verb
|
||||
src.target_needs_anchoring = target_needs_anchoring
|
||||
src.loom_time = loom_time
|
||||
@@ -45,13 +45,13 @@
|
||||
/datum/element/loomable/proc/on_examine(obj/item/source, mob/examiner, list/examine_list)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
examine_list += span_notice("You could probably process [source] at a <b>[initial(target_type.name)]</b>.")
|
||||
examine_list += span_notice("You could probably process [source] at \a <b>[initial(loom_type.name)]</b>.")
|
||||
|
||||
/// Checks if the thing we clicked on can be used as a loom, and if we can actually loom the source at present (an example being does the stack have enough in it (if its a stack))
|
||||
/datum/element/loomable/proc/try_and_loom_me(obj/item/source, atom/target, mob/living/user)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(!istype(target, target_type))
|
||||
if(!istype(target, loom_type))
|
||||
return
|
||||
|
||||
if(ismovable(target))
|
||||
@@ -72,12 +72,22 @@
|
||||
/// If a do_after of the specified loom_time passes, will create a new one of resulting_atom and either delete the item, or .use the required amount if its a stack
|
||||
/datum/element/loomable/proc/loom_me(obj/item/source, mob/living/user, atom/target)
|
||||
if(!do_after(user, loom_time, target))
|
||||
user.balloon_alert(user, "interrupted!")
|
||||
return
|
||||
|
||||
///we need to perform another check in case a stack somehow got diminished in the middle of the do_after
|
||||
var/successful = TRUE
|
||||
if(isstack(source))
|
||||
var/obj/item/stack/stack_we_use = source
|
||||
if(!stack_we_use.use(required_amount))
|
||||
successful = FALSE
|
||||
else
|
||||
qdel(source)
|
||||
|
||||
//ripbozo
|
||||
if(!successful)
|
||||
user.balloon_alert(user, "need [required_amount] of [source]!")
|
||||
return
|
||||
|
||||
var/new_thing = new resulting_atom(target.drop_location())
|
||||
user.balloon_alert_to_viewers("[process_completion_verb] [new_thing]")
|
||||
if(isstack(source))
|
||||
var/obj/item/stack/stack_we_use = source
|
||||
stack_we_use.use(required_amount)
|
||||
else
|
||||
qdel(source)
|
||||
|
||||
Reference in New Issue
Block a user