Files
Paradise/code/game/objects/closets/fireaxe.dm
elly1989@rocketmail.com 48088b79d9 ugh...this was horrible. I'm really sorry if I fucked anything up, I was literally going braindead towards the end.
Replaced every l_hand = and r_hand = and all that if(hand) crap to use standardised procs. This means we can use procs like Dropped() reliably as they will always be called when things are dropped.

Thorough documentation to come. But generally, if you want a mob's icons to update after deleting something in the inventory...use drop_from_inventory(the_thing_you_wanna_drop) just before deleting it. If you wanna put something in a mob's hands use put_in_hands() (or one of the variants). It'll try putting it in active hand first, then inactive, then the floor. They handle layers, overlays, screenlocs calling various procs such as dropped() etc for you. Easy

mob.equipped() is now mob.get_active_hand() because there was another totally unrelated proc named equipped() and stuff was confusing.

Weakening was made instantaneous.

Minor optimisations for human/handle_regular_status_updates(). I'll port these changes over to the other mobs next. Basically it should stop it constantly incrementing every status effect even after death.

umm... bunch of overlays related fixes... I think that's everything. :/

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3900 316c924e-a436-60f5-8080-3fe189b3f50e
2012-06-23 21:24:45 +00:00

198 lines
6.0 KiB
Plaintext

//I still dont think this should be a closet but whatever
/obj/structure/closet/fireaxecabinet
name = "Fire Axe Cabinet"
desc = "There is small label that reads \"For Emergency use only\" along with details for safe use of the axe. As if."
var/obj/item/weapon/twohanded/fireaxe/fireaxe = new/obj/item/weapon/twohanded/fireaxe
icon_state = "fireaxe1000"
icon_closed = "fireaxe1000"
icon_opened = "fireaxe1100"
anchored = 1
density = 0
var/localopened = 0 //Setting this to keep it from behaviouring like a normal closet and obstructing movement in the map. -Agouri
opened = 1
var/hitstaken = 0
var/locked = 1
var/smashed = 0
attackby(var/obj/item/O as obj, var/mob/user as mob) //Marker -Agouri
//..() //That's very useful, Erro
var/hasaxe = 0 //gonna come in handy later~
if(fireaxe)
hasaxe = 1
if (isrobot(usr) || src.locked)
if(istype(O, /obj/item/device/multitool))
user << "\red Resetting circuitry..."
playsound(user, 'lockreset.ogg', 50, 1)
sleep(50) // Sleeping time~
src.locked = 0
user << "\blue You disable the locking modules."
update_icon()
return
else if(istype(O, /obj/item/weapon))
var/obj/item/weapon/W = O
if(src.smashed || src.localopened)
if(localopened)
localopened = 0
icon_state = text("fireaxe[][][][]closing",hasaxe,src.localopened,src.hitstaken,src.smashed)
spawn(10) update_icon()
return
else
playsound(user, 'Glasshit.ogg', 100, 1) //We don't want this playing every time
if(W.force < 15)
user << "\blue The cabinet's protective glass glances off the hit."
else
src.hitstaken++
if(src.hitstaken == 4)
playsound(user, 'Glassbr3.ogg', 100, 1) //Break cabinet, receive goodies. Cabinet's fucked for life after that.
src.smashed = 1
src.locked = 0
src.localopened = 1
update_icon()
return
if (istype(O, /obj/item/weapon/twohanded/fireaxe) && src.localopened)
if(!fireaxe)
if(O:wielded)
user << "\red Unwield the axe first."
return
fireaxe = O
user.drop_item(O)
src.contents += O
user << "\blue You place the fire axe back in the [src.name]."
update_icon()
else
if(src.smashed)
return
else
localopened = !localopened
if(localopened)
icon_state = text("fireaxe[][][][]opening",hasaxe,src.localopened,src.hitstaken,src.smashed)
spawn(10) update_icon()
else
icon_state = text("fireaxe[][][][]closing",hasaxe,src.localopened,src.hitstaken,src.smashed)
spawn(10) update_icon()
else
if(src.smashed)
return
if(istype(O, /obj/item/device/multitool))
if(localopened)
localopened = 0
icon_state = text("fireaxe[][][][]closing",hasaxe,src.localopened,src.hitstaken,src.smashed)
spawn(10) update_icon()
return
else
user << "\red Resetting circuitry..."
sleep(50)
src.locked = 1
user << "\blue You re-enable the locking modules."
playsound(user, 'lockenable.ogg', 50, 1)
return
else
localopened = !localopened
if(localopened)
icon_state = text("fireaxe[][][][]opening",hasaxe,src.localopened,src.hitstaken,src.smashed)
spawn(10) update_icon()
else
icon_state = text("fireaxe[][][][]closing",hasaxe,src.localopened,src.hitstaken,src.smashed)
spawn(10) update_icon()
attack_hand(mob/user as mob)
var/hasaxe = 0
if(fireaxe)
hasaxe = 1
if(src.locked)
user <<"\red The cabinet won't budge!"
return
if(localopened)
if(fireaxe)
user.put_in_hands(fireaxe)
fireaxe = null
user << "\blue You take the fire axe from the [name]."
src.add_fingerprint(user)
update_icon()
else
if(src.smashed)
return
else
localopened = !localopened
if(localopened)
src.icon_state = text("fireaxe[][][][]opening",hasaxe,src.localopened,src.hitstaken,src.smashed)
spawn(10) update_icon()
else
src.icon_state = text("fireaxe[][][][]closing",hasaxe,src.localopened,src.hitstaken,src.smashed)
spawn(10) update_icon()
else
localopened = !localopened //I'm pretty sure we don't need an if(src.smashed) in here. In case I'm wrong and it fucks up teh cabinet, **MARKER**. -Agouri
if(localopened)
src.icon_state = text("fireaxe[][][][]opening",hasaxe,src.localopened,src.hitstaken,src.smashed)
spawn(10) update_icon()
else
src.icon_state = text("fireaxe[][][][]closing",hasaxe,src.localopened,src.hitstaken,src.smashed)
spawn(10) update_icon()
verb/toggle_openness() //nice name, huh? HUH?! -Erro //YEAH -Agouri
set name = "Open/Close"
set category = "Object"
if (isrobot(usr) || src.locked || src.smashed)
if(src.locked)
usr << "\red The cabinet won't budge!"
else if(src.smashed)
usr << "\blue The protective glass is broken!"
return
localopened = !localopened
update_icon()
verb/remove_fire_axe()
set name = "Remove Fire Axe"
set category = "Object"
if (isrobot(usr))
return
if (localopened)
if(fireaxe)
usr.put_in_hands(fireaxe)
fireaxe = null
usr << "\blue You take the Fire axe from the [name]."
else
usr << "\blue The [src.name] is empty."
else
usr << "\blue The [src.name] is closed."
update_icon()
attack_paw(mob/user as mob)
attack_hand(user)
return
attack_ai(mob/user as mob)
if(src.smashed)
user << "\red The security of the cabinet is compromised."
return
else
locked = !locked
if(locked)
user << "\red Cabinet locked."
else
user << "\blue Cabinet unlocked."
return
update_icon() //Template: fireaxe[has fireaxe][is opened][hits taken][is smashed]. If you want the opening or closing animations, add "opening" or "closing" right after the numbers
var/hasaxe = 0
if(fireaxe)
hasaxe = 1
icon_state = text("fireaxe[][][][]",hasaxe,src.localopened,src.hitstaken,src.smashed)
open()
return
close()
return