Merge pull request #14615 from variableundefined/IsHolsterable

Refactor IsHandgun to a class variable called can_holster
This commit is contained in:
AffectedArc07
2020-10-25 18:07:25 +00:00
committed by GitHub
10 changed files with 14 additions and 36 deletions
@@ -15,7 +15,7 @@
//subtypes can override this to specify what can be holstered
/obj/item/clothing/accessory/holster/proc/can_holster(obj/item/gun/W)
if(!W.isHandgun())
if(!W.can_holster)
return 0
else if(!istype(W,holster_allow))
return 0
+2 -3
View File
@@ -56,6 +56,8 @@
var/knife_x_offset = 0
var/knife_y_offset = 0
var/can_holster = TRUE
var/list/upgrades = list()
var/ammo_x_offset = 0 //used for positioning ammo count overlay on sprite
@@ -466,9 +468,6 @@
process_fire(target, user, 1, params)
/obj/item/gun/proc/isHandgun()
return 1
/////////////
// ZOOMING //
/////////////
@@ -73,13 +73,11 @@
force = 10
flags = CONDUCT
slot_flags = SLOT_BACK
can_holster = FALSE
origin_tech = "combat=4;magnets=4;powerstorage=3"
ammo_type = list(/obj/item/ammo_casing/energy/laser/accelerator)
ammo_x_offset = 3
/obj/item/gun/energy/lasercannon/isHandgun()
return 0
/obj/item/ammo_casing/energy/laser/accelerator
projectile_type = /obj/item/projectile/beam/laser/accelerator
select_name = "accelerator"
@@ -4,6 +4,7 @@
icon_state = "pulse"
item_state = null
w_class = WEIGHT_CLASS_BULKY
can_holster = FALSE
force = 10
flags = CONDUCT
slot_flags = SLOT_BACK
@@ -13,9 +14,6 @@
/obj/item/gun/energy/pulse/emp_act(severity)
return
/obj/item/gun/energy/pulse/isHandgun()
return 0
/obj/item/gun/energy/pulse/cyborg
/obj/item/gun/energy/pulse/cyborg/newshot()
@@ -41,12 +39,10 @@
slot_flags = SLOT_BELT
icon_state = "pulse_pistol"
item_state = "gun"
can_holster = TRUE
cell_type = /obj/item/stock_parts/cell/pulse/pistol
can_charge = 0
/obj/item/gun/energy/pulse/pistol/isHandgun()
return 1
/obj/item/gun/energy/pulse/destroyer
name = "pulse destroyer"
desc = "A heavy-duty, pulse-based energy weapon."
@@ -66,11 +62,9 @@
desc = "A compact pulse core in a classic handgun frame for Nanotrasen officers. It's not the size of the gun, it's the size of the hole it puts through people."
icon_state = "m1911"
item_state = "gun"
can_holster = TRUE
cell_type = /obj/item/stock_parts/cell/infinite
/obj/item/gun/energy/pulse/pistol/m1911/isHandgun()
return 1
/obj/item/gun/energy/pulse/turret
name = "pulse turret gun"
desc = "A heavy, turret-mounted pulse energy cannon."
@@ -7,6 +7,7 @@
fire_sound = 'sound/weapons/ionrifle.ogg'
origin_tech = "combat=4;magnets=4"
w_class = WEIGHT_CLASS_HUGE
can_holster = FALSE
flags = CONDUCT
slot_flags = SLOT_BACK
ammo_type = list(/obj/item/ammo_casing/energy/ion)
@@ -17,9 +18,6 @@
/obj/item/gun/energy/ionrifle/emp_act(severity)
return
/obj/item/gun/energy/ionrifle/isHandgun()
return 0
/obj/item/gun/energy/ionrifle/carbine
name = "ion carbine"
desc = "The MK.II Prototype Ion Projector is a lightweight carbine version of the larger ion rifle, built to be ergonomic and efficient."
@@ -314,13 +312,11 @@
weapon_weight = WEAPON_HEAVY
slot_flags = SLOT_BACK
w_class = WEIGHT_CLASS_BULKY
can_holster = FALSE
zoomable = TRUE
zoom_amt = 7 //Long range, enough to see in front of you, but no tiles behind you.
shaded_charge = 1
/obj/item/gun/energy/sniperrifle/isHandgun()
return FALSE // Makes it so no, you cant fit a massive, bulky, sniper under your arm
// Temperature Gun //
/obj/item/gun/energy/temperature
name = "temperature gun"
@@ -4,13 +4,11 @@
var/select = 1
can_tactical = TRUE
can_suppress = 1
can_holster = FALSE
burst_size = 3
fire_delay = 2
actions_types = list(/datum/action/item_action/toggle_firemode)
/obj/item/gun/projectile/automatic/isHandgun()
return 0
/obj/item/gun/projectile/automatic/update_icon()
..()
overlays.Cut()
@@ -37,12 +37,11 @@
fire_sound = 'sound/effects/explosion1.ogg'
origin_tech = "combat=5"
mag_type = /obj/item/ammo_box/magazine/m75
can_holster = TRUE // Override default automatic setting since it is a handgun sized gun
burst_size = 1
fire_delay = 0
actions_types = list()
/obj/item/gun/projectile/automatic/gyropistol/isHandgun()
return 1
/obj/item/gun/projectile/automatic/gyropistol/process_chamber(eject_casing = 0, empty_chamber = 1)
..()
@@ -5,6 +5,7 @@
icon_state = "pistol"
w_class = WEIGHT_CLASS_SMALL
origin_tech = "combat=3;materials=2;syndicate=4"
can_holster = TRUE
mag_type = /obj/item/ammo_box/magazine/m10mm
fire_sound = 'sound/weapons/gunshots/gunshot_pistol.ogg'
magin_sound = 'sound/weapons/gun_interactions/pistol_magin.ogg'
@@ -14,9 +15,6 @@
fire_delay = 0
actions_types = list()
/obj/item/gun/projectile/automatic/pistol/isHandgun()
return 1
/obj/item/gun/projectile/automatic/pistol/update_icon()
..()
icon_state = "[initial(icon_state)][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]"
@@ -336,6 +336,7 @@
mag_type = /obj/item/ammo_box/magazine/internal/shot/dual
fire_sound = 'sound/weapons/gunshots/gunshot_shotgun.ogg'
sawn_desc = "Omar's coming!"
can_holster = FALSE
unique_rename = 1
unique_reskin = 1
@@ -377,9 +378,6 @@
else
to_chat(user, "<span class='notice'>[src] is empty.</span>")
/obj/item/gun/projectile/revolver/doublebarrel/isHandgun() //contrary to popular opinion, double barrels are not, shockingly, handguns
return 0
// IMPROVISED SHOTGUN //
/obj/item/gun/projectile/revolver/doublebarrel/improvised
@@ -6,6 +6,7 @@
w_class = WEIGHT_CLASS_BULKY
force = 10
flags = CONDUCT
can_holster = FALSE
slot_flags = SLOT_BACK
origin_tech = "combat=4;materials=2"
mag_type = /obj/item/ammo_box/magazine/internal/shot
@@ -70,9 +71,6 @@
if(chambered)
. += "A [chambered.BB ? "live" : "spent"] one is in the chamber."
/obj/item/gun/projectile/shotgun/isHandgun() //You cannot, in fact, holster a shotgun.
return 0
/obj/item/gun/projectile/shotgun/lethal
mag_type = /obj/item/ammo_box/magazine/internal/shot/lethal