Put in tigers code

This commit is contained in:
joep van der velden
2018-10-31 19:20:48 +01:00
parent f03aea80f5
commit f9a9b09616
2 changed files with 31 additions and 18 deletions
+21
View File
@@ -372,6 +372,27 @@ This is always put in the attack log.
if(progress)
qdel(progbar)
#define DOAFTERONCE_MAGIC "Magic~~"
GLOBAL_LIST_INIT(do_after_once_tracker, list())
/proc/do_after_once(mob/user, delay, needhand = 1, atom/target = null, progress = 1, attempt_cancel_message = "Attempt cancelled.")
if(!user || !target)
return
var/cache_key = "[user.UID()][target.UID()]"
if(GLOB.do_after_once_tracker[cache_key])
GLOB.do_after_once_tracker[cache_key] = DOAFTERONCE_MAGIC
to_chat(user, "<span class='warning'>[attempt_cancel_message]</span>")
return FALSE
GLOB.do_after_once_tracker[cache_key] = TRUE
. = do_after(user, delay, needhand, target, progress, extra_checks = CALLBACK(GLOBAL_PROC, .proc/do_after_once_checks, cache_key))
GLOB.do_after_once_tracker[cache_key] = FALSE
/proc/do_after_once_checks(cache_key)
if(GLOB.do_after_once_tracker[cache_key] && GLOB.do_after_once_tracker[cache_key] == DOAFTERONCE_MAGIC)
GLOB.do_after_once_tracker[cache_key] = FALSE
return FALSE
return TRUE
/proc/is_species(A, species_datum)
. = FALSE
if(ishuman(A))
+10 -18
View File
@@ -43,8 +43,6 @@
var/lights_power = 6
var/emagged = FALSE
var/list/repairers = new
//inner atmos
var/use_internal_tank = 0
var/internal_tank_valve = ONE_ATMOSPHERE
@@ -778,22 +776,16 @@
else if(iswelder(W) && user.a_intent != INTENT_HARM)
var/obj/item/weldingtool/WT = W
if(health<initial(health))
if (WT.remove_fuel(0,user))
if(!(user in repairers)) // Can only repair it once at a time
repairers += user
user.visible_message("<span class='notice'>[user] starts repairing some damage to [name].</span>", "<span class='notice'>You start repairing some damage to [name]</span>")
playsound(user, WT.usesound, 50, 1)
if(do_after(user, 15 * WT.toolspeed, target = src)) // Takes 1.5 seconds to repair
if (internal_damage & MECHA_INT_TANK_BREACH)
clearInternalDamage(MECHA_INT_TANK_BREACH)
user.visible_message("<span class='notice'>[user] repairs the damaged gas tank.</span>", "<span class='notice'>You repair the damaged gas tank.</span>")
else
user.visible_message("<span class='notice'>[user] repairs some damage to [name].</span>", "<span class='notice'>You repair some damage to [name]</span>")
health += min(20, initial(health)-health)
repairers -= user
else
to_chat(user, "<span class='warning'>You are already repairing [name]!</span>")
if(health < initial(health))
if(WT.remove_fuel(0,user))
user.visible_message("<span class='notice'>[user] starts repairing some damage to [name].</span>", "<span class='notice'>You start repairing some damage to [name]</span>")
if(do_after_once(user, 15 * WT.toolspeed, target = src, attempt_cancel_message = "You stop repairing [name]."))
if(internal_damage & MECHA_INT_TANK_BREACH)
clearInternalDamage(MECHA_INT_TANK_BREACH)
user.visible_message("<span class='notice'>[user] repairs the damaged gas tank.</span>", "<span class='notice'>You repair the damaged gas tank.</span>")
else
user.visible_message("<span class='notice'>[user] repairs some damage to [name].</span>", "<span class='notice'>You repair some damage to [name].</span>")
health += min(20, initial(health) - health)
else
to_chat(user, "<span class='warning'>The welder must be on for this task!</span>")
else