diff --git a/code/datums/helper_datums/construction_datum.dm b/code/datums/helper_datums/construction_datum.dm index 2b99f79a1aa..66fb618c690 100644 --- a/code/datums/helper_datums/construction_datum.dm +++ b/code/datums/helper_datums/construction_datum.dm @@ -14,6 +14,9 @@ #define Co_NEXTSTEP "nextstep" #define Co_BACKSTEP "backstep" +#define Co_CON_SPEED "construct" //For tools. See tools.dm +#define Co_DECON_SPEED "deconstruct" //For tools. See tools.dm + /datum/construction var/list/steps var/atom/holder @@ -130,13 +133,17 @@ return /datum/construction/proc/try_consume(mob/user as mob, atom/movable/used_atom, given_step) + if(!used_atom.construction_delay_mult[Co_CON_SPEED]) + user << "This tool only works for deconstruction!" //It doesn't technically have to be a tool to cause this message, but it wouldn't make sense for anything else to do so. + return 0 + if(!(Co_AMOUNT in given_step) && !(Co_DELAY in given_step)) return 1 var/delay = 0 if(Co_DELAY in given_step) - delay = given_step[Co_DELAY] + delay = given_step[Co_DELAY] * used_atom.construction_delay_mult[Co_CON_SPEED] if(delay > 0) start_construct_message(given_step, user, used_atom) if(!do_after(user, delay, needhand = 1)) @@ -282,6 +289,9 @@ /datum/construction/reversible/try_consume(mob/user as mob, atom/movable/used_atom, given_step, index, diff) //if we've made some progress on a step, we want to drop it var/current_step = (diff == BACKWARD ? get_forward_step(index) : get_backward_step(index)) + if(!used_atom.construction_delay_mult[diff == FORWARD ? Co_CON_SPEED : Co_DECON_SPEED]) + user << "This tool only works for [diff == FORWARD ? "de" : ""]construction!" //It doesn't technically have to be a tool to cause this message, but it wouldn't make sense for anything else to do so. + return 0 if(current_step && (Co_AMOUNT in current_step) && (Co_MAX_AMOUNT in current_step) && (current_step[Co_AMOUNT] < current_step[Co_MAX_AMOUNT])) var/obj/item/stack/S if(used_atoms["[index][diff == FORWARD ? "+" : "-"]"]) @@ -301,7 +311,7 @@ var/delay = 0 if(Co_DELAY in given_step) - delay = given_step[Co_DELAY] + delay = given_step[Co_DELAY] * used_atom.construction_delay_mult[diff == FORWARD ? Co_CON_SPEED : Co_DECON_SPEED] if(delay > 0) start_construct_message(given_step, user, used_atom) if(!do_after(user, delay, needhand = 1)) diff --git a/code/game/objects/items/weapons/tools.dm b/code/game/objects/items/weapons/tools.dm index 37300587d6b..2178b18fc0e 100644 --- a/code/game/objects/items/weapons/tools.dm +++ b/code/game/objects/items/weapons/tools.dm @@ -12,6 +12,18 @@ * Revolver Conversion Kit(made sense) */ +/* Used for fancy tool subtypes that are faster or slower than the standard tool. + * The value for the key "construct" (or Co_CON_SPEED) is the multiplier for construction delay. + * The value for the key "deconstruct" (or Co_DECON_SPEED) is the multiplier for deconstruction delay, in case you hadn't guessed. + * If one is zero, the tool cannot be used in that direction. If you want to adminbus an instant tool, use .0001 or something, not 0. + * Don't set either to a negative number. It will probably break, though I'm not really sure in what way. + * Since this is a variable of /atom, it can technically be applied to any item used in construction, as long as the construction is based on construction datums. + * Yes, this allows for hyperspeed building stacks, but I wouldn't recommend that, as it doesn't carry over too well when stacks are merged or separated. + * Might work for borg stack modules, though. Worth looking into. + */ +/atom + var/list/construction_delay_mult = list(Co_CON_SPEED = 1, Co_DECON_SPEED = 1) + /* * Wrench */ @@ -486,7 +498,7 @@ /obj/item/weapon/weldingtool/experimental/proc/fuel_gen()//Proc to make the experimental welder generate fuel, optimized as fuck -Sieve - var/gen_amount = ((world.time-last_gen)/25) + var/gen_amount = ((world.time-last_gen)/25) //Too bad it's not actually implemented reagents += (gen_amount) if(reagents > max_fuel) reagents = max_fuel