mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 18:02:57 +00:00
fix
This commit is contained in:
@@ -40,6 +40,7 @@ GLOBAL_LIST_EMPTY(sentient_disease_instances)
|
||||
GLOBAL_LIST_EMPTY(latejoin_ai_cores)
|
||||
|
||||
GLOBAL_LIST_EMPTY(mob_config_movespeed_type_lookup)
|
||||
GLOBAL_LIST_EMPTY(mob_config_movespeed_type_lookup_floating)
|
||||
|
||||
GLOBAL_LIST_EMPTY(latejoiners) //CIT CHANGE - All latejoining people, for traitor-target purposes.
|
||||
|
||||
@@ -47,14 +48,22 @@ GLOBAL_LIST_EMPTY(latejoiners) //CIT CHANGE - All latejoining people, for traito
|
||||
// NOTE: This is entirely based on the fact that byond typesof/subtypesof gets longer/deeper paths before shallower ones.
|
||||
// If that ever breaks this entire proc breaks.
|
||||
var/list/mob_types = typesof(/mob)
|
||||
var/list/entry_value = CONFIG_GET(keyed_list/multiplicative_movespeed)
|
||||
var/list/mob_types_floating = typesof(/mob)
|
||||
var/list/entry_value = CONFIG_GET(keyed_list/multiplicative_movespeed/normal)
|
||||
var/list/entry_value_floating = CONFIG_GET(keyed_list/multiplicative_movespeed/floating)
|
||||
var/list/configured_types = list()
|
||||
var/list/configured_types_floating = list()
|
||||
for(var/path in entry_value)
|
||||
var/value = entry_value[path]
|
||||
if(isnull(value))
|
||||
continue
|
||||
// associative list sets for elements that already exist preserve order
|
||||
mob_types[path] = value
|
||||
for(var/path in entry_value_floating)
|
||||
var/value = entry_value_floating[path]
|
||||
if(isnull(value))
|
||||
continue
|
||||
mob_types_floating[path] = value
|
||||
// now go back up through it to set everything, making absolute sure that base paths are overridden by child paths all the way down the path tree.
|
||||
for(var/i in length(mob_types) to 1 step -1)
|
||||
var/path = mob_types[i]
|
||||
@@ -63,7 +72,14 @@ GLOBAL_LIST_EMPTY(latejoiners) //CIT CHANGE - All latejoining people, for traito
|
||||
// we're going from bottom to top so it should be safe to do this without further checks..
|
||||
for(var/subpath in typesof(path))
|
||||
configured_types[subpath] = mob_types[path]
|
||||
for(var/i in length(mob_types_floating) to 1 step -1)
|
||||
var/path = mob_types_floating[i]
|
||||
if(isnull(mob_types_floating[path]))
|
||||
continue
|
||||
for(var/subpath in typesof(path))
|
||||
configured_types_floating[subpath] = mob_types_floating[path]
|
||||
GLOB.mob_config_movespeed_type_lookup = configured_types
|
||||
GLOB.mob_config_movespeed_type_lookup_floating = configured_types_floating
|
||||
if(update_mobs)
|
||||
update_mob_config_movespeeds()
|
||||
|
||||
|
||||
@@ -230,14 +230,6 @@
|
||||
/datum/config_entry/keyed_list/multiplicative_movespeed
|
||||
key_mode = KEY_MODE_TYPE
|
||||
value_mode = VALUE_MODE_NUM
|
||||
config_entry_value = list( //DEFAULTS
|
||||
/mob/living/simple_animal = 1,
|
||||
/mob/living/silicon/pai = 1,
|
||||
/mob/living/carbon/alien/humanoid/sentinel = 0.25,
|
||||
/mob/living/carbon/alien/humanoid/drone = 0.5,
|
||||
/mob/living/carbon/alien/humanoid/royal/praetorian = 1,
|
||||
/mob/living/carbon/alien/humanoid/royal/queen = 3
|
||||
)
|
||||
|
||||
/datum/config_entry/keyed_list/multiplicative_movespeed/ValidateAndSet()
|
||||
. = ..()
|
||||
@@ -249,6 +241,24 @@
|
||||
if(. && (var_name == NAMEOF(src, config_entry_value)))
|
||||
update_config_movespeed_type_lookup(TRUE)
|
||||
|
||||
/datum/config_entry/keyed_list/multiplicative_movespeed/normal
|
||||
config_entry_value = list( //DEFAULTS
|
||||
/mob/living/simple_animal = 1,
|
||||
/mob/living/silicon/pai = 1,
|
||||
/mob/living/carbon/alien/humanoid/sentinel = 0.25,
|
||||
/mob/living/carbon/alien/humanoid/drone = 0.5,
|
||||
/mob/living/carbon/alien/humanoid/royal/praetorian = 1,
|
||||
/mob/living/carbon/alien/humanoid/royal/queen = 3
|
||||
)
|
||||
|
||||
/datum/config_entry/keyed_list/multiplicative_movespeed/floating
|
||||
config_entry_value = list(
|
||||
/mob/living = 0,
|
||||
/mob/living/carbon/alien/humanoid = 0,
|
||||
/mob/living/carbon/alien/humanoid/royal/praetorian = 0,
|
||||
/mob/living/carbon/alien/humanoid/royal/queen = 2
|
||||
)
|
||||
|
||||
/datum/config_entry/number/movedelay //Used for modifying movement speed for mobs.
|
||||
abstract_type = /datum/config_entry/number/movedelay
|
||||
integer = FALSE
|
||||
@@ -297,7 +307,7 @@
|
||||
|
||||
/////////////////////////////////////////////////Outdated move delay
|
||||
/datum/config_entry/number/outdated_movedelay
|
||||
deprecated_by = /datum/config_entry/keyed_list/multiplicative_movespeed
|
||||
deprecated_by = /datum/config_entry/keyed_list/multiplicative_movespeed/normal
|
||||
abstract_type = /datum/config_entry/number/outdated_movedelay
|
||||
|
||||
var/movedelay_type
|
||||
|
||||
@@ -187,13 +187,15 @@ GLOBAL_LIST_EMPTY(movespeed_modification_cache)
|
||||
/// Set or update the global movespeed config on a mob
|
||||
/mob/proc/update_config_movespeed()
|
||||
add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/mob_config_speedmod, multiplicative_slowdown = get_config_multiplicative_speed())
|
||||
add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/mob_config_speedmod_floating, multiplicative_slowdown = get_config_multiplicative_speed(TRUE))
|
||||
|
||||
/// Get the global config movespeed of a mob by type
|
||||
/mob/proc/get_config_multiplicative_speed()
|
||||
if(!islist(GLOB.mob_config_movespeed_type_lookup) || !GLOB.mob_config_movespeed_type_lookup[type])
|
||||
/mob/proc/get_config_multiplicative_speed(floating = FALSE)
|
||||
var/list/read = floating? GLOB.mob_config_movespeed_type_lookup_floating : GLOB.mob_config_movespeed_type_lookup
|
||||
if(!islist(read) || !read[type])
|
||||
return 0
|
||||
else
|
||||
return GLOB.mob_config_movespeed_type_lookup[type]
|
||||
return read[type]
|
||||
|
||||
/// Go through the list of movespeed modifiers and calculate a final movespeed. ANY ADD/REMOVE DONE IN UPDATE_MOVESPEED MUST HAVE THE UPDATE ARGUMENT SET AS FALSE!
|
||||
/mob/proc/update_movespeed()
|
||||
|
||||
@@ -111,6 +111,12 @@
|
||||
|
||||
/datum/movespeed_modifier/mob_config_speedmod
|
||||
variable = TRUE
|
||||
blacklisted_movetypes = FLOATING
|
||||
flags = IGNORE_NOSLOW
|
||||
|
||||
/datum/movespeed_modifier/mob_config_speedmod_floating
|
||||
variable = TRUE
|
||||
movetypes = FLOATING
|
||||
flags = IGNORE_NOSLOW
|
||||
|
||||
/datum/movespeed_modifier/liver_cirrhosis
|
||||
|
||||
Reference in New Issue
Block a user