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

Hoists cell support to /obj/item/gun, modular guns API #6740

Draft
wants to merge 37 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
95901ad
initial commit
silicons Jul 29, 2024
19224c7
i think i need to reboot
silicons Jul 29, 2024
4929bec
move files
silicons Jul 29, 2024
77cec69
unified cell handling
silicons Jul 29, 2024
1d0049b
slot def
silicons Jul 29, 2024
afd4b55
._.
silicons Jul 29, 2024
c258698
update
silicons Jul 29, 2024
7011eb0
lol, lmao
silicons Jul 30, 2024
493f858
Merge remote-tracking branch 'upstream/master' into projectiles-modul…
silicons Aug 1, 2024
632b726
translations
silicons Aug 1, 2024
e875dba
translations
silicons Aug 1, 2024
53f23ca
stub
silicons Aug 1, 2024
0375b1f
Merge branch 'projectiles-modular-system' into projectiles-modular-ma…
silicons Aug 2, 2024
a0ac1d7
change
silicons Aug 2, 2024
672fce9
stubs
silicons Aug 2, 2024
0abe9a1
stubs
silicons Aug 2, 2024
01c7213
stubs
silicons Aug 2, 2024
4a9f702
update
silicons Aug 2, 2024
5af52d2
modules, firing cycles
silicons Aug 2, 2024
b4551a7
remove suicide; snowflake code & unneeded on rp
silicons Aug 2, 2024
28772ab
perfect
silicons Aug 2, 2024
cb6d2c8
Merge remote-tracking branch 'upstream/master' into projectiles-modul…
silicons Sep 9, 2024
9dc6ea9
fix
silicons Sep 9, 2024
c7ef4e4
that
silicons Sep 9, 2024
d609695
firing cycle
silicons Sep 9, 2024
1407a61
progres
silicons Sep 9, 2024
66253ba
sigh, launcher crap.
silicons Sep 10, 2024
f62797d
Merge remote-tracking branch 'upstream/master' into projectiles-modul…
silicons Sep 10, 2024
83060d0
that
silicons Sep 10, 2024
a39faf3
modifications, push stuff around
silicons Sep 10, 2024
a209804
that
silicons Sep 10, 2024
f3db596
get rid of unticked file and move another
silicons Sep 10, 2024
b093e30
sigh
silicons Sep 10, 2024
ac1f08c
Fix
silicons Sep 11, 2024
29a95cd
that
silicons Sep 13, 2024
cbf2976
sigh
silicons Sep 13, 2024
e620ac6
That
silicons Sep 13, 2024
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
54 changes: 34 additions & 20 deletions citadel.dme
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,9 @@
#include "code\__DEFINES\procs\update_icon.dm"
#include "code\__DEFINES\projectiles\ammo_casing.dm"
#include "code\__DEFINES\projectiles\ammo_magazine.dm"
#include "code\__DEFINES\projectiles\gun_components.dm"
#include "code\__DEFINES\projectiles\guns.dm"
#include "code\__DEFINES\projectiles\guns_legacy.dm"
#include "code\__DEFINES\projectiles\projectile.dm"
#include "code\__DEFINES\projectiles\system.dm"
#include "code\__DEFINES\radiation\flags.dm"
Expand Down Expand Up @@ -1069,6 +1071,7 @@
#include "code\game\content\factions\corporations\gorlex\items\guns\wild_hunt.dm"
#include "code\game\content\factions\corporations\nanotrasen\nanotrasen-faction.dm"
#include "code\game\content\factions\corporations\nanotrasen\nanotrasen-supply.dm"
#include "code\game\content\factions\corporations\nanotrasen\items\guns\nt_protomag.dm"
#include "code\game\content\factions\corporations\nanotrasen\items\guns\pulse.dm"
#include "code\game\content\factions\corporations\nanotrasen\nanotrasen-supply\animals.dm"
#include "code\game\content\factions\corporations\nanotrasen\nanotrasen-supply\atmospherics.dm"
Expand Down Expand Up @@ -4385,12 +4388,9 @@
#include "code\modules\preferences\preference_setup\vore\08_traits.dm"
#include "code\modules\preferences\preference_setup\vore\09_nif.dm"
#include "code\modules\preferences\preference_setup\vore\10_misc.dm"
#include "code\modules\projectiles\firing_pin.dm"
#include "code\modules\projectiles\gun.dm"
#include "code\modules\projectiles\gun_item_renderer.dm"
#include "code\modules\projectiles\gun_mob_renderer.dm"
#include "code\modules\projectiles\ammunition\ammo_caliber.dm"
#include "code\modules\projectiles\ammunition\ammo_casing.dm"
#include "code\modules\projectiles\ammunition\ammo_handful.dm"
#include "code\modules\projectiles\ammunition\ammo_magazine.dm"
#include "code\modules\projectiles\ammunition\calibers\normal\a10g.dm"
#include "code\modules\projectiles\ammunition\calibers\normal\a10mm.dm"
Expand Down Expand Up @@ -4421,9 +4421,34 @@
#include "code\modules\projectiles\ammunition\calibers\special\rocket.dm"
#include "code\modules\projectiles\guns\ballistic.dm"
#include "code\modules\projectiles\guns\energy.dm"
#include "code\modules\projectiles\guns\firing_pin.dm"
#include "code\modules\projectiles\guns\gun-firing.dm"
#include "code\modules\projectiles\guns\gun-modular.dm"
#include "code\modules\projectiles\guns\gun-projectile-implementation.dm"
#include "code\modules\projectiles\guns\gun.dm"
#include "code\modules\projectiles\guns\gun_component.dm"
#include "code\modules\projectiles\guns\gun_item_renderer.dm"
#include "code\modules\projectiles\guns\gun_mob_renderer.dm"
#include "code\modules\projectiles\guns\launcher.dm"
#include "code\modules\projectiles\guns\magic.dm"
#include "code\modules\projectiles\guns\magnetic.dm"
#include "code\modules\projectiles\guns\vox.dm"
#include "code\modules\projectiles\guns\ballistic\automatic.dm"
#include "code\modules\projectiles\guns\ballistic\boltaction.dm"
#include "code\modules\projectiles\guns\ballistic\bow.dm"
#include "code\modules\projectiles\guns\ballistic\caseless.dm"
#include "code\modules\projectiles\guns\ballistic\contender.dm"
#include "code\modules\projectiles\guns\ballistic\dartgun.dm"
#include "code\modules\projectiles\guns\ballistic\magnetic.dm"
#include "code\modules\projectiles\guns\ballistic\musket.dm"
#include "code\modules\projectiles\guns\ballistic\pistol.dm"
#include "code\modules\projectiles\guns\ballistic\revolver.dm"
#include "code\modules\projectiles\guns\ballistic\rocket.dm"
#include "code\modules\projectiles\guns\ballistic\semiauto.dm"
#include "code\modules\projectiles\guns\ballistic\shotgun.dm"
#include "code\modules\projectiles\guns\ballistic\sniper.dm"
#include "code\modules\projectiles\guns\ballistic\caseless\pellet.dm"
#include "code\modules\projectiles\guns\ballistic\sniper\collapsible_sniper.dm"
#include "code\modules\projectiles\guns\ballistic\microbattery\medigun.dm"
#include "code\modules\projectiles\guns\ballistic\microbattery\medigun_cells.dm"
#include "code\modules\projectiles\guns\ballistic\microbattery\microbattery-casing.dm"
Expand All @@ -4450,6 +4475,11 @@
#include "code\modules\projectiles\guns\energy\modular\modularlenses.dm"
#include "code\modules\projectiles\guns\energy\modular\modularpower.dm"
#include "code\modules\projectiles\guns\energy\special\hardlight_bow.dm"
#include "code\modules\projectiles\guns\gun_component\acceleration_coil.dm"
#include "code\modules\projectiles\guns\gun_component\active_cooler.dm"
#include "code\modules\projectiles\guns\gun_component\energy_handler.dm"
#include "code\modules\projectiles\guns\gun_component\internal_module.dm"
#include "code\modules\projectiles\guns\gun_component\power_unit.dm"
#include "code\modules\projectiles\guns\launcher\crossbow.dm"
#include "code\modules\projectiles\guns\launcher\grenade_launcher.dm"
#include "code\modules\projectiles\guns\launcher\pneumatic.dm"
Expand All @@ -4466,24 +4496,8 @@
#include "code\modules\projectiles\guns\magic\staff.dm"
#include "code\modules\projectiles\guns\magic\wand.dm"
#include "code\modules\projectiles\guns\magnetic\bore.dm"
#include "code\modules\projectiles\guns\magnetic\magnetic.dm"
#include "code\modules\projectiles\guns\magnetic\magnetic_construction.dm"
#include "code\modules\projectiles\guns\magnetic\magnetic_railgun.dm"
#include "code\modules\projectiles\guns\projectile\automatic.dm"
#include "code\modules\projectiles\guns\projectile\boltaction.dm"
#include "code\modules\projectiles\guns\projectile\bow.dm"
#include "code\modules\projectiles\guns\projectile\caseless.dm"
#include "code\modules\projectiles\guns\projectile\contender.dm"
#include "code\modules\projectiles\guns\projectile\dartgun.dm"
#include "code\modules\projectiles\guns\projectile\musket.dm"
#include "code\modules\projectiles\guns\projectile\pistol.dm"
#include "code\modules\projectiles\guns\projectile\revolver.dm"
#include "code\modules\projectiles\guns\projectile\rocket.dm"
#include "code\modules\projectiles\guns\projectile\semiauto.dm"
#include "code\modules\projectiles\guns\projectile\shotgun.dm"
#include "code\modules\projectiles\guns\projectile\sniper.dm"
#include "code\modules\projectiles\guns\projectile\caseless\pellet.dm"
#include "code\modules\projectiles\guns\projectile\sniper\collapsible_sniper.dm"
#include "code\modules\projectiles\projectile\arc.dm"
#include "code\modules\projectiles\projectile\helpers.dm"
#include "code\modules\projectiles\projectile\projectile-hitscan_visuals.dm"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) Citadel Station Developers *//
//* Copyright (c) 2024 Citadel Station Developers *//

