Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gun racks #129

Merged
merged 13 commits into from
Mar 11, 2024
13 changes: 13 additions & 0 deletions code/game/objects/structures/crates_lockers/largecrate_supplies.dm
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@
desc = "A case containing two twenty-five M40 HDEP grenade boxes."
supplies = list(/obj/item/storage/box/nade_box = 2)

/obj/structure/largecrate/supply/explosives/grenades/less
name = "\improper M40 HDEP grenade case (x25)"
AndroBetel marked this conversation as resolved.
Show resolved Hide resolved
desc = "A case containing one twenty-five M40 HDEP grenade box."
AndroBetel marked this conversation as resolved.
Show resolved Hide resolved
icon_state = "case"
supplies = list(/obj/item/storage/box/nade_box = 1)

/obj/structure/largecrate/supply/explosives/mortar_he
name = "80mm HE mortar shell case (x25)"
desc = "A case containing twenty-five 80mm HE mortar shells."
Expand Down Expand Up @@ -291,6 +297,13 @@
desc = "A crate containing a P.A.C.M.A.N. generator, some fuel, and some cable coil to get your power up and going."
supplies = list(/obj/structure/machinery/power/port_gen/pacman = 1, /obj/item/stack/sheet/mineral/phoron/medium_stack = 1, /obj/item/stack/cable_coil/yellow = 3)

/obj/structure/largecrate/supply/motiondetectors
name = "\improper motion detectors crate"
desc = "A crate containing two motiondetectors."
icon_state = "case"
supplies = list(/obj/item/device/motiondetector = 2)


/obj/structure/largecrate/supply/medicine
name = "medical crate"
desc = "A crate containing medical supplies."
Expand Down
55 changes: 55 additions & 0 deletions code/game/objects/structures/gun_rack.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/obj/structure/gun_rack
name = "gun rack"
desc = "Nice rack!"
AndroBetel marked this conversation as resolved.
Show resolved Hide resolved
icon = 'icons/obj/structures/gun_racks.dmi'
icon_state = "m41a"
density = TRUE
var/allowed_type
var/max_stored = 5
var/initial_stored = 5

/obj/structure/gun_rack/Initialize()
. = ..()
if(!allowed_type)
icon_state = "m41a_0"
return

if(initial_stored)
var/i = 0
while(i < initial_stored)
contents += new allowed_type(src)
i++
update_icon()

/obj/structure/gun_rack/attackby(obj/item/O, mob/user)
AndroBetel marked this conversation as resolved.
Show resolved Hide resolved
if(istype(O, allowed_type) && contents.len < max_stored)
user.drop_inv_item_to_loc(O, src)
contents += O
update_icon()

/obj/structure/gun_rack/attack_hand(mob/living/user)
if(!contents.len)
to_chat(user, SPAN_WARNING("\The [src] is empty."))
return

var/obj/Obj = contents[contents.len]
AndroBetel marked this conversation as resolved.
Show resolved Hide resolved
contents -= Obj
user.put_in_hands(Obj)
to_chat(user, SPAN_NOTICE("You grab \a [Obj] from \the [src]."))
AndroBetel marked this conversation as resolved.
Show resolved Hide resolved
playsound(src, "gunequip", 25, TRUE)
update_icon()

/obj/structure/gun_rack/update_icon()
if(contents.len)
icon_state = "[initial(icon_state)]_[contents.len]"
else
icon_state = "[initial(icon_state)]_0"

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

/obj/structure/gun_rack/type71
icon_state = "type71"
max_stored = 6
initial_stored = 6
allowed_type = /obj/item/weapon/gun/rifle/type71
21 changes: 11 additions & 10 deletions code/modules/cm_marines/equipment/guncases.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

/obj/item/storage/box/guncase/update_icon()
if(LAZYLEN(contents))
icon_state = "guncase"
icon_state = initial(icon_state)
else
icon_state = "guncase_e"
icon_state = "[initial(icon_state)]_e"

/obj/item/storage/box/guncase/Initialize()
. = ..()
Expand Down Expand Up @@ -142,13 +142,12 @@
/obj/item/storage/box/guncase/flamer
name = "\improper M240 incinerator case"
desc = "A gun case containing the M240A1 incinerator unit. It does come loaded, but you'll still have to find extra tanks as you go."
storage_slots = 4
storage_slots = 3
can_hold = list(/obj/item/weapon/gun/flamer, /obj/item/ammo_magazine/flamer_tank, /obj/item/attachable/attached_gun/extinguisher)

/obj/item/storage/box/guncase/flamer/fill_preset_inventory()
new /obj/item/weapon/gun/flamer(src)
new /obj/item/ammo_magazine/flamer_tank(src)
new /obj/item/ammo_magazine/flamer_tank(src)
new /obj/item/attachable/attached_gun/extinguisher(src)

//------------
Expand Down Expand Up @@ -201,6 +200,7 @@
/obj/item/storage/box/guncase/pumpshotgun
name = "\improper M37A2 Pump Shotgun case"
desc = "A gun case containing the M37A2 Pump Shotgun."
icon_state = "guncase_red"
storage_slots = 4
can_hold = list(/obj/item/weapon/gun/shotgun/pump, /obj/item/ammo_magazine/shotgun/buckshot, /obj/item/ammo_magazine/shotgun/flechette, /obj/item/ammo_magazine/shotgun/slugs)

Expand All @@ -216,6 +216,13 @@
if(3)
new /obj/item/ammo_magazine/shotgun/slugs(src)

/obj/item/storage/box/guncase/pumpshotgun/special
storage_slots = 2

/obj/item/storage/box/guncase/pumpshotgun/special/fill_preset_inventory()
new /obj/item/weapon/gun/shotgun/pump(src)
new /obj/item/ammo_magazine/shotgun/buckshot/special(src)

/obj/item/storage/box/guncase/mk45_automag
name = "\improper MK-45 Automagnum case"
desc = "A gun case containing the MK-45 'High-Power' Automagnum sidearm. While this weapon was rejected as a replacement for the M44 Combat Revolver, it is often back-issued to troops who prefer its powerful bullets over more common sidearms."
Expand Down Expand Up @@ -323,12 +330,6 @@
/obj/item/pamphlet/trait/vulture,
)

/obj/item/storage/box/guncase/vulture/update_icon()
if(LAZYLEN(contents))
icon_state = "guncase_blue"
else
icon_state = "guncase_blue_e"

/obj/item/storage/box/guncase/vulture/fill_preset_inventory()
var/obj/item/weapon/gun/boltaction/vulture/rifle = new(src)
new /obj/item/ammo_magazine/rifle/boltaction/vulture(src)
Expand Down
1 change: 1 addition & 0 deletions colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,7 @@
#include "code\game\objects\structures\flora.dm"
#include "code\game\objects\structures\girders.dm"
#include "code\game\objects\structures\grille.dm"
#include "code\game\objects\structures\gun_rack.dm"
#include "code\game\objects\structures\ice_caves.dm"
#include "code\game\objects\structures\inflatable.dm"
#include "code\game\objects\structures\janicart.dm"
Expand Down
Binary file modified icons/obj/items/storage.dmi
Binary file not shown.
Binary file added icons/obj/structures/gun_racks.dmi
Binary file not shown.
Loading
Loading