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

Prop gun effect #4450

Merged
merged 8 commits into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions code/game/objects/effects/spawners/prop_gun_spawner.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/obj/effect/spawner/prop_gun //Makes a prop that looks similar to the original gun, for use such as broken guns
name = "prop gun spawner"
icon = 'icons/landmarks.dmi'
icon_state = "prop_gun"
///The typepath of the gun the prop will copy
var/obj/item/weapon/gun/prop_gun_type = /obj/item/weapon/gun
///if the prop will have a custom name
var/custom_gun_name
///if the prob will have a custom desc
var/custom_gun_desc
///The probability of the prop gun spawning
var/spawn_prob = 100

/obj/effect/spawner/prop_gun/Initialize(mapload, ...)
. = ..()
if(!ispath(prop_gun_type, /obj/item/weapon/gun))
stack_trace("[src] using incorrect typepath, \"[prop_gun_type]\".") //Can't make a prop gun of something not a gun
qdel(src)
return
if(!spawn_prob)
qdel(src)
return
if(!mapload)
prepare_gun_skin()
return
return INITIALIZE_HINT_ROUNDSTART

/obj/effect/spawner/prop_gun/LateInitialize()
prepare_gun_skin()

///Spawns the items and modifies source to set skin on prop
/obj/effect/spawner/prop_gun/proc/prepare_gun_skin()
///The source, which the skin will be copied from
var/obj/item/weapon/gun/source_gun = new prop_gun_type(src)
if(custom_gun_name)
source_gun.name = custom_gun_name
if(custom_gun_desc)
source_gun.desc = custom_gun_desc
source_gun.pixel_x = pixel_x
source_gun.pixel_y = pixel_y
source_gun.layer = layer

///The prop itself, which the skin will be copied to
var/obj/item/prop/prop_gun/prop_gun = new /obj/item/prop/prop_gun(loc)
prop_gun.set_gun_skin(source_gun)
qdel(src)

/obj/item/prop/prop_gun
name = "prop gun"
desc = "A non-functional gun prop. You should not be able to see this."
icon = 'icons/landmarks.dmi'
icon_state = "prop_gun"
flags_item = TWOHANDED
pickup_sound = "gunequip"
drop_sound = "gunrustle"
pickupvol = 7
dropvol = 15

///Makes the gun look similar to the source, using the source as an atom reference
/obj/item/prop/prop_gun/proc/set_gun_skin(obj/item/weapon/gun/source_gun)
if(!source_gun)
return
name = source_gun.name
desc = source_gun.desc
icon = source_gun.icon
item_icons = source_gun.item_icons
icon_state = source_gun.icon_state
item_state = source_gun.item_state
w_class = source_gun.w_class
flags_equip_slot = source_gun.flags_equip_slot
pixel_x = source_gun.pixel_x
pixel_y = source_gun.pixel_y
layer = source_gun.layer

/obj/item/prop/prop_gun/attack_self(mob/user) //Mimic wielding of real guns
. = ..()
if(!(flags_item & TWOHANDED))
return
if(flags_item & WIELDED)
unwield(user)
else
wield(user)

/obj/item/prop/prop_gun/dropped(mob/user)
..()
unwield(user)

/obj/effect/spawner/prop_gun/m41aMK1
prop_gun_type = /obj/item/weapon/gun/rifle/m41aMK1
custom_gun_name = "\improper Broken M41A pulse rifle"
custom_gun_desc = "An older design of the Pulse Rifle commonly used by Colonial Marines. This one has seen better days. The trigger is missing, the barrel is bent, and it no longer appropriately feeds magazines."
3 changes: 2 additions & 1 deletion code/modules/clothing/suits/marine_armor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
siemens_coefficient = 0.7
slowdown = SLOWDOWN_ARMOR_MEDIUM
allowed = list(
/obj/item/weapon/gun/,
/obj/item/weapon/gun,
/obj/item/prop/prop_gun,
/obj/item/tank/emergency_oxygen,
/obj/item/device/flashlight,
/obj/item/storage/fancy/cigarettes,
Expand Down
1 change: 1 addition & 0 deletions colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,7 @@ s// DM Environment file for colonialmarines.dme.
#include "code\game\objects\effects\landmarks\structure_spawners\structure_spawner.dm"
#include "code\game\objects\effects\landmarks\structure_spawners\xvx_hive.dm"
#include "code\game\objects\effects\spawners\gibspawner.dm"
#include "code\game\objects\effects\spawners\prop_gun_spawner.dm"
#include "code\game\objects\effects\spawners\random.dm"
#include "code\game\objects\effects\spawners\spawner.dm"
#include "code\game\objects\effects\spawners\vaultspawner.dm"
Expand Down
Binary file modified icons/landmarks.dmi
Binary file not shown.
7 changes: 1 addition & 6 deletions maps/map_files/USS_Almayer/USS_Almayer.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -69824,12 +69824,7 @@
pixel_y = 2
},
/obj/structure/largecrate/random/case,
/obj/item/prop{
desc = "An older design of the Pulse Rifle commonly used by Colonial Marines. This one has seen better days. The trigger is missing, the barrel is bent, and it no longer appropriately feeds magazines.";
icon = 'icons/obj/items/weapons/guns/guns_by_faction/uscm.dmi';
icon_state = "m41amk1_e";
item_state = "m41amk1";
name = "\improper Broken M41A pulse rifle";
/obj/effect/spawner/prop_gun/m41aMK1{
BeagleGaming1 marked this conversation as resolved.
Show resolved Hide resolved
pixel_y = 7
},
/obj/item/prop/helmetgarb/gunoil{
Expand Down