// todo: integrity signals?

Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/projectiles/ammo_casing.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 silicons *//
//* Copyright (c) 2024 Citadel Station Developers *//

//* /obj/item/ammo_casing casing_flags *//

Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/projectiles/ammo_magazine.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 silicons *//
//* Copyright (c) 2024 Citadel Station Developers *//

//* /obj/item/ammo_magazine magazine_type

Expand Down
55 changes: 55 additions & 0 deletions code/__DEFINES/projectiles/gun_components.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 Citadel Station Developers *//

//* Slots - /obj/item/gun_component *//

//* Note: These are all suggestions. *//
//* Components hook the gun via component signals and registration APIs *//
//* An acceleration coil can hook power draw just like a power unit can. *//

//* All components are defaulted. This is for UX and optimization. *//
//* Unless a gun otherwise specifies, not having a component just means 'no change'. *//
//* *//
//* This is because components are not actually hardcoded APIs that are called *//
//* during firing, but actually modifiers onto the gun. *//
//* *//
//* This is a large departure from traditional guncrafting systems that necessitate *//
//* invoking procs on all components every cycle. *//

// todo: DEFINE_ENUM on everything

//* - generic - all weaponry -- *//

/// any internal modules like trackers, etc
#define GUN_COMPONENT_INTERNAL_MODULE "internal-module"

