mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-01-05 23:13:06 +00:00
Fixes crossbow icon issue
Fixes an issue with the crossbow icon that occurred when releasing the tension soon after starting to draw it back.
This commit is contained in:
@@ -74,8 +74,8 @@
|
||||
|
||||
/obj/item/weapon/gun/launcher/crossbow/handle_post_fire(mob/user, atom/target)
|
||||
bolt = null
|
||||
icon_state = "crossbow"
|
||||
tension = 0
|
||||
update_icon()
|
||||
..()
|
||||
|
||||
/obj/item/weapon/gun/launcher/crossbow/attack_self(mob/living/user as mob)
|
||||
@@ -89,7 +89,7 @@
|
||||
else
|
||||
user.visible_message("[user] relaxes the tension on [src]'s string.","You relax the tension on [src]'s string.")
|
||||
tension = 0
|
||||
icon_state = "crossbow"
|
||||
update_icon()
|
||||
else
|
||||
draw(user)
|
||||
|
||||
@@ -106,15 +106,19 @@
|
||||
user.visible_message("[user] begins to draw back the string of [src].","<span class='notice'>You begin to draw back the string of [src].</span>")
|
||||
tension = 1
|
||||
|
||||
while(bolt && tension && current_user == user)
|
||||
while(bolt && tension && loc == current_user)
|
||||
if(!do_after(user, 25)) //crossbow strings don't just magically pull back on their own.
|
||||
user.visible_message("[usr] stops drawing and relaxes the string of [src].","<span class='warning'>You stop drawing back and relax the string of [src].</span>")
|
||||
tension = 0
|
||||
icon_state = "crossbow"
|
||||
update_icon()
|
||||
return
|
||||
|
||||
//double check that the user hasn't removed the bolt in the meantime
|
||||
if(!(bolt && tension && loc == current_user))
|
||||
return
|
||||
|
||||
tension++
|
||||
icon_state = "crossbow-drawn"
|
||||
update_icon()
|
||||
|
||||
if(tension >= max_tension)
|
||||
tension = max_tension
|
||||
@@ -132,11 +136,10 @@
|
||||
/obj/item/weapon/gun/launcher/crossbow/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(!bolt)
|
||||
if (istype(W,/obj/item/weapon/arrow))
|
||||
user.drop_item()
|
||||
user.drop_from_inventory(W, src)
|
||||
bolt = W
|
||||
bolt.loc = src
|
||||
user.visible_message("[user] slides [bolt] into [src].","You slide [bolt] into [src].")
|
||||
icon_state = "crossbow-nocked"
|
||||
update_icon()
|
||||
return
|
||||
else if(istype(W,/obj/item/stack/rods))
|
||||
var/obj/item/stack/rods/R = W
|
||||
@@ -144,7 +147,7 @@
|
||||
bolt = new /obj/item/weapon/arrow/rod(src)
|
||||
bolt.fingerprintslast = src.fingerprintslast
|
||||
bolt.loc = src
|
||||
icon_state = "crossbow-nocked"
|
||||
update_icon()
|
||||
user.visible_message("[user] jams [bolt] into [src].","You jam [bolt] into [src].")
|
||||
superheat_rod(user)
|
||||
return
|
||||
@@ -182,6 +185,14 @@
|
||||
bolt.icon_state = "metal-rod-superheated"
|
||||
cell.use(500)
|
||||
|
||||
/obj/item/weapon/gun/launcher/crossbow/update_icon()
|
||||
if(tension > 1)
|
||||
icon_state = "crossbow-drawn"
|
||||
else if(bolt)
|
||||
icon_state = "crossbow-nocked"
|
||||
else
|
||||
icon_state = "crossbow"
|
||||
|
||||
|
||||
// Crossbow construction.
|
||||
/obj/item/weapon/crossbowframe
|
||||
|
||||
@@ -46,13 +46,7 @@
|
||||
user << "You twist the valve and pop the tank out of [src]."
|
||||
user.put_in_hands(tank)
|
||||
tank = null
|
||||
|
||||
icon_state = "pneumatic"
|
||||
item_state = "pneumatic"
|
||||
if (ismob(src.loc))
|
||||
var/mob/M = src.loc
|
||||
M.update_inv_r_hand()
|
||||
M.update_inv_l_hand()
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/gun/launcher/pneumatic/proc/unload_hopper(mob/user)
|
||||
if(item_storage.contents.len > 0)
|
||||
@@ -74,9 +68,7 @@
|
||||
user.drop_from_inventory(W, src)
|
||||
tank = W
|
||||
user.visible_message("[user] jams [W] into [src]'s valve and twists it closed.","You jam [W] into [src]'s valve and twist it closed.")
|
||||
icon_state = "pneumatic-tank"
|
||||
item_state = "pneumatic-tank"
|
||||
user.update_icons()
|
||||
update_icon()
|
||||
else if(istype(W) && item_storage.can_be_inserted(W))
|
||||
item_storage.handle_item_insertion(W)
|
||||
|
||||
@@ -131,6 +123,19 @@
|
||||
if(T) T.assume_air(removed)
|
||||
..()
|
||||
|
||||
/obj/item/weapon/gun/launcher/pneumatic/update_icon()
|
||||
if(tank)
|
||||
icon_state = "pneumatic-tank"
|
||||
item_state = "pneumatic-tank"
|
||||
else
|
||||
icon_state = "pneumatic"
|
||||
item_state = "pneumatic"
|
||||
|
||||
if (ismob(src.loc))
|
||||
var/mob/M = src.loc
|
||||
M.update_inv_r_hand()
|
||||
M.update_inv_l_hand()
|
||||
|
||||
//Constructable pneumatic cannon.
|
||||
|
||||
/obj/item/weapon/cannonframe
|
||||
|
||||
Reference in New Issue
Block a user