Movement configuration

This commit is contained in:
AffectedArc07
2021-05-17 17:47:34 +01:00
parent 8dd5dfbf7f
commit d68480b8b4
17 changed files with 46 additions and 46 deletions

View File

@@ -47,19 +47,6 @@
var/shuttle_refuel_delay = 12000 var/shuttle_refuel_delay = 12000
//Used for modifying movement speed for mobs.
//Unversal modifiers
var/run_speed = 0
var/walk_speed = 0
//Mob specific modifiers. NOTE: These will affect different mob types in different ways
var/human_delay = 0
var/robot_delay = 0
var/monkey_delay = 0
var/alien_delay = 0
var/slime_delay = 0
var/animal_delay = 0
//IP Intel vars //IP Intel vars
var/ipintel_email var/ipintel_email
var/ipintel_rating_bad = 1 var/ipintel_rating_bad = 1
@@ -294,22 +281,6 @@
config.revival_brain_life = value config.revival_brain_life = value
if("auto_toggle_ooc_during_round") if("auto_toggle_ooc_during_round")
config.auto_toggle_ooc_during_round = 1 config.auto_toggle_ooc_during_round = 1
if("run_speed")
config.run_speed = value
if("walk_speed")
config.walk_speed = value
if("human_delay")
config.human_delay = value
if("robot_delay")
config.robot_delay = value
if("monkey_delay")
config.monkey_delay = value
if("alien_delay")
config.alien_delay = value
if("slime_delay")
config.slime_delay = value
if("animal_delay")
config.animal_delay = value
if("bones_can_break") if("bones_can_break")
config.bones_can_break = value config.bones_can_break = value
if("shuttle_refuel_delay") if("shuttle_refuel_delay")

View File

@@ -27,6 +27,8 @@ GLOBAL_DATUM_INIT(configuration, /datum/server_configuration, new())
var/datum/configuration_section/logging_configuration/logging var/datum/configuration_section/logging_configuration/logging
/// Holder for the MC configuration datum /// Holder for the MC configuration datum
var/datum/configuration_section/mc_configuration/mc var/datum/configuration_section/mc_configuration/mc
/// Holder for the MC configuration datum
var/datum/configuration_section/movement_configuration/movement
/// Holder for the overflow configuration datum /// Holder for the overflow configuration datum
var/datum/configuration_section/overflow_configuration/overflow var/datum/configuration_section/overflow_configuration/overflow
/// Holder for the ruins configuration datum /// Holder for the ruins configuration datum
@@ -62,6 +64,7 @@ GLOBAL_DATUM_INIT(configuration, /datum/server_configuration, new())
jobs = new() jobs = new()
logging = new() logging = new()
mc = new() mc = new()
movement = new()
overflow = new() overflow = new()
ruins = new() ruins = new()
system = new() system = new()
@@ -87,6 +90,7 @@ GLOBAL_DATUM_INIT(configuration, /datum/server_configuration, new())
jobs.load_data(raw_config_data["job_configuration"]) jobs.load_data(raw_config_data["job_configuration"])
logging.load_data(raw_config_data["logging_configuration"]) logging.load_data(raw_config_data["logging_configuration"])
mc.load_data(raw_config_data["mc_configuration"]) mc.load_data(raw_config_data["mc_configuration"])
movement.load_data(raw_config_data["movement_configuration"])
overflow.load_data(raw_config_data["overflow_configuration"]) overflow.load_data(raw_config_data["overflow_configuration"])
ruins.load_data(raw_config_data["ruin_configuration"]) ruins.load_data(raw_config_data["ruin_configuration"])
system.load_data(raw_config_data["system_configuration"]) system.load_data(raw_config_data["system_configuration"])

View File

@@ -0,0 +1,26 @@
/// Config holder for values relating to mob movement speeds
/datum/configuration_section/movement_configuration
/// Base run speed before modifiers
var/base_run_speed = 1
/// Base walk speed before modifiers
var/base_walk_speed = 4
/// Move delay for humanoids
var/human_delay = 1.5
/// Move delay for cyborgs
var/robot_delay = 2.5
/// Move delay for xenomorphs
var/alien_delay = 1.5
/// Move delay for slimes (xenobio, not slimepeople)
var/slime_delay = 1.5
/// Move delay for other simple animals
var/animal_delay = 2.5
/datum/configuration_section/movement_configuration/load_data(list/data)
// Use the load wrappers here. That way the default isnt made 'null' if you comment out the config line
CONFIG_LOAD_NUM(base_run_speed, data["base_run_speed"])
CONFIG_LOAD_NUM(base_walk_speed, data["base_walk_speed"])
CONFIG_LOAD_NUM(human_delay, data["human_delay"])
CONFIG_LOAD_NUM(robot_delay, data["robot_delay"])
CONFIG_LOAD_NUM(alien_delay, data["alien_delay"])
CONFIG_LOAD_NUM(slime_delay, data["slime_delay"])
CONFIG_LOAD_NUM(animal_delay, data["animal_delay"])