//* - generic - all energy-based weaponry -- *//

/// interacts with energizing the beam lens / acceleration coils
#define GUN_COMPONENT_ENERGY_HANDLER "energy-handler"
/// interacts with power draw
#define GUN_COMPONENT_POWER_UNIT "power-unit"
/// a ballistic gun can have this but these generally require power to function
#define GUN_COMPONENT_ACTIVE_COOLER "active-cooler"

//* - generally magnetic - *//

/// component used for accelerating the projectile.
#define GUN_COMPONENT_ACCELERATION_COIL "magnetic-coil"

//* - generally particle (energy) - *//

/// component used to (re)-focus the energy beam being emit
#define GUN_COMPONENT_FOCUSING_LENS "focusing-lens"
/// component that generates the particle stream
#define GUN_COMPONENT_PARTICLE_ARRAY "particle-array"

GLOBAL_REAL_LIST(gun_component_enum_to_name) = list(
GUN_COMPONENT_INTERNAL_MODULE = "internal module",
GUN_COMPONENT_ENERGY_HANDLER = "energy handler",
GUN_COMPONENT_POWER_UNIT = "power unit",
GUN_COMPONENT_ACTIVE_COOLER = "cooling system",
GUN_COMPONENT_ACCELERATION_COIL = "acceleration coil",
GUN_COMPONENT_FOCUSING_LENS = "focusing lens",
GUN_COMPONENT_PARTICLE_ARRAY = "particle array",
)
60 changes: 33 additions & 27 deletions code/__DEFINES/projectiles/guns.dm
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
///do not do anything after firing. Manual action, like pump shotguns, or guns that want to define custom behaviour
#define HOLD_CASINGS 0
///drop spent casings on the ground after firing
#define EJECT_CASINGS 2
///cycle casings, like a revolver. Also works for multibarrelled guns
#define CYCLE_CASINGS 3
//Gun loading types
///The gun only accepts ammo_casings. ammo_magazines should never have this as their mag_type.
#define SINGLE_CASING 1
///Transfers casings from the mag to the gun when used.
#define SPEEDLOADER 2
///The magazine item itself goes inside the gun
#define MAGAZINE 4
#define BULLET_IMPACT_NONE "none"
#define BULLET_IMPACT_METAL "metal"
#define BULLET_IMPACT_MEAT "meat"
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 Citadel Station Developers *//

