Merge pull request #399 from Bone-White/master

Rigid suit equip delay rework
This commit is contained in:
ZomgPonies
2014-08-20 03:07:09 -04:00
5 changed files with 75 additions and 17 deletions
+21 -8
View File
@@ -138,14 +138,6 @@
if(hand) return drop_l_hand(Target)
else return drop_r_hand(Target)
//TODO: phase out this proc
/mob/proc/before_take_item(var/obj/item/W) //TODO: what is this?
W.loc = null
@@ -154,6 +146,27 @@
update_icons()
return
/mob/proc/delay_clothing_u_equip(obj/item/clothing/X as obj) // Bone White - delays unequipping by parameter. Requires W to be /obj/item/clothing/
if(!istype(X)) return 0
if(X.equipping == 1) return 0 // Item is already being (un)equipped
var/tempX = usr.x
var/tempY = usr.y
usr << "\blue You start unequipping the [X]."
X.equipping = 1
var/equip_time = round(X.equip_time/10)
var/i
for(i=1; i<=equip_time; i++)
sleep (10) // Check if they've moved every 10 time units
if ((tempX != usr.x) || (tempY != usr.y))
src << "\red \The [X] is too fiddly to unequip whilst moving."
X.equipping = 0
return 0
u_equip(X)
usr << "\blue You have finished unequipping the [X]."
X.equipping = 0
/mob/proc/u_equip(W as obj)
if (W == r_hand)
+36 -2
View File
@@ -105,8 +105,19 @@
/mob/proc/attack_ui(slot)
var/obj/item/W = get_active_hand()
//if(istype(W))
// equip_to_slot_if_possible(W, slot)
if(istype(W))
equip_to_slot_if_possible(W, slot)
if(W:rig_restrict_helmet)
src << "\red You must fasten the helmet to a hardsuit first. (Target the head)" // Stop eva helms equipping.
else
if(W:equip_time > 0)
delay_clothing_equip_to_slot_if_possible(W, slot)
else
equip_to_slot_if_possible(W, slot)
if(ishuman(src) && W == src:head)
src:update_hair()
@@ -117,6 +128,29 @@
return 1
return 0
//This is a SAFE proc. Use this instead of equip_to_splot()!
/mob/proc/delay_clothing_equip_to_slot_if_possible(obj/item/clothing/X as obj, slot, del_on_fail = 0, disable_warning = 0, redraw_mob = 1, delay_time = 0)
if(!istype(X)) return 0
if(X.equipping == 1) return 0 // Item is already being equipped
var/tempX = usr.x
var/tempY = usr.y
usr << "\blue You start equipping the [X]."
X.equipping = 1
var/equip_time = round(X.equip_time/10)
var/i
for(i=1; i<=equip_time; i++)
sleep (10) // Check if they've moved every 10 time units
if ((tempX != usr.x) || (tempY != usr.y))
src << "\red \The [X] is too fiddly to fasten whilst moving."
X.equipping = 0
return 0
equip_to_slot_if_possible(X, slot)
usr << "\blue You have finished equipping the [X]."
X.equipping = 0
//This is a SAFE proc. Use this instead of equip_to_splot()!
//set del_on_fail to have it delete W if it fails to equip
//set disable_warning to disable the 'you are unable to equip that' warning.
@@ -1301,4 +1335,4 @@ mob/proc/yank_out_object()
/mob/living/proc/handle_paralysed() // Currently only used by simple_animal.dm, treated as a special case in other mobs
if(paralysis)
AdjustParalysis(-1)
return paralysis
return paralysis