Revert "12/21 modernizations from TG live"
This commit is contained in:
@@ -7,14 +7,13 @@
|
||||
flags = CONDUCT
|
||||
slot_flags = SLOT_BELT
|
||||
materials = list(MAT_METAL=2000)
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
w_class = 3
|
||||
throwforce = 5
|
||||
throw_speed = 3
|
||||
throw_range = 5
|
||||
force = 5
|
||||
origin_tech = "combat=1"
|
||||
needs_permit = 1
|
||||
unique_rename = 0
|
||||
attack_verb = list("struck", "hit", "bashed")
|
||||
|
||||
var/fire_sound = "gunshot"
|
||||
@@ -32,8 +31,11 @@
|
||||
var/firing_burst = 0 //Prevent the weapon from firing again while already firing
|
||||
var/semicd = 0 //cooldown handler
|
||||
var/weapon_weight = WEAPON_LIGHT
|
||||
|
||||
var/spread = 0 //Spread induced by the gun itself.
|
||||
var/randomspread = 1 //Set to 0 for shotguns. This is used for weapons that don't fire all their bullets at once.
|
||||
|
||||
var/unique_rename = 0 //allows renaming with a pen
|
||||
var/unique_reskin = 0 //allows one-time reskinning
|
||||
var/current_skin = null //the skin choice if we had a reskin
|
||||
var/list/options = list()
|
||||
@@ -43,7 +45,7 @@
|
||||
|
||||
var/obj/item/device/firing_pin/pin = /obj/item/device/firing_pin //standard firing pin for most guns
|
||||
|
||||
var/obj/item/device/flashlight/gun_light = null
|
||||
var/obj/item/device/flashlight/F = null
|
||||
var/can_flashlight = 0
|
||||
|
||||
var/list/upgrades = list()
|
||||
@@ -64,7 +66,7 @@
|
||||
..()
|
||||
if(pin)
|
||||
pin = new pin(src)
|
||||
if(gun_light)
|
||||
if(F)
|
||||
verbs += /obj/item/weapon/gun/proc/toggle_gunlight
|
||||
new /datum/action/item_action/toggle_gunlight(src)
|
||||
build_zooming()
|
||||
@@ -77,7 +79,7 @@
|
||||
G.loc = loc
|
||||
qdel(G.pin)
|
||||
G.pin = null
|
||||
visible_message("[G] can now fit a new pin, but old one was destroyed in the process.", null, null, 3)
|
||||
visible_message("[G] can now fit a new pin, but old one was destroyed in the process.")
|
||||
qdel(src)
|
||||
|
||||
/obj/item/weapon/gun/examine(mob/user)
|
||||
@@ -88,8 +90,10 @@
|
||||
user << "It doesn't have a firing pin installed, and won't fire."
|
||||
if(unique_reskin && !current_skin)
|
||||
user << "<span class='notice'>Alt-click it to reskin it.</span>"
|
||||
if(unique_rename)
|
||||
user << "<span class='notice'>Use a pen on it to rename it.</span>"
|
||||
|
||||
|
||||
//called after the gun has successfully fired its chambered ammo.
|
||||
/obj/item/weapon/gun/proc/process_chamber()
|
||||
return 0
|
||||
|
||||
@@ -103,6 +107,7 @@
|
||||
/obj/item/weapon/gun/proc/shoot_with_empty_chamber(mob/living/user as mob|obj)
|
||||
user << "<span class='danger'>*click*</span>"
|
||||
playsound(user, 'sound/weapons/empty.ogg', 100, 1)
|
||||
return
|
||||
|
||||
|
||||
/obj/item/weapon/gun/proc/shoot_live_shot(mob/living/user as mob|obj, pointblank = 0, mob/pbtarget = null, message = 1)
|
||||
@@ -113,11 +118,18 @@
|
||||
playsound(user, fire_sound, 10, 1)
|
||||
else
|
||||
playsound(user, fire_sound, 50, 1)
|
||||
if(message)
|
||||
if(pointblank)
|
||||
user.visible_message("<span class='danger'>[user] fires [src] point blank at [pbtarget]!</span>", null, null, COMBAT_MESSAGE_RANGE)
|
||||
else
|
||||
user.visible_message("<span class='danger'>[user] fires [src]!</span>", null, null, COMBAT_MESSAGE_RANGE)
|
||||
if(!message)
|
||||
return
|
||||
if(pointblank)
|
||||
user.visible_message("<span class='danger'>[user] fires [src] point blank at [pbtarget]!</span>", "<span class='danger'>You fire [src] point blank at [pbtarget]!</span>", "<span class='italics'>You hear a [istype(src, /obj/item/weapon/gun/energy) ? "laser blast" : "gunshot"]!</span>")
|
||||
else
|
||||
user.visible_message("<span class='danger'>[user] fires [src]!</span>", "<span class='danger'>You fire [src]!</span>", "You hear a [istype(src, /obj/item/weapon/gun/energy) ? "laser blast" : "gunshot"]!")
|
||||
|
||||
if(weapon_weight >= WEAPON_MEDIUM)
|
||||
if(user.get_inactive_hand())
|
||||
if(prob(15))
|
||||
if(user.drop_item())
|
||||
user.visible_message("<span class='danger'>[src] flies out of [user]'s hands!</span>", "<span class='userdanger'>[src] kicks out of your grip!</span>")
|
||||
|
||||
/obj/item/weapon/gun/emp_act(severity)
|
||||
for(var/obj/O in contents)
|
||||
@@ -130,7 +142,7 @@
|
||||
if(flag) //It's adjacent, is the user, or is on the user's person
|
||||
if(target in user.contents) //can't shoot stuff inside us.
|
||||
return
|
||||
if(!ismob(target) || user.a_intent == INTENT_HARM) //melee attack
|
||||
if(!ismob(target) || user.a_intent == "harm") //melee attack
|
||||
return
|
||||
if(target == user && user.zone_selected != "mouth") //so we can't shoot ourselves (unless mouth selected)
|
||||
return
|
||||
@@ -140,7 +152,7 @@
|
||||
if(!can_trigger_gun(L))
|
||||
return
|
||||
|
||||
if(!can_shoot()) //Just because you can pull the trigger doesn't mean it can shoot.
|
||||
if(!can_shoot()) //Just because you can pull the trigger doesn't mean it can't shoot.
|
||||
shoot_with_empty_chamber(user)
|
||||
return
|
||||
|
||||
@@ -154,31 +166,17 @@
|
||||
if(clumsy_check)
|
||||
if(istype(user))
|
||||
if (user.disabilities & CLUMSY && prob(40))
|
||||
user << "<span class='userdanger'>You shoot yourself in the foot with [src]!</span>"
|
||||
user << "<span class='userdanger'>You shoot yourself in the foot with \the [src]!</span>"
|
||||
var/shot_leg = pick("l_leg", "r_leg")
|
||||
process_fire(user,user,0,params, zone_override = shot_leg)
|
||||
user.drop_item()
|
||||
return
|
||||
|
||||
if(weapon_weight == WEAPON_HEAVY && user.get_inactive_held_item())
|
||||
user << "<span class='userdanger'>You need both hands free to fire [src]!</span>"
|
||||
if(weapon_weight == WEAPON_HEAVY && user.get_inactive_hand())
|
||||
user << "<span class='userdanger'>You need both hands free to fire \the [src]!</span>"
|
||||
return
|
||||
|
||||
//DUAL (or more!) WIELDING
|
||||
var/bonus_spread = 0
|
||||
var/loop_counter = 0
|
||||
if(ishuman(user) && user.a_intent == INTENT_HARM)
|
||||
var/mob/living/carbon/human/H = user
|
||||
for(var/obj/item/weapon/gun/G in H.held_items)
|
||||
if(G == src || G.weapon_weight >= WEAPON_MEDIUM)
|
||||
continue
|
||||
else if(G.can_trigger_gun(user))
|
||||
bonus_spread += 24 * G.weapon_weight
|
||||
loop_counter++
|
||||
spawn(loop_counter)
|
||||
G.process_fire(target,user,1,params, null, bonus_spread)
|
||||
|
||||
process_fire(target,user,1,params, null, bonus_spread)
|
||||
process_fire(target,user,1,params)
|
||||
|
||||
|
||||
|
||||
@@ -197,23 +195,23 @@
|
||||
pin.auth_fail(user)
|
||||
return 0
|
||||
else
|
||||
user << "<span class='warning'>[src]'s trigger is locked. This weapon doesn't have a firing pin installed!</span>"
|
||||
user << "<span class='warning'>\The [src]'s trigger is locked. This weapon doesn't have a firing pin installed!</span>"
|
||||
return 0
|
||||
|
||||
/obj/item/weapon/gun/proc/recharge_newshot()
|
||||
obj/item/weapon/gun/proc/newshot()
|
||||
return
|
||||
|
||||
/obj/item/weapon/gun/proc/process_fire(atom/target as mob|obj|turf, mob/living/user as mob|obj, message = 1, params, zone_override, bonus_spread = 0)
|
||||
/obj/item/weapon/gun/proc/process_fire(atom/target as mob|obj|turf, mob/living/user as mob|obj, message = 1, params, zone_override)
|
||||
add_fingerprint(user)
|
||||
|
||||
if(semicd)
|
||||
return
|
||||
|
||||
var/sprd = 0
|
||||
var/randomized_gun_spread = 0
|
||||
if(spread)
|
||||
randomized_gun_spread = rand(0,spread)
|
||||
var/randomized_bonus_spread = rand(0, bonus_spread)
|
||||
if(weapon_weight)
|
||||
if(user.get_inactive_hand())
|
||||
recoil = 4 //one-handed kick
|
||||
else
|
||||
recoil = initial(recoil)
|
||||
|
||||
if(burst_size > 1)
|
||||
firing_burst = 1
|
||||
@@ -221,15 +219,15 @@
|
||||
if(!user)
|
||||
break
|
||||
if(!issilicon(user))
|
||||
if( i>1 && !(user.is_holding(src))) //for burst firing
|
||||
if( i>1 && !(src in get_both_hands(user))) //for burst firing
|
||||
break
|
||||
if(chambered && chambered.BB)
|
||||
if(chambered)
|
||||
var/sprd = 0
|
||||
if(randomspread)
|
||||
sprd = round((rand() - 0.5) * (randomized_gun_spread + randomized_bonus_spread))
|
||||
sprd = round((rand() - 0.5) * spread)
|
||||
else //Smart spread
|
||||
sprd = round((i / burst_size - 0.5) * (randomized_gun_spread + randomized_bonus_spread))
|
||||
|
||||
if(!chambered.fire_casing(target, user, params, ,suppressed, zone_override, sprd))
|
||||
sprd = round((i / burst_size - 0.5) * spread)
|
||||
if(!chambered.fire(target, user, params, ,suppressed, zone_override, sprd))
|
||||
shoot_with_empty_chamber(user)
|
||||
break
|
||||
else
|
||||
@@ -246,8 +244,7 @@
|
||||
firing_burst = 0
|
||||
else
|
||||
if(chambered)
|
||||
sprd = round((pick(1,-1)) * (randomized_gun_spread + randomized_bonus_spread))
|
||||
if(!chambered.fire_casing(target, user, params, , suppressed, zone_override, sprd))
|
||||
if(!chambered.fire(target, user, params, , suppressed, zone_override, spread))
|
||||
shoot_with_empty_chamber(user)
|
||||
return
|
||||
else
|
||||
@@ -265,26 +262,29 @@
|
||||
semicd = 0
|
||||
|
||||
if(user)
|
||||
user.update_inv_hands()
|
||||
if(user.hand)
|
||||
user.update_inv_l_hand()
|
||||
else
|
||||
user.update_inv_r_hand()
|
||||
feedback_add_details("gun_fired","[src.type]")
|
||||
|
||||
/obj/item/weapon/gun/attack(mob/M as mob, mob/user)
|
||||
if(user.a_intent == INTENT_HARM) //Flogging
|
||||
if(user.a_intent == "harm") //Flogging
|
||||
..()
|
||||
else
|
||||
return
|
||||
|
||||
/obj/item/weapon/gun/attackby(obj/item/I, mob/user, params)
|
||||
if(can_flashlight)
|
||||
if(istype(I, /obj/item/device/flashlight/seclite))
|
||||
var/obj/item/device/flashlight/seclite/S = I
|
||||
if(!gun_light)
|
||||
if(istype(I, /obj/item/device/flashlight/seclite))
|
||||
var/obj/item/device/flashlight/seclite/S = I
|
||||
if(can_flashlight)
|
||||
if(!F)
|
||||
if(!user.unEquip(I))
|
||||
return
|
||||
user << "<span class='notice'>You click [S] into place on [src].</span>"
|
||||
if(S.on)
|
||||
SetLuminosity(0)
|
||||
gun_light = S
|
||||
set_light(0)
|
||||
F = S
|
||||
I.loc = src
|
||||
update_icon()
|
||||
update_gunlight(user)
|
||||
@@ -293,57 +293,51 @@
|
||||
if(loc == user)
|
||||
A.Grant(user)
|
||||
|
||||
if(istype(I, /obj/item/weapon/screwdriver))
|
||||
if(gun_light)
|
||||
for(var/obj/item/device/flashlight/seclite/S in src)
|
||||
user << "<span class='notice'>You unscrew the seclite from [src].</span>"
|
||||
gun_light = null
|
||||
S.forceMove(get_turf(user))
|
||||
update_gunlight(user)
|
||||
S.update_brightness(user)
|
||||
update_icon()
|
||||
verbs -= /obj/item/weapon/gun/proc/toggle_gunlight
|
||||
for(var/datum/action/item_action/toggle_gunlight/TGL in actions)
|
||||
qdel(TGL)
|
||||
else
|
||||
..()
|
||||
|
||||
if(istype(I, /obj/item/weapon/screwdriver))
|
||||
if(F && can_flashlight)
|
||||
for(var/obj/item/device/flashlight/seclite/S in src)
|
||||
user << "<span class='notice'>You unscrew the seclite from [src].</span>"
|
||||
F = null
|
||||
S.loc = get_turf(user)
|
||||
update_gunlight(user)
|
||||
S.update_brightness(user)
|
||||
update_icon()
|
||||
verbs -= /obj/item/weapon/gun/proc/toggle_gunlight
|
||||
for(var/datum/action/item_action/toggle_gunlight/TGL in actions)
|
||||
qdel(TGL)
|
||||
|
||||
if(unique_rename)
|
||||
if(istype(I, /obj/item/weapon/pen))
|
||||
rename_gun(user)
|
||||
..()
|
||||
|
||||
/obj/item/weapon/gun/proc/toggle_gunlight()
|
||||
set name = "Toggle Gunlight"
|
||||
set category = "Object"
|
||||
set desc = "Click to toggle your weapon's attached flashlight."
|
||||
|
||||
if(!gun_light)
|
||||
if(!F)
|
||||
return
|
||||
|
||||
var/mob/living/carbon/human/user = usr
|
||||
gun_light.on = !gun_light.on
|
||||
user << "<span class='notice'>You toggle the gunlight [gun_light.on ? "on":"off"].</span>"
|
||||
if(!isturf(user.loc))
|
||||
user << "<span class='warning'>You cannot turn the light on while in this [user.loc]!</span>"
|
||||
F.on = !F.on
|
||||
user << "<span class='notice'>You toggle the gunlight [F.on ? "on":"off"].</span>"
|
||||
|
||||
playsound(user, 'sound/weapons/empty.ogg', 100, 1)
|
||||
update_gunlight(user)
|
||||
return
|
||||
|
||||
/obj/item/weapon/gun/proc/update_gunlight(mob/user = null)
|
||||
if(gun_light)
|
||||
if(gun_light.on)
|
||||
if(loc == user)
|
||||
user.AddLuminosity(gun_light.brightness_on)
|
||||
else if(isturf(loc))
|
||||
SetLuminosity(gun_light.brightness_on)
|
||||
if(F)
|
||||
if(F.on)
|
||||
set_light(F.brightness_on)
|
||||
else
|
||||
if(loc == user)
|
||||
user.AddLuminosity(-gun_light.brightness_on)
|
||||
else if(isturf(loc))
|
||||
SetLuminosity(0)
|
||||
set_light(0)
|
||||
update_icon()
|
||||
else
|
||||
if(loc == user)
|
||||
user.AddLuminosity(-5)
|
||||
else if(isturf(loc))
|
||||
SetLuminosity(0)
|
||||
set_light(0)
|
||||
for(var/X in actions)
|
||||
var/datum/action/A = X
|
||||
A.UpdateButtonIcon()
|
||||
@@ -351,19 +345,11 @@
|
||||
|
||||
/obj/item/weapon/gun/pickup(mob/user)
|
||||
..()
|
||||
if(gun_light)
|
||||
if(gun_light.on)
|
||||
user.AddLuminosity(gun_light.brightness_on)
|
||||
SetLuminosity(0)
|
||||
if(azoom)
|
||||
azoom.Grant(user)
|
||||
|
||||
/obj/item/weapon/gun/dropped(mob/user)
|
||||
..()
|
||||
if(gun_light)
|
||||
if(gun_light.on)
|
||||
user.AddLuminosity(-gun_light.brightness_on)
|
||||
SetLuminosity(gun_light.brightness_on)
|
||||
zoom(user,FALSE)
|
||||
if(azoom)
|
||||
azoom.Remove(user)
|
||||
@@ -389,6 +375,13 @@
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/weapon/gun/proc/rename_gun(mob/M)
|
||||
var/input = stripped_input(M,"What do you want to name the gun?", ,"", MAX_NAME_LEN)
|
||||
|
||||
if(src && input && !M.stat && in_range(M,src) && !M.restrained() && M.canmove)
|
||||
name = input
|
||||
M << "You name the gun [input]. Say hello to your new friend."
|
||||
return
|
||||
|
||||
|
||||
/obj/item/weapon/gun/proc/handle_suicide(mob/living/carbon/human/user, mob/living/carbon/human/target, params)
|
||||
@@ -399,7 +392,7 @@
|
||||
return
|
||||
|
||||
if(user == target)
|
||||
target.visible_message("<span class='warning'>[user] sticks [src] in [user.p_their()] mouth, ready to pull the trigger...</span>", \
|
||||
target.visible_message("<span class='warning'>[user] sticks [src] in their mouth, ready to pull the trigger...</span>", \
|
||||
"<span class='userdanger'>You stick [src] in your mouth, ready to pull the trigger...</span>")
|
||||
else
|
||||
target.visible_message("<span class='warning'>[user] points [src] at [target]'s head, ready to pull the trigger...</span>", \
|
||||
@@ -494,3 +487,8 @@
|
||||
azoom = new()
|
||||
azoom.gun = src
|
||||
|
||||
|
||||
/obj/item/weapon/gun/burn()
|
||||
if(pin)
|
||||
qdel(pin)
|
||||
.=..()
|
||||
|
||||
Reference in New Issue
Block a user