#define SOUNDS_BULLET_MEAT list('sound/effects/projectile_impact/bullet_meat1.ogg', 'sound/effects/projectile_impact/bullet_meat2.ogg', 'sound/effects/projectile_impact/bullet_meat3.ogg', 'sound/effects/projectile_impact/bullet_meat4.ogg')
#define SOUNDS_BULLET_METAL list('sound/effects/projectile_impact/bullet_metal1.ogg', 'sound/effects/projectile_impact/bullet_metal2.ogg', 'sound/effects/projectile_impact/bullet_metal3.ogg')
#define SOUNDS_LASER_MEAT list('sound/effects/projectile_impact/energy_meat1.ogg','sound/effects/projectile_impact/energy_meat2.ogg')
#define SOUNDS_LASER_METAL list('sound/effects/projectile_impact/energy_metal1.ogg','sound/effects/projectile_impact/energy_metal2.ogg')
//* firing_flags on gun firing procs *//

// safety states
/// no safeties are on this gun
#define GUN_NO_SAFETY -1
/// safety off
#define GUN_SAFETY_OFF 0
/// safety on
#define GUN_SAFETY_ON 1
/// perform pointblanking
#define GUN_FIRING_POINT_BLANK (1<<0)
/// track the target instead of just using angle
#define GUN_FIRING_TRACK_TARGET (1<<1)
/// this is a reflex fire by aiming
#define GUN_FIRING_BY_REFLEX (1<<2)
/// do not log
///
/// * This is an extremely dangerous flag. Do not use unless you are already logging it somewhere else.
/// * "This happens all the time" is not a valid excuse to not log a gunshot.
#define GUN_FIRING_NO_LOGGING (1<<3)
/// do not call default click empty
#define GUN_FIRING_NO_CLICK_EMPTY (1<<4)
/// suppressed shot
#define GUN_FIRING_SUPPRESSED (1<<5)

