Removes IsHandgun() proc, adds slot flag

This commit is contained in:
mwerezak
2015-02-09 21:25:37 -05:00
parent 47a1639b6d
commit bf24ac82b8
18 changed files with 79 additions and 92 deletions

View File

@@ -128,7 +128,7 @@
icon_state = "revolver"
item_state = "gun"
flags = CONDUCT
slot_flags = SLOT_BELT
slot_flags = SLOT_BELT|SLOT_HOLSTER
w_class = 3.0
matter = list("glass" = 10,"metal" = 10)

View File

@@ -196,38 +196,32 @@
slowdown = 1
armor = list(melee = 60, bullet = 60, laser = 60, energy = 40, bomb = 20, bio = 0, rad = 0)
siemens_coefficient = 0.7
var/obj/item/clothing/tie/holster/holster
/obj/item/clothing/suit/armor/tactical/verb/holster()
/obj/item/clothing/suit/armor/tactical/New()
..()
holster = new(src)
/obj/item/clothing/suit/armor/tactical/attackby(obj/item/W as obj, mob/user as mob)
..()
holster.attackby(W, user)
/obj/item/clothing/suit/armor/tactical/verb/holster()
set name = "Holster"
set category = "Object"
set src in usr
if(!istype(usr, /mob/living)) return
if(usr.stat) return
if(!holstered)
if(!istype(usr.get_active_hand(), /obj/item/weapon/gun))
if(!holster.holstered)
var/obj/item/W = usr.get_active_hand()
if(!istype(W, /obj/item))
usr << "\blue You need your gun equiped to holster it."
return
var/obj/item/weapon/gun/W = usr.get_active_hand()
if (!W.isHandgun())
usr << "\red This gun won't fit in \the belt!"
return
holstered = usr.get_active_hand()
usr.drop_item()
holstered.loc = src
usr.visible_message("\blue \The [usr] holsters \the [holstered].", "You holster \the [holstered].")
holster.holster(W, usr)
else
if(istype(usr.get_active_hand(),/obj) && istype(usr.get_inactive_hand(),/obj))
usr << "\red You need an empty hand to draw the gun!"
else
if(usr.a_intent == "hurt")
usr.visible_message("\red \The [usr] draws \the [holstered], ready to shoot!", \
"\red You draw \the [holstered], ready to shoot!")
else
usr.visible_message("\blue \The [usr] draws \the [holstered], pointing it at the ground.", \
"\blue You draw \the [holstered], pointing it at the ground.")
usr.put_in_hands(holstered)
holstered = null
holster.unholster(usr)
//Non-hardsuit ERT armor.
/obj/item/clothing/suit/armor/vest/ert

View File

@@ -197,45 +197,40 @@
desc = "A handgun holster."
icon_state = "holster"
item_color = "holster"
var/obj/item/weapon/gun/holstered = null
//subtypes can override this to specify what can be holstered
/obj/item/clothing/tie/holster/proc/can_holster(obj/item/weapon/gun/W)
return W.isHandgun()
var/obj/item/holstered = null
/obj/item/clothing/tie/holster/proc/holster(obj/item/I, mob/user as mob)
if(holstered)
user << "\red There is already a [holstered] holstered here!"
user << "<span class='warning'>There is already \a [holstered] holstered here!</span>"
return
if (!istype(I, /obj/item/weapon/gun))
user << "\red Only guns can be holstered!"
if (!(I.slot_flags & SLOT_HOLSTER))
user << "<span class='warning'>[I] won't fit in [src]!</span>"
return
var/obj/item/weapon/gun/W = I
if (!can_holster(W))
user << "\red This [W] won't fit in the [src]!"
return
holstered = W
holstered = I
user.drop_from_inventory(holstered)
holstered.loc = src
holstered.add_fingerprint(user)
user.visible_message("\blue [user] holsters the [holstered].", "You holster the [holstered].")
user.visible_message("<span class='notice'>[user] holsters [holstered].</span>", "You holster [holstered].")
/obj/item/clothing/tie/holster/proc/unholster(mob/user as mob)
if(!holstered)
return
if(istype(user.get_active_hand(),/obj) && istype(user.get_inactive_hand(),/obj))
user << "\red You need an empty hand to draw the [holstered]!"
user << "<span class='warning'>You need an empty hand to draw [holstered]!</span>"
else
if(user.a_intent == "hurt")
usr.visible_message("\red [user] draws the [holstered], ready to shoot!", \
"\red You draw the [holstered], ready to shoot!")
usr.visible_message(
"<span class='warning'>[user] draws [holstered], ready to shoot!</span>",
"<span class='warning'>You draw [holstered], ready to shoot!</span>"
)
else
user.visible_message("\blue [user] draws the [holstered], pointing it at the ground.", \
"\blue You draw the [holstered], pointing it at the ground.")
user.visible_message(
"<span class='notice'>[user] draws [holstered], pointing it at the ground.</span>",
"<span class='notice'>You draw [holstered], pointing it at the ground.</span>"
)
user.put_in_hands(holstered)
holstered.add_fingerprint(user)
holstered = null
@@ -279,6 +274,7 @@
if(!istype(usr, /mob/living)) return
if(usr.stat) return
//can't we just use src here?
var/obj/item/clothing/tie/holster/H = null
if (istype(src, /obj/item/clothing/tie/holster))
H = src
@@ -288,20 +284,20 @@
H = S.hastie
if (!H)
usr << "/red Something is very wrong."
usr << "\red Something is very wrong."
if(!H.holstered)
if(!istype(usr.get_active_hand(), /obj/item/weapon/gun))
var/obj/item/W = usr.get_active_hand()
if(!istype(W, /obj/item))
usr << "\blue You need your gun equiped to holster it."
return
var/obj/item/weapon/gun/W = usr.get_active_hand()
H.holster(W, usr)
else
H.unholster(usr)
/obj/item/clothing/tie/holster/armpit
name = "shoulder holster"
desc = "A worn-out handgun holster. Perfect for concealed carry"
desc = "A worn-out handgun holster. Perfect for concealed carrying."
icon_state = "holster"
item_color = "holster"

