mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-23 20:17:15 +01:00
Converted two-handed weapons to use the same wielding mechanic as guns.
This commit is contained in:
@@ -27,17 +27,19 @@
|
||||
var/base_name
|
||||
var/unwielded_force_divisor = 0.25
|
||||
|
||||
/obj/item/weapon/material/twohanded/proc/unwield()
|
||||
wielded = 0
|
||||
force = force_unwielded
|
||||
name = "[base_name]"
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/material/twohanded/proc/wield()
|
||||
wielded = 1
|
||||
force = force_wielded
|
||||
name = "[base_name] (Wielded)"
|
||||
/obj/item/weapon/material/twohanded/update_held_icon()
|
||||
var/mob/living/M = loc
|
||||
if(istype(M) && !issmall(M) && ((M.r_hand == src && !M.l_hand) || (M.l_hand == src && !M.r_hand)))
|
||||
wielded = 1
|
||||
force = force_wielded
|
||||
name = "[base_name] (Wielded)"
|
||||
update_icon()
|
||||
else
|
||||
wielded = 0
|
||||
force = force_unwielded
|
||||
name = "[base_name]"
|
||||
update_icon()
|
||||
..()
|
||||
|
||||
/obj/item/weapon/material/twohanded/update_force()
|
||||
base_name = name
|
||||
@@ -55,22 +57,6 @@
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/material/twohanded/mob_can_equip(M as mob, slot)
|
||||
//Cannot equip wielded items.
|
||||
if(wielded)
|
||||
M << "<span class='warning'>Unwield the [base_name] first!</span>"
|
||||
return 0
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/item/weapon/material/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/material/twohanded/O = user.get_inactive_hand()
|
||||
if(istype(O))
|
||||
O.unwield()
|
||||
return unwield()
|
||||
|
||||
//Allow a small chance of parrying melee attacks when wielded - maybe generalize this to other weapons someday
|
||||
/obj/item/weapon/material/twohanded/handle_shield(mob/user, var/damage, atom/damage_source = null, mob/attacker = null, var/def_zone = null, var/attack_text = "the attack")
|
||||
if(wielded && default_parry_check(user, attacker, damage_source) && prob(15))
|
||||
@@ -83,68 +69,6 @@
|
||||
icon_state = "[base_icon][wielded]"
|
||||
item_state = icon_state
|
||||
|
||||
/obj/item/weapon/material/twohanded/pickup(mob/user)
|
||||
unwield()
|
||||
|
||||
/obj/item/weapon/material/twohanded/attack_self(mob/user as mob)
|
||||
|
||||
..()
|
||||
|
||||
if(istype(user, /mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(issmall(H))
|
||||
user << "<span class='warning'>It's too heavy for you to wield fully.</span>"
|
||||
return
|
||||
else
|
||||
return
|
||||
|
||||
if(wielded) //Trying to unwield it
|
||||
unwield()
|
||||
user << "<span class='notice'>You are now carrying the [name] with one hand.</span>"
|
||||
if (src.unwieldsound)
|
||||
playsound(src.loc, unwieldsound, 50, 1)
|
||||
|
||||
var/obj/item/weapon/material/twohanded/offhand/O = user.get_inactive_hand()
|
||||
if(O && istype(O))
|
||||
O.unwield()
|
||||
|
||||
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 [base_name] with both hands.</span>"
|
||||
if (src.wieldsound)
|
||||
playsound(src.loc, wieldsound, 50, 1)
|
||||
|
||||
var/obj/item/weapon/material/twohanded/offhand/O = new(user) ////Let's reserve his other hand~
|
||||
O.name = "[base_name] - offhand"
|
||||
O.desc = "Your second grip on the [base_name]."
|
||||
user.put_in_inactive_hand(O)
|
||||
|
||||
if(istype(user,/mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = user
|
||||
H.update_inv_l_hand()
|
||||
H.update_inv_r_hand()
|
||||
|
||||
return
|
||||
|
||||
///////////OFFHAND///////////////
|
||||
/obj/item/weapon/material/twohanded/offhand
|
||||
w_class = 5
|
||||
icon_state = "offhand"
|
||||
name = "offhand"
|
||||
default_material = "placeholder"
|
||||
|
||||
/obj/item/weapon/material/twohanded/offhand/unwield()
|
||||
qdel(src)
|
||||
|
||||
/obj/item/weapon/material/twohanded/offhand/wield()
|
||||
qdel(src)
|
||||
|
||||
/obj/item/weapon/material/twohanded/offhand/update_icon()
|
||||
return
|
||||
|
||||
/*
|
||||
* Fireaxe
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user