View File

@@ -24,7 +24,7 @@
var/oldloc = loc var/oldloc = loc
step(src, direction) step(src, direction)
if(oldloc != loc) if(oldloc != loc)
addtimer(CALLBACK(src, .proc/ResetMoveDelay), config.walk_speed) addtimer(CALLBACK(src, .proc/ResetMoveDelay), GLOB.configuration.movement.base_walk_speed)
else else
move_delay = FALSE move_delay = FALSE

View File

@@ -126,7 +126,7 @@
/mob/living/carbon/alien/movement_delay() /mob/living/carbon/alien/movement_delay()
. = ..() . = ..()
. += move_delay_add + config.alien_delay //move_delay_add is used to slow aliens with stuns . += move_delay_add + GLOB.configuration.movement.alien_delay //move_delay_add is used to slow aliens with stuns
/mob/living/carbon/alien/getDNA() /mob/living/carbon/alien/getDNA()
return null return null

View File

@@ -1,7 +1,7 @@
/mob/living/carbon/human/movement_delay() /mob/living/carbon/human/movement_delay()
. = 0 . = 0
. += ..() . += ..()
. += config.human_delay . += GLOB.configuration.movement.human_delay
. += dna.species.movement_delay(src) . += dna.species.movement_delay(src)
/mob/living/carbon/human/Process_Spacemove(movement_dir = 0) /mob/living/carbon/human/Process_Spacemove(movement_dir = 0)

View File

@@ -928,15 +928,15 @@
if(forced_look) if(forced_look)
. += 3 . += 3
if(ignorewalk) if(ignorewalk)
. += config.run_speed . += GLOB.configuration.movement.base_run_speed
else else
switch(m_intent) switch(m_intent)
if(MOVE_INTENT_RUN) if(MOVE_INTENT_RUN)
if(drowsyness > 0) if(drowsyness > 0)
. += 6 . += 6
. += config.run_speed . += GLOB.configuration.movement.base_run_speed
if(MOVE_INTENT_WALK) if(MOVE_INTENT_WALK)
. += config.walk_speed . += GLOB.configuration.movement.base_walk_speed
/mob/living/proc/can_use_guns(obj/item/gun/G) /mob/living/proc/can_use_guns(obj/item/gun/G)

View File

@@ -122,7 +122,7 @@
. = ..() . = ..()
. += slowdown . += slowdown
. += 1 //A bit slower than humans, so they're easier to smash . += 1 //A bit slower than humans, so they're easier to smash
. += config.robot_delay . += GLOB.configuration.movement.robot_delay
/mob/living/silicon/pai/update_icons() /mob/living/silicon/pai/update_icons()
if(stat == DEAD) if(stat == DEAD)

View File

@@ -11,7 +11,7 @@
. += speed . += speed
if(module_active && istype(module_active,/obj/item/borg/destroyer/mobility)) if(module_active && istype(module_active,/obj/item/borg/destroyer/mobility))
. -= 3 . -= 3
. += config.robot_delay . += GLOB.configuration.movement.robot_delay
/mob/living/silicon/robot/mob_negates_gravity() /mob/living/silicon/robot/mob_negates_gravity()
return magpulse return magpulse

View File

@@ -332,7 +332,7 @@
. = speed . = speed
if(forced_look) if(forced_look)
. += 3 . += 3
. += config.animal_delay . += GLOB.configuration.movement.animal_delay
/mob/living/simple_animal/Stat() /mob/living/simple_animal/Stat()
..() ..()

View File

@@ -157,7 +157,7 @@
if(health <= 0) // if damaged, the slime moves twice as slow if(health <= 0) // if damaged, the slime moves twice as slow
. *= 2 . *= 2
. += config.slime_delay . += GLOB.configuration.movement.slime_delay
/mob/living/simple_animal/slime/update_health_hud() /mob/living/simple_animal/slime/update_health_hud()
if(hud_used) if(hud_used)