View File

@@ -5,7 +5,7 @@
icon_state = "detective"
item_state = "gun"
flags = CONDUCT
slot_flags = SLOT_BELT
slot_flags = SLOT_BELT|SLOT_HOLSTER
matter = list("metal" = 2000)
w_class = 3.0
throwforce = 5
@@ -72,9 +72,6 @@
else
Fire(A,user,params) //Otherwise, fire normally.
/obj/item/weapon/gun/proc/isHandgun()
return 1
/obj/item/weapon/gun/proc/Fire(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, params, reflex = 0)//TODO: go over this
//Exclude lasertag guns from the CLUMSY check.
if(!user) return

View File

@@ -4,6 +4,7 @@
icon_state = "laser"
item_state = "laser"
fire_sound = 'sound/weapons/Laser.ogg'
slot_flags = SLOT_BELT|SLOT_BACK
w_class = 3.0
matter = list("metal" = 2000)
origin_tech = "combat=3;magnets=2"
@@ -70,13 +71,11 @@ obj/item/weapon/gun/energy/laser/retro
icon_state = "lasercannon"
fire_sound = 'sound/weapons/lasercannonfire.ogg'
origin_tech = "combat=4;materials=3;powerstorage=3"
slot_flags = SLOT_BELT|SLOT_BACK
projectile_type = "/obj/item/projectile/beam/heavylaser"
fire_delay = 20
isHandgun()
return 0
/obj/item/weapon/gun/energy/lasercannon/cyborg/load_into_chamber()
if(in_chamber)
return 1
@@ -106,6 +105,7 @@ obj/item/weapon/gun/energy/laser/retro
desc = "Standard issue weapon of the Imperial Guard"
projectile_type = "/obj/item/projectile/beam/lastertag/blue"
origin_tech = "combat=1;magnets=2"
slot_flags = SLOT_BELT|SLOT_HOLSTER
clumsy_check = 0
var/charge_tick = 0
@@ -143,6 +143,7 @@ obj/item/weapon/gun/energy/laser/retro
desc = "Standard issue weapon of the Imperial Guard"
projectile_type = "/obj/item/projectile/beam/lastertag/red"
origin_tech = "combat=1;magnets=2"
slot_flags = SLOT_BELT|SLOT_HOLSTER
clumsy_check = 0
var/charge_tick = 0

View File

@@ -40,6 +40,7 @@
desc = "An energy gun with an experimental miniaturized reactor."
icon_state = "nucgun"
origin_tech = "combat=3;materials=5;powerstorage=3"
slot_flags = SLOT_BELT
var/lightfail = 0
var/charge_tick = 0

View File

@@ -3,6 +3,7 @@
desc = "A heavy-duty, pulse-based energy weapon, preferred by front-line combat personnel."
icon_state = "pulse"
item_state = null //so the human update icon uses the icon_state instead.
slot_flags = SLOT_BELT|SLOT_BACK
force = 10
fire_sound = 'sound/weapons/pulse.ogg'
charge_cost = 200
@@ -33,9 +34,6 @@
projectile_type = /obj/item/projectile/beam/pulse
return
isHandgun()
return 0
/obj/item/weapon/gun/energy/pulse_rifle/cyborg/load_into_chamber()
if(in_chamber)
return 1
@@ -62,9 +60,7 @@
/obj/item/weapon/gun/energy/pulse_rifle/M1911
name = "\improper M1911-P"
desc = "It's not the size of the gun, it's the size of the hole it puts through people."
slot_flags = SLOT_BELT|SLOT_HOLSTER
icon_state = "m1911-p"
cell_type = "/obj/item/weapon/cell/infinite"
fire_delay = 10
isHandgun()
return 1

