Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
silicons committed Oct 6, 2023
1 parent 8de1e3c commit 4d84c37
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
1 change: 0 additions & 1 deletion code/__DEFINES/inventory/carry_weight.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
/// How penalizing the default penalty curve is; lower is weaker slowdowns from overweight.
#define CARRY_WEIGHT_SCALING 2.5
/// For now, constant - bias factor; higher = skip more of the curve as soon as weight goes above strength

#define CARRY_WEIGHT_BIAS 1

//? Item Encumbrance defines
Expand Down
17 changes: 11 additions & 6 deletions code/__DEFINES/movespeed_modification.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! movespeed_modifier_flags
//* movespeed_modifier_flags
// None yet

//! calculation_type
//* calculation_type

/// just use multiplicative_slowdown
#define MOVESPEED_CALCULATION_HYPERBOLIC "hyperbolic"
Expand All @@ -20,7 +20,7 @@ DEFINE_ENUM(movespeed_modifier_calculation_type, list(
ENUM("Multiply", MOVESPEED_CALCULATION_MULTIPLY),
))

//! params for add_or_update_variable_movespeed_modifier
//* params for add_or_update_variable_movespeed_modifier

/// multiplicative_slowdown
#define MOVESPEED_PARAM_DELAY_MOD "delay"
Expand All @@ -31,13 +31,18 @@ DEFINE_ENUM(movespeed_modifier_calculation_type, list(
/// max_tiles_per_second_boost
#define MOVESPEED_PARAM_MAX_TILE_BOOST "max_tlies"

//! Priorities - Lower is applied first
//* Constants

/// minimum movespeed
#define MOVESPEED_ABSOLUTE_MINIMUM_TILES_PER_SECOND 0.25

//* Priorities - Lower is applied first

#define MOVESPEED_PRIORITY_DEFAULT 0
#define MOVESPEED_PRIORITY_CARRY_WEIGHT 10

//! Conflicts IDs
//* Conflicts IDs
// None yet

//! IDs
//* IDs
// None yet
1 change: 0 additions & 1 deletion code/modules/mob/physiology.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
/datum/global_physiology/proc/reset()
carry_strength = initial(carry_strength)
carry_factor = initial(carry_factor)
carry_exponent = initial(carry_exponent)

/datum/global_physiology/proc/apply(datum/physiology_modifier/modifier)
if(!isnull(modifier.carry_strength_add))
Expand Down
22 changes: 15 additions & 7 deletions code/modules/movespeed/movespeed_modifier.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,23 @@ Key procs

/**
* Returns new multiplicative movespeed after modification.
*
* The minimum move delay is always world.tick_lag. Attempting to go lower will result in the excess being cut.
* This is so math doesn't break down when something attempts to break through the asymptote at 0 for move delay to speed.
*/
/datum/movespeed_modifier/proc/apply_multiplicative(existing, mob/target)
if(!complex_calculation || (multiplicative_slowdown > 0)) // we aren't limiting how much things can slowdown.. yet.
return existing + multiplicative_slowdown
var/current_tiles = 10 / max(existing, world.tick_lag)
// multiplicative_slowdown is negative due to our first check
var/max_buff_to = max(existing + multiplicative_slowdown, 10 / absolute_max_tiles_per_second, 10 / (current_tiles + max_tiles_per_second_boost))
// never slow the user
return min(existing, max_buff_to)
switch(calculation_type)
if(MOVESPEED_CALCULATION_HYPERBOLIC)
return max(world.tick_lag, existing + multiplicative_slowdown)
if(MOVESPEED_CALCULATION_HYPERBOLIC_BOOST)
var/current_tiles = 10 / max(existing, world.tick_lag)
var/max_buff_to = max(existing + multiplicative_slowdown, 10 / absolute_max_tiles_per_second, 10 / (current_tiles + max_tiles_per_second_boost))
return max(world.tick_lag, min(existing, max_buff_to))
if(MOVESPEED_CALCULATION_MULTIPLY)
var/current_tiles = 10 / max(existing, world.tick_lag)
return max(world.tick_lag, 10 / (current_tiles * multiply_speed))
else
return existing

/**
* applies from params
Expand Down

0 comments on commit 4d84c37

Please sign in to comment.