View File

@@ -72,9 +72,9 @@
if(MOVE_INTENT_RUN) if(MOVE_INTENT_RUN)
if(M.drowsyness > 0) if(M.drowsyness > 0)
mob_speed += 6 mob_speed += 6
mob_speed += config.run_speed - 1 mob_speed += GLOB.configuration.movement.base_run_speed - 1
if(MOVE_INTENT_WALK) if(MOVE_INTENT_WALK)
mob_speed += config.walk_speed - 1 mob_speed += GLOB.configuration.movement.base_run_speed - 1
mob_speed = BASE_MOVE_DELAY / max(1, BASE_MOVE_DELAY + mob_speed) mob_speed = BASE_MOVE_DELAY / max(1, BASE_MOVE_DELAY + mob_speed)
speed = min(speed + inertia * mob_speed, mob_speed) speed = min(speed + inertia * mob_speed, mob_speed)
continue continue

View File

@@ -375,7 +375,7 @@
if(istype(O, /obj/vehicle)) if(istype(O, /obj/vehicle))
var/obj/vehicle/V = O var/obj/vehicle/V = O
var/vehicle_speed_mod = config.run_speed var/vehicle_speed_mod = GLOB.configuration.movement.base_run_speed
if(V.vehicle_move_delay <= vehicle_speed_mod) if(V.vehicle_move_delay <= vehicle_speed_mod)
to_chat(user, "<span class='warning'>[V] can't be made any faster!</span>") to_chat(user, "<span class='warning'>[V] can't be made any faster!</span>")
return ..() return ..()

View File

@@ -92,7 +92,7 @@
bed = null bed = null
. = ..() . = ..()
if(bed && get_dist(oldloc, loc) <= 2) if(bed && get_dist(oldloc, loc) <= 2)
bed.Move(oldloc, get_dir(bed, oldloc), (last_move_diagonal? 2 : 1) * (vehicle_move_delay + config.human_delay)) bed.Move(oldloc, get_dir(bed, oldloc), (last_move_diagonal? 2 : 1) * (vehicle_move_delay + GLOB.configuration.movement.human_delay))
bed.dir = Dir bed.dir = Dir
if(bed.has_buckled_mobs()) if(bed.has_buckled_mobs())
for(var/m in bed.buckled_mobs) for(var/m in bed.buckled_mobs)

View File

@@ -160,7 +160,7 @@
unbuckle_mob(user) unbuckle_mob(user)
return return
var/delay = (last_move_diagonal? 2 : 1) * (vehicle_move_delay + config.human_delay) var/delay = (last_move_diagonal? 2 : 1) * (vehicle_move_delay + GLOB.configuration.movement.human_delay)
if(world.time < last_vehicle_move + delay) if(world.time < last_vehicle_move + delay)
return return
last_vehicle_move = world.time last_vehicle_move = world.time

View File

@@ -551,8 +551,6 @@ base_walk_speed = 4
human_delay = 1.5 human_delay = 1.5
# Move delay for cyborgs # Move delay for cyborgs
robot_delay = 2.5 robot_delay = 2.5
# Move delay for monkeys (and other primitives)
monkey_delay = 1.5
# Move delay for xenomorphs # Move delay for xenomorphs
alien_delay = 1.5 alien_delay = 1.5
# Move delay for slimes (xenobio, not slimepeople) # Move delay for slimes (xenobio, not slimepeople)

View File

@@ -196,6 +196,7 @@
#include "code\controllers\configuration\sections\job_configuration.dm" #include "code\controllers\configuration\sections\job_configuration.dm"
#include "code\controllers\configuration\sections\logging_configuration.dm" #include "code\controllers\configuration\sections\logging_configuration.dm"
#include "code\controllers\configuration\sections\mc_configuration.dm" #include "code\controllers\configuration\sections\mc_configuration.dm"
#include "code\controllers\configuration\sections\movement_configuration.dm"
#include "code\controllers\configuration\sections\overflow_configuration.dm" #include "code\controllers\configuration\sections\overflow_configuration.dm"
#include "code\controllers\configuration\sections\ruin_configuration.dm" #include "code\controllers\configuration\sections\ruin_configuration.dm"
#include "code\controllers\configuration\sections\system_configuration.dm" #include "code\controllers\configuration\sections\system_configuration.dm"