Skip to content

Commit

Permalink
Empty Rifles in the Gun Racks (#220)
Browse files Browse the repository at this point in the history
Adds a slightly more realistic way to store firearms, currently unmapped.
  • Loading branch information
WolfOrion authored Apr 14, 2024
1 parent 1228f38 commit 8b38b57
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
11 changes: 10 additions & 1 deletion code/game/objects/structures/gun_rack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
icon_state = "m41a"
density = TRUE
var/allowed_type
var/populate_type
var/max_stored = 5
var/initial_stored = 5

Expand All @@ -17,7 +18,7 @@
if(initial_stored)
var/i = 0
while(i < initial_stored)
contents += new allowed_type(src)
contents += new populate_type(src)
i++
update_icon()

Expand Down Expand Up @@ -47,13 +48,21 @@

/obj/structure/gun_rack/m41
allowed_type = /obj/item/weapon/gun/rifle/m41aMK1
populate_type = /obj/item/weapon/gun/rifle/m41aMK1

/obj/structure/gun_rack/m41/unloaded
populate_type = /obj/item/weapon/gun/rifle/m41aMK1/unloaded

/obj/structure/gun_rack/type71
icon_state = "type71"
desc = "Some off-branded gun rack. Per SOF and UPPA regulations, weapons should be stored in secure safes and only given out when necessary. Of course, most (but not all!) units overlook this regulation, only storing their firearms in safes when inspection arrives."
max_stored = 6
initial_stored = 6
allowed_type = /obj/item/weapon/gun/rifle/type71
populate_type = /obj/item/weapon/gun/rifle/type71

/obj/structure/gun_rack/type71/unloaded
populate_type = /obj/item/weapon/gun/rifle/type71/unloaded

/obj/structure/gun_rack/apc
name = "APC ammo compartment"
Expand Down
8 changes: 8 additions & 0 deletions code/modules/projectiles/guns/rifles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,10 @@
/obj/item/weapon/gun/rifle/m41aMK1/ap //for making it start with ap loaded
current_mag = /obj/item/ammo_magazine/rifle/m41aMK1/ap

/obj/item/weapon/gun/rifle/m41aMK1/unloaded //for making it start unloaded and with the safety on
current_mag = null
flags_gun_features = GUN_AUTO_EJECTOR|GUN_CAN_POINTBLANK|GUN_AMMO_COUNTER|GUN_TRIGGER_SAFETY

/obj/item/weapon/gun/rifle/m41aMK1/tactical
starting_attachment_types = list(/obj/item/attachable/attached_gun/grenade/mk1, /obj/item/attachable/suppressor, /obj/item/attachable/magnetic_harness, /obj/item/attachable/stock/rifle/collapsible)
current_mag = /obj/item/ammo_magazine/rifle/m41aMK1/ap
Expand Down Expand Up @@ -1331,6 +1335,10 @@
STOCK.Attach(src)
update_attachable(STOCK.slot)

/obj/item/weapon/gun/rifle/type71/unloaded
current_mag = null
flags_gun_features = GUN_AUTO_EJECTOR|GUN_CAN_POINTBLANK|GUN_AMMO_COUNTER|GUN_TRIGGER_SAFETY

/obj/item/weapon/gun/rifle/type71/rifleman
//add GL
random_spawn_chance = 100
Expand Down
4 changes: 2 additions & 2 deletions maps/map_files/chapaev/chapaev.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,7 @@
/obj/structure/machinery/light{
dir = 1
},
/obj/structure/gun_rack/type71,
/obj/structure/gun_rack/type71/unloaded,
/turf/open/floor/strata{
icon_state = "floor2"
},
Expand Down Expand Up @@ -3034,7 +3034,7 @@
/obj/structure/machinery/light{
dir = 1
},
/obj/structure/gun_rack/type71,
/obj/structure/gun_rack/type71/unloaded,
/turf/open/floor/strata{
icon_state = "floor2"
},
Expand Down
4 changes: 2 additions & 2 deletions maps/map_files/golden_arrow/golden_arrow.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -4161,7 +4161,7 @@
pixel_x = 14;
pixel_y = 29
},
/obj/structure/gun_rack/m41,
/obj/structure/gun_rack/m41/unloaded,
/obj/item/ashtray/plastic{
pixel_y = 14;
pixel_x = 8
Expand Down Expand Up @@ -6818,7 +6818,7 @@
pixel_y = 29;
layer = 3
},
/obj/structure/gun_rack/m41,
/obj/structure/gun_rack/m41/unloaded,
/obj/item/reagent_container/food/drinks/cans/souto/blue{
pixel_y = 22;
pixel_x = 9
Expand Down
4 changes: 2 additions & 2 deletions maps/map_files/rover/rover.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
pixel_y = 34;
pixel_x = 8
},
/obj/structure/gun_rack/m41,
/obj/structure/gun_rack/m41/unloaded,
/turf/open/floor/almayer{
icon_state = "plate"
},
Expand Down Expand Up @@ -3201,7 +3201,7 @@
/obj/structure/machinery/light{
dir = 1
},
/obj/structure/gun_rack/m41,
/obj/structure/gun_rack/m41/unloaded,
/turf/open/floor/almayer{
icon_state = "plate"
},
Expand Down

0 comments on commit 8b38b57

Please sign in to comment.