Skip to content

Commit

Permalink
combat code overhaul + projectiles v8: impact handling (#6579)
Browse files Browse the repository at this point in the history
  • Loading branch information
silicons authored Sep 2, 2024
1 parent 2f758a1 commit 2533cae
Show file tree
Hide file tree
Showing 437 changed files with 9,340 additions and 6,546 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/size_labeling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: size-label
uses: pascalgn/size-label-action@v0.4.3
uses: pascalgn/size-label-action@v0.5.4
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
IGNORED: "**/*.bundle.*\n**/*.chunk.*" # **/*.dmm\n
133 changes: 84 additions & 49 deletions citadel.dme

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions code/__DEFINES/_core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
/// * put the stack trace in stack trace storage
#define stack_trace(message) _stack_trace(message, __FILE__, __LINE__)

/// get variable if not null or
#define VALUE_OR_DEFAULT(VAL, DEFAULT) (isnull(VAL)? (DEFAULT) : (VAL))

/// byond bug https://secure.byond.com/forum/?post=2072419
#define BLOCK_BYOND_BUG_2072419
8 changes: 6 additions & 2 deletions code/__DEFINES/_flags/atom_flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ DEFINE_BITFIELD(atom_flags, list(
#define MOVABLE_NO_THROW_DAMAGE_SCALING (1<<1)
/// Do not spin when thrown.
#define MOVABLE_NO_THROW_SPIN (1<<2)
/// We are currently about to be yanked by a Moved() triggering a Move()
/// We are currently about to be yanked by a Moved(), Entered(), or Exited() triggering a Move()
///
/// * used so things like projectile hitscans know to yield
#define MOVABLE_IN_MOVED_YANK (1<<3)
Expand All @@ -85,11 +85,13 @@ DEFINE_BITFIELD(movable_flags, list(
#define ATOM_PASS_OVERHEAD_THROW (1<<7)
/// let buckled mobs pass always
#define ATOM_PASS_BUCKLED (1<<8)
/// "please don't interact with us"
#define ATOM_PASS_INCORPOREAL (1<<9)

/// all actual pass flags / maximum pass
#define ATOM_PASS_ALL (ATOM_PASS_TABLE | ATOM_PASS_GLASS | ATOM_PASS_GRILLE | \
ATOM_PASS_BLOB | ATOM_PASS_MOB | ATOM_PASS_THROWN | ATOM_PASS_CLICK | \
ATOM_PASS_OVERHEAD_THROW | ATOM_PASS_BUCKLED)
ATOM_PASS_OVERHEAD_THROW | ATOM_PASS_BUCKLED | ATOM_PASS_INCORPOREAL)

DEFINE_BITFIELD(pass_flags, list(
BITFIELD(ATOM_PASS_TABLE),
Expand All @@ -101,6 +103,7 @@ DEFINE_BITFIELD(pass_flags, list(
BITFIELD(ATOM_PASS_CLICK),
BITFIELD(ATOM_PASS_OVERHEAD_THROW),
BITFIELD(ATOM_PASS_BUCKLED),
BITFIELD(ATOM_PASS_INCORPOREAL),
))

DEFINE_BITFIELD(pass_flags_self, list(
Expand All @@ -113,6 +116,7 @@ DEFINE_BITFIELD(pass_flags_self, list(
BITFIELD(ATOM_PASS_CLICK),
BITFIELD(ATOM_PASS_OVERHEAD_THROW),
BITFIELD(ATOM_PASS_BUCKLED),
BITFIELD(ATOM_PASS_INCORPOREAL),
))

//? /atom/movable movement_type - only one primary type should be on the atom at a time, but these are flags for quick checks.
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/_planes+layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
#define STAIRS_LAYER (TURF_LAYER+0.5) /// Layer for stairs.
#define DOOR_OPEN_LAYER (TURF_LAYER+0.7) /// Under all objects if opened. 2.7 due to tables being at 2.6.
#define TABLE_LAYER (TURF_LAYER+0.8) /// Just under stuff that wants to be slightly below common objects.
/// Below this layer, projectiles won't collide with things unless it's a directly clicked target.
#define PROJECTILE_HIT_THRESHOLD_LAYER 2.8
#define UNDER_JUNK_LAYER (TURF_LAYER+0.9) /// Things that want to be slightly below common objects.

Expand Down
6 changes: 4 additions & 2 deletions code/__DEFINES/callbacks.dm
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/// Arbitrary sentinel value for global proc callbacks
#define GLOBAL_PROC "some_magic_bullshit"
/// Arbitrary sentinel value for making sure a callback didn't sleep
#define CALLBACK_SLEEP_SENTINEL "___THE PROC SLEPT___"
/// A shorthand for the callback datum, [documented here](datum/callback.html)
#define CALLBACK new /datum/callback
///Per the DM reference, spawn(-1) will execute the spawned code immediately until a block is met.
/// Per the DM reference, spawn(-1) will execute the spawned code immediately until a block is met.
#define MAKE_SPAWN_ACT_LIKE_WAITFOR -1
///Create a codeblock that will not block the callstack if a block is met.
/// Create a codeblock that will not block the callstack if a block is met.
#define ASYNC spawn(MAKE_SPAWN_ACT_LIKE_WAITFOR)

#define INVOKE_ASYNC(proc_owner, proc_path, proc_arguments...) \
Expand Down
64 changes: 44 additions & 20 deletions code/__DEFINES/combat/armor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,26 @@ GLOBAL_REAL_LIST(armor_enums) = list(
ARMOR_ACID,
)

GLOBAL_REAL_LIST(armor_types) = list(
ARMOR_MELEE,
ARMOR_BULLET,
ARMOR_LASER,
ARMOR_ENERGY,
ARMOR_BOMB,
ARMOR_BIO,
ARMOR_RAD,
ARMOR_FIRE,
ARMOR_ACID,
)

//? --- armor tiers ---

#define ARMOR_TIER_DEFAULT 0
#define ARMOR_TIER_DEFAULT ARMOR_TIER_BASELINE

#define ARMOR_TIER_LAUGHABLE -3
#define ARMOR_TIER_LOW -2
#define ARMOR_TIER_BELOW -1
#define ARMOR_TIER_NORMAL 0
#define ARMOR_TIER_BASELINE 0
#define ARMOR_TIER_ABOVE 1
#define ARMOR_TIER_HIGH 2
#define ARMOR_TIER_OVERWHELMING 3
Expand All @@ -76,37 +88,49 @@ GLOBAL_REAL_LIST(armor_enums) = list(

//? melee

#define MELEE_TIER_DEFAULT ARMOR_TIER_DEFAULT
#define MELEE_TIER_DEFAULT MELEE_TIER_MEDIUM

#define MELEE_TIER_UNARMED_DEFAULT ARMOR_TIER_LOW
#define MELEE_TIER_UNARMED_FISTS ARMOR_TIER_LOW
#define MELEE_TIER_UNARMED_CLAW ARMOR_TIER_BELOW
#define MELEE_TIER_LIGHT ARMOR_TIER_DEFAULT
#define MELEE_TIER_LIGHT ARMOR_TIER_BASELINE
#define MELEE_TIER_MEDIUM ARMOR_TIER_ABOVE
#define MELEE_TIER_HEAVY ARMOR_TIER_HIGH
#define MELEE_TIER_EXTREME ARMOR_TIER_OVERWHELMING

//? bullet

#define BULLET_TIER_DEFAULT ARMOR_TIER_DEFAULT

#define BULLET_TIER_LAUGHABLE ARMOR_TIER_BELOW //! super improvised rounds / pistols / whatever.
#define BULLET_TIER_LOW ARMOR_TIER_DEFAULT //! pistols
#define BULLET_TIER_MEDIUM ARMOR_TIER_ABOVE //! smgs
#define BULLET_TIER_HIGH ARMOR_TIER_HIGH //! rifles
#define BULLET_TIER_EXTREME ARMOR_TIER_OVERWHELMING //! lmgs, light mech weapons
#define BULLET_TIER_RIDICULOUS ARMOR_TIER_RIDICULOUS //! heavy mech weapons
#define BULLET_TIER_DEFAULT BULLET_TIER_MEDIUM

/// super improvised rounds / pistols / whatever.
#define BULLET_TIER_LAUGHABLE ARMOR_TIER_BELOW
/// pistols
#define BULLET_TIER_LOW ARMOR_TIER_BASELINE
/// smgs
#define BULLET_TIER_MEDIUM ARMOR_TIER_ABOVE
/// rifles
#define BULLET_TIER_HIGH ARMOR_TIER_HIGH
/// lmgs, light mech weapons
#define BULLET_TIER_EXTREME ARMOR_TIER_OVERWHELMING
/// heavy mech weapons
#define BULLET_TIER_RIDICULOUS ARMOR_TIER_RIDICULOUS

//? laser

#define LASER_TIER_DEFAULT ARMOR_TIER_DEFAULT

#define LASER_TIER_LAUGHABLE ARMOR_TIER_BELOW //! improvised laser focis / etc
#define LASER_TIER_LOW ARMOR_TIER_DEFAULT //! low tier lasers
#define LASER_TIER_MEDIUM ARMOR_TIER_ABOVE //! laser carbines, energy guns, etc
#define LASER_TIER_HIGH ARMOR_TIER_HIGH //! x-ray rifles, snipers
#define LASER_TIER_EXTREME ARMOR_TIER_OVERWHELMING //! mech weapons, usualy
#define LASER_TIER_RIDICULOUS ARMOR_TIER_RIDICULOUS //! power transmission laser?
#define LASER_TIER_DEFAULT LASER_TIER_MEDIUM

/// improvised laser focis / etc
#define LASER_TIER_LAUGHABLE ARMOR_TIER_BELOW
/// low tier lasers
#define LASER_TIER_LOW ARMOR_TIER_BASELINE
/// laser carbines, energy guns, etc
#define LASER_TIER_MEDIUM ARMOR_TIER_ABOVE
/// x-ray rifles, snipers
#define LASER_TIER_HIGH ARMOR_TIER_HIGH
/// mech weapons, usualy
#define LASER_TIER_EXTREME ARMOR_TIER_OVERWHELMING
/// power transmission laser?
#define LASER_TIER_RIDICULOUS ARMOR_TIER_RIDICULOUS

//? --- armor calculations ---

Expand Down
7 changes: 7 additions & 0 deletions code/__DEFINES/combat/attack_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@
#define ATTACK_TYPE_THROWN (1<<2)
/// damage source is /mob
#define ATTACK_TYPE_UNARMED (1<<3)
/// we're being contacted by something
///
/// * used internally by parry frames, mostly
/// * damage source is null
#define ATTACK_TYPE_TOUCH (1<<4)
/// a damage instance created by a block / parry frame transmuting damage and passing it to the user
#define ATTACK_TYPE_DEFENSIVE_PASSTHROUGH (1<<5)
4 changes: 1 addition & 3 deletions code/__DEFINES/combat/explosions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@
#define LEGACY_EXPLOSION_SEVERE_POWER EXPLOSION_CONSTANT_SEVERE
#define LEGACY_EXPLOSION_MINOR_POWER EXPLOSION_CONSTANT_MINOR

#define LEGACY_EXPLOSION_DEVASTATE_INTEGRITY 1000
#define LEGACY_EXPLOSION_DEVASTATE_INTEGRITY 500
#define LEGACY_EXPLOSION_SEVERE_INTEGRITY 180
#define LEGACY_EXPLOSION_MINOR_INTEGRITY 50
#define LEGACY_EXPLOSION_INTEGRITY_MULT (0.01 * rand(50, 200))

// why the extra numbers? so if someone does weird math we don't out of bounds
GLOBAL_REAL(_legacy_expowers, /list) = list(
Expand All @@ -47,7 +46,6 @@ GLOBAL_REAL(_legacy_ex_atom_damage, /list) = list(
0
)

#define LEGACY_EXPLOSION_ATOM_DAMAGE(P) (global._legacy_ex_atom_damage[P] * LEGACY_EXPLOSION_INTEGRITY_MULT)

// this works out becuase epxlosions are 1-3 in legacy, so we can just use it as list indices
#define LEGACY_EX_ACT(ATOM, POWER, TARGET) ATOM.legacy_ex_act(POWER, TARGET); ATOM.ex_act(_legacy_expowers[POWER]);
Loading

0 comments on commit 2533cae

Please sign in to comment.