Skip to content

Commit

Permalink
Modify movedelay for mecha (#564)
Browse files Browse the repository at this point in the history
## About The Pull Request
Посмотрим, как оно будет
  • Loading branch information
larentoun authored Oct 13, 2024
1 parent 64bd51a commit f751184
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion code/datums/components/riding/riding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
/datum/component/riding/proc/driver_move(atom/movable/movable_parent, mob/living/user, direction)
SIGNAL_HANDLER
SHOULD_CALL_PARENT(TRUE)
movable_parent.set_glide_size(DELAY_TO_GLIDE_SIZE(vehicle_move_delay))
movable_parent.set_glide_size(DELAY_TO_GLIDE_SIZE(modified_move_delay(vehicle_move_delay))) // BANDASTATION EDIT - Vehicle speed

/// So we can check all occupants when we bump a door to see if anyone has access
/datum/component/riding/proc/vehicle_bump(atom/movable/movable_parent, obj/machinery/door/possible_bumped_door)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/riding/riding_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
var/mob/living/living_parent = parent
step(living_parent, direction)
var/modified_move_cooldown = vehicle_move_cooldown
var/modified_move_delay = vehicle_move_delay
var/modified_move_delay = modified_move_delay(vehicle_move_delay)
if(ishuman(user) && HAS_TRAIT(user, TRAIT_ROUGHRIDER)) // YEEHAW!
var/mob/living/carbon/human/rough_rider = user
var/ride_benefit = null
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/riding/riding_vehicle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
return

step(movable_parent, direction)
COOLDOWN_START(src, vehicle_move_cooldown, vehicle_move_delay)
COOLDOWN_START(src, vehicle_move_cooldown, modified_move_delay(vehicle_move_delay)) // BANDASTATION EDIT - Vehicle speed

if(QDELETED(src))
return
Expand Down
2 changes: 1 addition & 1 deletion code/datums/elements/ridable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
return
var/speed_limit = round(CONFIG_GET(number/movedelay/run_delay) * 0.85, 0.01)
var/datum/component/riding/theoretical_riding_component = riding_component_type
var/theoretical_speed = initial(theoretical_riding_component.vehicle_move_delay)
var/theoretical_speed = modified_move_delay(initial(theoretical_riding_component.vehicle_move_delay)) // BANDASTATION EDIT - Vehicle speed
if(theoretical_speed <= speed_limit) // i say speed but this is actually move delay, so you have to be ABOVE the speed limit to pass
to_chat(user, span_warning("[ridable_atom] can't be made any faster!"))
return
Expand Down
2 changes: 1 addition & 1 deletion code/modules/vehicles/cars/car.dm
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
/obj/vehicle/sealed/car/vehicle_move(direction)
if(!COOLDOWN_FINISHED(src, cooldown_vehicle_move))
return FALSE
COOLDOWN_START(src, cooldown_vehicle_move, vehicle_move_delay)
COOLDOWN_START(src, cooldown_vehicle_move, modified_move_delay(vehicle_move_delay)) // BANDASTATION EDIT - Vehicle speed

if(COOLDOWN_FINISHED(src, enginesound_cooldown))
COOLDOWN_START(src, enginesound_cooldown, engine_sound_length)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/vehicles/mecha/mecha_movement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
/obj/vehicle/sealed/mecha/vehicle_move(direction, forcerotate = FALSE)
if(!COOLDOWN_FINISHED(src, cooldown_vehicle_move))
return FALSE
COOLDOWN_START(src, cooldown_vehicle_move, movedelay)
COOLDOWN_START(src, cooldown_vehicle_move, modified_move_delay(movedelay)) // BANDASTATION EDIT - Vehicle speed
if(completely_disabled)
return FALSE
if(!direction)
Expand Down Expand Up @@ -138,7 +138,7 @@
if(keyheld || !pivot_step) //If we pivot step, we don't return here so we don't just come to a stop
return TRUE

set_glide_size(DELAY_TO_GLIDE_SIZE(movedelay))
set_glide_size(DELAY_TO_GLIDE_SIZE(modified_move_delay(movedelay))) // BANDASTATION EDIT - Vehicle speed
//Otherwise just walk normally
. = try_step_multiz(direction)
if(phasing)
Expand Down
12 changes: 4 additions & 8 deletions modular_bandastation/balance/code/balance_riding.dm
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
#define TG_SPEED 1.5
#define RP_SPEED CONFIG_GET(number/movedelay/run_delay)

/datum/component/riding/Initialize(mob/living/riding_mob, force, buckle_mob_flags, potion_boost)
. = ..()
if(. == COMPONENT_INCOMPATIBLE)
return
if(vehicle_move_delay == 0)
vehicle_move_delay = round(max(RP_SPEED - TG_SPEED, 0) * TG_SPEED, 0.01)
return
vehicle_move_delay = round(RP_SPEED / TG_SPEED * vehicle_move_delay, 0.01)
/proc/modified_move_delay(move_delay)
if(move_delay == 0)
return round(max(RP_SPEED - TG_SPEED, 0) * TG_SPEED, 0.01)
return round(RP_SPEED / TG_SPEED * move_delay, 0.01)

#undef TG_SPEED
#undef RP_SPEED

0 comments on commit f751184

Please sign in to comment.