Classic Baton Refactor

This commit is contained in:
Fox-McCloud
2015-06-05 18:01:50 -04:00
parent f65d374d1c
commit e4cbc5619e
13 changed files with 58 additions and 112 deletions
@@ -149,7 +149,7 @@
"/obj/item/weapon/melee/classic_baton",
"/obj/item/device/flashlight/seclite",
"/obj/item/taperoll/police",
"/obj/item/weapon/melee/telebaton"
"/obj/item/weapon/melee/classic_baton/telescopic"
)
/obj/item/weapon/storage/belt/security/sec/New()
@@ -161,7 +161,7 @@
new /obj/item/weapon/kitchenknife/combat(src)
new /obj/item/weapon/melee/baton/loaded(src)
new /obj/item/device/flash(src)
new /obj/item/weapon/melee/telebaton(src)
new /obj/item/weapon/melee/classic_baton/telescopic(src)
new /obj/item/weapon/grenade/flashbang(src)
/obj/item/weapon/storage/belt/soulstone
@@ -92,9 +92,11 @@
user.update_inv_l_hand(0)
else
user << "<span class='warning'>It's already fabulous!</span>"
/*
* Classic Baton
*/
/obj/item/weapon/melee/classic_baton
name = "police baton"
desc = "A wooden truncheon for beating criminal scum."
@@ -102,102 +104,12 @@
icon_state = "baton"
item_state = "classic_baton"
slot_flags = SLOT_BELT
force = 10
/obj/item/weapon/melee/classic_baton/attack(mob/M as mob, mob/living/user as mob)
if ((CLUMSY in user.mutations) && prob(50))
user << "\red You club yourself over the head."
user.Weaken(3 * force)
if(ishuman(user))
var/mob/living/carbon/human/H = user
H.apply_damage(2*force, BRUTE, "head")
else
user.take_organ_damage(2*force)
return
/*this is already called in ..()
src.add_fingerprint(user)
M.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been attacked with [src.name] by [user.name] ([user.ckey])</font>")
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Used the [src.name] to attack [M.name] ([M.ckey])</font>")
log_attack("<font color='red'>[user.name] ([user.ckey]) attacked [M.name] ([M.ckey]) with [src.name] (INTENT: [uppertext(user.a_intent)])</font>")
*/
if (user.a_intent == "harm")
if(!..()) return
playsound(get_turf(src), "swing_hit", 50, 1, -1)
if (M.stuttering < 8 && (!(HULK in M.mutations)) /*&& (!istype(H:wear_suit, /obj/item/clothing/suit/judgerobe))*/)
M.stuttering = 8
M.Weaken(3)
for(var/mob/O in viewers(M))
if (O.client) O.show_message("\red <B>[M] has been beaten with \the [src] by [user]!</B>", 1, "\red You hear someone fall", 2)
else
playsound(src.loc, 'sound/weapons/Genhit.ogg', 50, 1, -1)
M.Stun(3)
M.Weaken(3)
M.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been attacked with [src.name] by [user.name] ([user.ckey])</font>")
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Used the [src.name] to attack [M.name] ([M.ckey])</font>")
log_attack("[user.name] ([user.ckey]) attacked [M.name] ([M.ckey]) with [src.name] (INTENT: [uppertext(user.a_intent)])")
if(!iscarbon(user))
M.LAssailant = null
else
M.LAssailant = user
src.add_fingerprint(user)
for(var/mob/O in viewers(M))
if (O.client) O.show_message("\red <B>[M] has been stunned with \the [src] by [user]!</B>", 1, "\red You hear someone fall", 2)
//Telescopic baton
/obj/item/weapon/melee/telebaton
name = "telescopic baton"
desc = "A compact yet robust personal defense weapon. Can be concealed when folded."
icon = 'icons/obj/weapons.dmi'
icon_state = "telebaton_0"
item_state = "telebaton_0"
slot_flags = SLOT_BELT
w_class = 2
force = 3
force = 12 //9 hit crit
w_class = 3
var/cooldown = 0
var/on = 0
var/on = 1
/obj/item/weapon/melee/telebaton/attack_self(mob/user as mob)
on = !on
if(on)
user << "<span class ='warning'>You extend the baton.</span>"
icon_state = "telebaton_1"
item_state = "nullrod"
w_class = 4 //doesnt fit in backpack when its on for balance
force = 10 //seclite damage
attack_verb = list("smacked", "struck", "cracked", "beaten")
else
user << "<span class ='notice'>You collapse the baton.</span>"
icon_state = "telebaton_0"
item_state = "telebaton_0" //no sprite in other words
slot_flags = SLOT_BELT
w_class = 2
force = 3 //not so robust now
attack_verb = list("hit", "poked")
if(istype(user,/mob/living/carbon/human))
var/mob/living/carbon/human/H = user
H.update_inv_l_hand()
H.update_inv_r_hand()
playsound(src.loc, 'sound/weapons/batonextend.ogg', 50, 1)
add_fingerprint(user)
if (!blood_DNA) return
if(blood_overlay && (blood_DNA.len >= 1)) //updates blood overlay, if any
overlays.Cut()//this might delete other item overlays as well but eeeeeeeh
var/icon/I = new /icon(src.icon, src.icon_state)
I.Blend(new /icon('icons/effects/blood.dmi', rgb(255,255,255)),ICON_ADD)
I.Blend(new /icon('icons/effects/blood.dmi', "itemblood"),ICON_MULTIPLY)
blood_overlay = I
overlays += blood_overlay
return
/obj/item/weapon/melee/telebaton/attack(mob/target as mob, mob/living/user as mob)
/obj/item/weapon/melee/classic_baton/attack(mob/target as mob, mob/living/user as mob)
if(on)
add_fingerprint(user)
if((CLUMSY in user.mutations) && prob(50))
@@ -221,9 +133,10 @@
if(cooldown <= 0)
playsound(get_turf(src), 'sound/effects/woodhit.ogg', 75, 1, -1)
target.Weaken(3)
add_logs(target, user, "stunned", object="telescopic baton")
add_logs(target, user, "stunned", object="classic baton")
src.add_fingerprint(user)
target.visible_message("<span class ='danger'>[target] has been knocked down with \the [src] by [user]!</span>")
target.visible_message("<span class ='danger'>[user] has knocked down [target] with \the [src]!</span>", \
"<span class ='userdanger'>[user] has knocked down [target] with \the [src]!</span>")
if(!iscarbon(user))
target.LAssailant = null
else
@@ -235,6 +148,39 @@
else
return ..()
//Telescopic baton
/obj/item/weapon/melee/classic_baton/telescopic
name = "telescopic baton"
desc = "A compact yet robust personal defense weapon. Can be concealed when folded."
icon = 'icons/obj/weapons.dmi'
icon_state = "telebaton_0"
item_state = null
slot_flags = SLOT_BELT
w_class = 2
force = 0
on = 0
/obj/item/weapon/melee/classic_baton/telescopic/attack_self(mob/user as mob)
on = !on
if(on)
user << "<span class ='warning'>You extend the baton.</span>"
icon_state = "telebaton_1"
item_state = "nullrod"
w_class = 4 //doesnt fit in backpack when its on for balance
force = 10 //stunbaton damage
attack_verb = list("smacked", "struck", "cracked", "beaten")
else
user << "<span class ='notice'>You collapse the baton.</span>"
icon_state = "telebaton_0"
item_state = null //no sprite for concealment even when in hand
slot_flags = SLOT_BELT
w_class = 2
force = 0 //not so robust now
attack_verb = list("hit", "poked")
playsound(src.loc, 'sound/weapons/batonextend.ogg', 50, 1)
add_fingerprint(user)
/*
*Energy Blade
*/