View File

@@ -141,6 +141,7 @@ obj/item/weapon/gun/energy/staff
desc = "For the love of god, make sure you're aiming this the right way!"
icon_state = "riotgun"
item_state = "c20r"
slot_flags = SLOT_BELT|SLOT_BACK
w_class = 4
projectile_type = "/obj/item/projectile/meteor"
charge_cost = 100
@@ -176,6 +177,7 @@ obj/item/weapon/gun/energy/staff
icon_state = "pen"
item_state = "pen"
w_class = 1
slot_flags = SLOT_BELT
/obj/item/weapon/gun/energy/mindflayer
@@ -191,6 +193,7 @@ obj/item/weapon/gun/energy/staff/focus
icon = 'icons/obj/wizard.dmi'
icon_state = "focus"
item_state = "focus"
slot_flags = SLOT_BACK
projectile_type = "/obj/item/projectile/forcebolt"
/*
attack_self(mob/living/user as mob)
@@ -215,7 +218,7 @@ obj/item/weapon/gun/energy/staff/focus
/obj/item/weapon/gun/energy/sniperrifle
name = "\improper L.W.A.P. sniper rifle"
desc = "A rifle constructed of lightweight materials, fitted with a SMART aiming-system scope."
desc = "A high-power laser rifle fitted with a SMART aiming-system scope."
icon = 'icons/obj/gun.dmi'
icon_state = "sniper"
fire_sound = 'sound/weapons/marauder.ogg'
@@ -224,7 +227,7 @@ obj/item/weapon/gun/energy/staff/focus
slot_flags = SLOT_BACK
charge_cost = 250
fire_delay = 35
w_class = 4.0
w_class = 4
zoomdevicename = "scope"
/obj/item/weapon/gun/energy/sniperrifle/verb/scope()

View File

@@ -60,6 +60,7 @@
item_state = "crossbow"
matter = list("metal" = 2000)
origin_tech = "combat=2;magnets=2;syndicate=5"
slot_flags = SLOT_BELT
silenced = 1
fire_sound = 'sound/weapons/Genhit.ogg'
projectile_type = /obj/item/projectile/energy/bolt
@@ -96,7 +97,7 @@
/obj/item/weapon/gun/energy/crossbow/largecrossbow
name = "Energy Crossbow"
desc = "A weapon favored by mercenary infiltration teams."
w_class = 4.0
w_class = 4
force = 10
matter = list("metal" = 200000)
projectile_type = /obj/item/projectile/energy/bolt/large

View File

@@ -7,6 +7,7 @@
var/current_temperature = T20C
charge_cost = 100
origin_tech = "combat=3;materials=4;powerstorage=3;magnets=2"
slot_flags = SLOT_BELT|SLOT_BACK
projectile_type = "/obj/item/projectile/temp"
cell_type = "/obj/item/weapon/cell/crap"

View File

@@ -7,14 +7,12 @@
max_shells = 22
caliber = "9mm"
origin_tech = "combat=4;materials=2"
slot_flags = SLOT_BELT
ammo_type = /obj/item/ammo_casing/c9mm
automatic = 1
fire_delay = 0
isHandgun()
return 0
/obj/item/weapon/gun/projectile/automatic/mini_uzi
name = "\improper Uzi"
desc = "A lightweight, fast firing gun, for when you want someone dead. Uses .45 rounds."
@@ -26,9 +24,6 @@
origin_tech = "combat=5;materials=2;syndicate=8"
ammo_type = /obj/item/ammo_casing/c45
isHandgun()
return 1
/obj/item/weapon/gun/projectile/automatic/c20r
name = "\improper C-20r SMG"
@@ -38,6 +33,7 @@
w_class = 3
caliber = "12mm"
origin_tech = "combat=5;materials=2;syndicate=8"
slot_flags = SLOT_BELT|SLOT_BACK
fire_sound = 'sound/weapons/Gunshot_smg.ogg'
load_method = MAGAZINE
magazine_type = /obj/item/ammo_magazine/a12mm
@@ -66,6 +62,7 @@
max_shells = 50
caliber = "a762"
origin_tech = "combat=5;materials=1;syndicate=2"
slot_flags = SLOT_BACK
ammo_type = "/obj/item/ammo_casing/a762"
fire_sound = 'sound/weapons/Gunshot_smg.ogg'
load_method = MAGAZINE

View File

@@ -55,6 +55,7 @@
mouthshoot = 1 // No suiciding with this weapon, causes runtimes.
fire_sound_text = "a solid thunk"
fire_delay = 25
slot_flags = SLOT_BACK
var/tension = 0 // Current draw on the bow.
var/max_tension = 5 // Highest possible tension.

View File

@@ -13,10 +13,6 @@
/obj/item/weapon/gun/launcher/load_into_chamber()
return (!isnull(in_chamber))
//This should not fit in a combat belt or holster.
/obj/item/weapon/gun/launcher/isHandgun()
return 0
//Launchers are mechanical, no other impact.
/obj/item/weapon/gun/launcher/emp_act(severity)
return

View File

@@ -4,6 +4,7 @@
icon = 'icons/obj/gun.dmi'
icon_state = "pneumatic"
item_state = "pneumatic"
slot_flags = SLOT_BELT
w_class = 5.0
flags = CONDUCT
fire_sound_text = "a loud whoosh of moving air"

View File

@@ -5,14 +5,22 @@
caliber = "357"
origin_tech = "combat=2;materials=2"
eject_casings = 0
max_shells = 7
ammo_type = /obj/item/ammo_casing/a357
/obj/item/weapon/gun/projectile/revolver/mateba
name = "mateba"
desc = "When you absolutely, positively need a 10mm hole in the other guy. Uses .357 ammo." //>10mm hole >.357
icon_state = "mateba"
origin_tech = "combat=2;materials=2"
/obj/item/weapon/gun/projectile/detective
name = "revolver"
desc = "A cheap Martian knock-off of a Smith & Wesson Model 10. Uses .38-Special rounds."
icon_state = "detective"
max_shells = 6
eject_casings = 0
caliber = "38"
origin_tech = "combat=2;materials=2"
ammo_type = /obj/item/ammo_casing/c38
@@ -84,6 +92,7 @@
desc = "A cheap Martian knock-off of a Colt M1911. Uses less-than-lethal .45 rounds."
icon_state = "colt"
caliber = ".45"
eject_casings = 1
load_method = MAGAZINE
magazine_type = /obj/item/ammo_magazine/c45m/rubber
@@ -96,13 +105,6 @@
desc = "A cheap Martian knock-off of a Colt M1911."
magazine_type = /obj/item/ammo_magazine/c45m
/obj/item/weapon/gun/projectile/revolver/mateba
name = "mateba"
desc = "When you absolutely, positively need a 10mm hole in the other guy. Uses .357 ammo." //>10mm hole >.357
icon_state = "mateba"
origin_tech = "combat=2;materials=2"
// A gun to play Russian Roulette!
// You can spin the chamber to randomize the position of the bullet.
/*

View File

@@ -16,9 +16,6 @@
var/pumped = 0
var/obj/item/ammo_casing/current_shell = null
/obj/item/weapon/gun/projectile/shotgun/pump/isHandgun()
return 0
/obj/item/weapon/gun/projectile/shotgun/pump/load_into_chamber()
if(in_chamber)
return 1
@@ -66,6 +63,7 @@
//SPEEDLOADER because rapid unloading.
//In principle someone could make a speedloader for it, so it makes sense.
load_method = SINGLE_CASING|SPEEDLOADER
eject_casings = 0
max_shells = 2
w_class = 4
force = 10
@@ -90,7 +88,7 @@
w_class = 3
item_state = "gun"
slot_flags &= ~SLOT_BACK //you can't sling it on your back
slot_flags |= SLOT_BELT //but you can wear it on your belt (poorly concealed under a trenchcoat, ideally)
slot_flags |= SLOT_BELT|SLOT_HOLSTER //but you can wear it on your belt (poorly concealed under a trenchcoat, ideally), or in a holster, why not.
name = "sawn-off shotgun"
desc = "Omar's coming!"
user << "<span class='warning'>You shorten the barrel of \the [src]!</span>"

View File

@@ -337,6 +337,7 @@
icon = 'icons/obj/items.dmi'
icon_state = "banana"
item_state = "banana"
slot_flags = SLOT_HOLSTER
filling_color = "#FCF695"
trash = /obj/item/weapon/bananapeel
plantname = "banana"

View File

@@ -166,6 +166,7 @@
#define SLOT_DENYPOCKET 4096 // This is to deny items with a w_class of 2 or 1 from fitting in pockets.
#define SLOT_TWOEARS 8192
#define SLOT_TIE 16384
#define SLOT_HOLSTER 32768 //16th bit
// Flags bitmasks.
#define STOPPRESSUREDAMAGE 1 // This flag is used on the flags variable for SUIT and HEAD items which stop pressure damage. Note that the flag 1 was previous used as ONBACK, so it is possible for some code to use (flags & 1) when checking if something can be put on your back. Replace this code with (inv_flags & SLOT_BACK) if you see it anywhere