//* firing result from firing procs *//
//* these are flags but should be returned only one at a time. *//
//* they are flags for fast comparisons. *//

/// fired
#define GUN_FIRED_SUCCESS 0
/// unknown failure
#define GUN_FIRED_FAIL_UNKNOWN (1<<0)
/// failed - round wasn't live or the right primer type
#define GUN_FIRED_FAIL_INERT (1<<1)
/// failed - out of ammo
#define GUN_FIRED_FAIL_EMPTY (1<<2)
/// failed - we're no longer being held / mounted / whatever
#define GUN_FIRED_FAIL_UNMOUNTED (1<<3)
29 changes: 29 additions & 0 deletions code/__DEFINES/projectiles/guns_legacy.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
///do not do anything after firing. Manual action, like pump shotguns, or guns that want to define custom behaviour
#define HOLD_CASINGS 0
///drop spent casings on the ground after firing
#define EJECT_CASINGS 2
///cycle casings, like a revolver. Also works for multibarrelled guns
#define CYCLE_CASINGS 3
//Gun loading types
///The gun only accepts ammo_casings. ammo_magazines should never have this as their mag_type.
#define SINGLE_CASING 1
///Transfers casings from the mag to the gun when used.
#define SPEEDLOADER 2
///The magazine item itself goes inside the gun
#define MAGAZINE 4
#define BULLET_IMPACT_NONE "none"
#define BULLET_IMPACT_METAL "metal"
#define BULLET_IMPACT_MEAT "meat"

#define SOUNDS_BULLET_MEAT list('sound/effects/projectile_impact/bullet_meat1.ogg', 'sound/effects/projectile_impact/bullet_meat2.ogg', 'sound/effects/projectile_impact/bullet_meat3.ogg', 'sound/effects/projectile_impact/bullet_meat4.ogg')
#define SOUNDS_BULLET_METAL list('sound/effects/projectile_impact/bullet_metal1.ogg', 'sound/effects/projectile_impact/bullet_metal2.ogg', 'sound/effects/projectile_impact/bullet_metal3.ogg')
#define SOUNDS_LASER_MEAT list('sound/effects/projectile_impact/energy_meat1.ogg','sound/effects/projectile_impact/energy_meat2.ogg')
#define SOUNDS_LASER_METAL list('sound/effects/projectile_impact/energy_metal1.ogg','sound/effects/projectile_impact/energy_metal2.ogg')

// safety states
/// no safeties are on this gun
#define GUN_NO_SAFETY -1
/// safety off
#define GUN_SAFETY_OFF 0
/// safety on
#define GUN_SAFETY_ON 1
2 changes: 1 addition & 1 deletion code/__DEFINES/projectiles/projectile.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 silicons *//
//* Copyright (c) 2024 Citadel Station Developers *//

//* pre_impact(), impact(), bullet_act(), on_impact() impact_flags *//
/// pre_impact, bullet_act, on_impact are called in that order ///
Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/projectiles/system.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 silicons *//
//* Copyright (c) 2024 Citadel Station Developers *//

//* rendering system
//* this is currently only used on ammo magazines, as guns use composition of datums
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/items/active_parry.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) Citadel Station Developers *//
//* Copyright (c) 2024 Citadel Station Developers *//

/**
* generic parry provider on items
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/items/passive_parry.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) Citadel Station Developers *//
//* Copyright (c) 2024 Citadel Station Developers *//

/**
* Shieldcall used as a listener for [/datum/component/passive_parry]
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/items/shield_block.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) Citadel Station Developers *//
//* Copyright (c) 2024 Citadel Station Developers *//

/**
* generic shield-like block provider on items
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/mobs/block_frame.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) Citadel Station Developers *//
//* Copyright (c) 2024 Citadel Station Developers *//

/**
* ## Active Defensives
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/mobs/parry_frame.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) Citadel Station Developers *//
//* Copyright (c) 2024 Citadel Station Developers *//

/**
* ## Active Parry
Expand Down
Loading
Loading