Files
Paradise/code/game/objects/items/weapons/twohanded.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

107 lines
3.3 KiB
Plaintext

/*##################################################################
##################### TWO HANDED WEAPONS BE HERE~ -Agouri :3 ########
####################################################################*/
//Rewrote TwoHanded weapons stuff and put it all here. Just copypasta fireaxe to make new ones ~Carn
//This rewrite means we don't have two variables for EVERY item which are used only by a few weapons.
//It also tidies stuff up elsewhere.
/obj/item/weapon/twohanded
var/wielded = 0
var/force_unwielded = 0
var/force_wielded = 0
/obj/item/weapon/twohanded/proc/unwield()
wielded = 0
force = force_unwielded
name = "[initial(name)]"
update_icon()
/obj/item/weapon/twohanded/proc/wield()
wielded = 1
force = force_wielded
name = "[initial(name)] (Wielded)"
update_icon()
/obj/item/weapon/twohanded/dropped(mob/user as mob)
//handles unwielding a twohanded weapon when dropped as well as clearing up the offhand
if(user)
var/obj/item/weapon/twohanded/O = user.get_inactive_hand()
if(istype(O))
O.unwield()
return unwield()
/obj/item/weapon/twohanded/update_icon()
return
/obj/item/weapon/twohanded/pickup(mob/user)
unwield()
/obj/item/weapon/twohanded/attack_self(mob/user as mob)
if( istype(user,/mob/living/carbon/monkey) )
user << "<span class='warning'>It's too heavy for you to wield fully.</span>"
return
..()
if(wielded) //Trying to unwield it
unwield()
user << "<span class='notice'>You are now carrying the [name] with one hand.</span>"
var/obj/item/weapon/twohanded/offhand/O = user.get_inactive_hand()
if(O && istype(O))
O.unwield()
return
else //Trying to wield it
if(user.get_inactive_hand())
user << "<span class='warning'>You need your other hand to be empty</span>"
return
wield()
user << "<span class='notice'>You grab the [initial(name)] with both hands.</span>"
var/obj/item/weapon/twohanded/offhand/O = new(user) ////Let's reserve his other hand~
O.name = "[initial(name)] - offhand"
O.desc = "Your second grip on the [initial(name)]"
user.put_in_inactive_hand(O)
return
///////////OFFHAND///////////////
/obj/item/weapon/twohanded/offhand
w_class = 5.0
icon_state = "offhand"
name = "offhand"
unwield()
del(src)
wield()
del(src)
////////////FIREAXE!//////////////
/obj/item/weapon/twohanded/fireaxe // DEM AXES MAN, marker -Agouri
icon_state = "fireaxe0"
name = "fire axe"
desc = "Truly, the weapon of a madman. Who would think to fight fire with an axe?"
force = 5
w_class = 4.0
slot_flags = SLOT_BACK
force_unwielded = 5
force_wielded = 18
/obj/item/weapon/twohanded/fireaxe/update_icon() //Currently only here to fuck with the on-mob icons.
icon_state = "fireaxe[wielded]"
return
/obj/item/weapon/twohanded/fireaxe/afterattack(atom/A as mob|obj|turf|area, mob/user as mob)
..()
if(A && wielded && (istype(A,/obj/structure/window) || istype(A,/obj/structure/grille))) //destroys windows and grilles in one hit
if(istype(A,/obj/structure/window)) //should just make a window.Break() proc but couldn't bother with it
var/obj/structure/window/W = A
new /obj/item/weapon/shard( W.loc )
if(W.reinf) new /obj/item/stack/rods( W.loc)
if (W.dir == SOUTHWEST)
new /obj/item/weapon/shard( W.loc )
if(W.reinf) new /obj/item/stack/rods( W.loc)
del(A)