Dynamic glidespeed

ported from yogstation
This commit is contained in:
QuoteFox
2020-10-05 03:58:10 +01:00
parent 5e298aac96
commit 631090cf04
23 changed files with 113 additions and 36 deletions

View File

@@ -218,7 +218,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/list/ignoring = list()
var/clientfps = 0
var/clientfps = 60
var/parallax

View File

@@ -5,7 +5,7 @@
// You do not need to raise this if you are adding new values that have sane defaults.
// Only raise this value when changing the meaning/format/name/layout of an existing value
// where you would want the updater procs below to run
#define SAVEFILE_VERSION_MAX 20
#define SAVEFILE_VERSION_MAX 21
/*
SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Carn
@@ -42,6 +42,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
//if your savefile is 3 months out of date, then 'tough shit'.
/datum/preferences/proc/update_preferences(current_version, savefile/S)
if(current_version < 21)
clientfps = 60
return
/datum/preferences/proc/update_character(current_version, savefile/S)

View File

@@ -322,11 +322,14 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
return
ghostize(0, penalize = TRUE)
/mob/dead/observer/Move(NewLoc, direct)
/mob/dead/observer/Move(NewLoc, direct, glide_size_override = 32)
if(updatedir)
setDir(direct)//only update dir if we actually need it, so overlays won't spin on base sprites that don't have directions of their own
var/oldloc = loc
if(glide_size_override)
set_glide_size(glide_size_override)
if(NewLoc)
forceMove(NewLoc)
update_parallax_contents()

View File

@@ -3,7 +3,7 @@
real_name = "Unknown"
icon = 'icons/mob/human.dmi'
icon_state = "caucasian_m"
appearance_flags = KEEP_TOGETHER|TILE_BOUND|PIXEL_SCALE
appearance_flags = KEEP_TOGETHER|TILE_BOUND|PIXEL_SCALE|LONG_GLIDE
/mob/living/carbon/human/Initialize()
verbs += /mob/living/proc/mob_sleep

View File

@@ -252,8 +252,8 @@
var/current_dir
if(isliving(AM))
current_dir = AM.dir
if(step(AM, t))
step(src, t)
if(AM.Move(get_step(AM.loc, t), t, glide_size))
Move(get_step(loc, t), t)
if(current_dir)
AM.setDir(current_dir)
now_pushing = FALSE
@@ -547,10 +547,10 @@
/mob/living/proc/update_damage_overlays()
return
/mob/living/Move(atom/newloc, direct)
/mob/living/Move(atom/newloc, direct, glide_size_override)
if (buckled && buckled.loc != newloc) //not updating position
if (!buckled.anchored)
return buckled.Move(newloc, direct)
return buckled.Move(newloc, direct, glide_size)
else
return 0

View File

@@ -48,7 +48,7 @@ Difficulty: Medium
vision_range = 10
wander = FALSE
elimination = 1
appearance_flags = 0
appearance_flags = LONG_GLIDE
mouse_opacity = MOUSE_OPACITY_ICON
/mob/living/simple_animal/hostile/megafauna/legion/Initialize()

View File

@@ -123,3 +123,7 @@
var/time_initialized = null
var/mirrorcanloadappearance = FALSE
///Whether the mob is updating glide size when movespeed updates or not
var/updating_glide_size = TRUE

View File

@@ -86,6 +86,7 @@
return FALSE
//We are now going to move
var/add_delay = mob.movement_delay()
mob.set_glide_size(DELAY_TO_GLIDE_SIZE(add_delay * (((direct & 3) && (direct & 12)) ? 2 : 1))) // set it now in case of pulled objects
if(old_move_delay + (add_delay*MOVEMENT_DELAY_BUFFER_DELTA) + MOVEMENT_DELAY_BUFFER > world.time)
move_delay = old_move_delay
else
@@ -109,6 +110,7 @@
if((direct & (direct - 1)) && mob.loc == n) //moved diagonally successfully
add_delay *= 2
move_delay += add_delay
mob.set_glide_size(DELAY_TO_GLIDE_SIZE(add_delay))
if(.) // If mob is null here, we deserve the runtime
if(mob.throwing)
mob.throwing.finalize(FALSE)
@@ -364,14 +366,12 @@
/mob/proc/toggle_move_intent(mob/user)
if(m_intent == MOVE_INTENT_RUN)
m_intent = MOVE_INTENT_WALK
glide_size = 4
else
m_intent = MOVE_INTENT_RUN
glide_size = 8
if(hud_used && hud_used.static_inventory)
for(var/obj/screen/mov_intent/selector in hud_used.static_inventory)
selector.update_icon(src)
/mob/verb/up()
set name = "Move Upwards"
set category = "IC"
@@ -402,4 +402,4 @@
return TRUE
/mob/proc/canZMove(direction, turf/target)
return FALSE
return FALSE

View File

@@ -10,7 +10,7 @@
move_resist = INFINITY
layer = MASSIVE_OBJ_LAYER
light_range = 6
appearance_flags = 0
appearance_flags = LONG_GLIDE
var/current_size = 1
var/allowed_size = 1
var/contained = 1 //Are we going to move around?

View File

@@ -68,15 +68,17 @@
// movement process, persists while holder is moving through pipes
/obj/structure/disposalholder/proc/move()
set waitfor = FALSE
var/ticks = 1
var/obj/structure/disposalpipe/last
while(active)
var/obj/structure/disposalpipe/curr = loc
last = curr
set_glide_size(DELAY_TO_GLIDE_SIZE(ticks * world.tick_lag))
curr = curr.transfer(src)
if(!curr && active)
last.expel(src, loc, dir)
stoplag()
ticks = stoplag()
if(!(count--))
active = FALSE

View File

@@ -999,7 +999,6 @@
throwforce = 10
throw_speed = 0.1
throw_range = 28
glide_size = 2
flags_1 = CONDUCT_1
max_amount = 60
turf_type = /turf/open/floor/sepia