Merge pull request #10564 from kevinz000/optimization_1

Experimental optimizations
This commit is contained in:
Lin
2020-01-29 19:25:13 +00:00
committed by GitHub
14 changed files with 96 additions and 98 deletions
+12 -20
View File
@@ -571,29 +571,23 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0)
M.show_inv(user)
/mob/proc/is_muzzled()
return 0
return FALSE
/mob/Stat()
..()
if(statpanel("Status"))
if (client)
stat(null, "Ping: [round(client.lastping, 1)]ms (Average: [round(client.avgping, 1)]ms)")
stat(null, "Map: [SSmapping.config?.map_name || "Loading..."]")
var/datum/map_config/cached = SSmapping.next_map_config
if(cached)
stat(null, "Next Map: [cached.map_name]")
stat(null, "Round ID: [GLOB.round_id ? GLOB.round_id : "NULL"]")
stat(null, "Server Time: [time2text(world.timeofday, "YYYY-MM-DD hh:mm:ss")]")
stat(null, "Round Time: [WORLDTIME2TEXT("hh:mm:ss")]")
stat(null, "Station Time: [STATION_TIME_TIMESTAMP("hh:mm:ss")]")
stat(null, "Time Dilation: [round(SStime_track.time_dilation_current,1)]% AVG:([round(SStime_track.time_dilation_avg_fast,1)]%, [round(SStime_track.time_dilation_avg,1)]%, [round(SStime_track.time_dilation_avg_slow,1)]%)")
if(SSshuttle.emergency)
var/ETA = SSshuttle.emergency.getModeStr()
if(ETA)
stat(null, "[ETA] [SSshuttle.emergency.getTimerStr()]")
//This is only called from client/Stat(), let's assume client exists.
if(client && client.holder)
if(statpanel("Status"))
var/list/L = list()
L += "Ping: [round(client.lastping,1)]ms (Avg: [round(client.avgping,1)]ms)"
L += SSmapping.stat_map_name
L += "Round ID: [GLOB.round_id || "NULL"]"
L += SStime_track.stat_time_text
L += SSshuttle.emergency_shuttle_stat_text
stat(null, "[L.Join("\n\n")]")
if(client.holder)
if(statpanel("MC"))
var/turf/T = get_turf(client.eye)
stat("Location:", COORD(T))
@@ -643,8 +637,6 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0)
if(A.IsObscured())
continue
statpanel(listed_turf.name, null, A)
if(mind)
add_spells_to_statpanel(mind.spell_list)
var/datum/antagonist/changeling/changeling = mind.has_antag_datum(/datum/antagonist/changeling)
+32 -33
View File
@@ -9,37 +9,36 @@
mob.dropItemToGround(mob.get_active_held_item())
return
/client/proc/Move_object(direct)
/client/proc/Move_object(direction)
if(mob && mob.control_object)
if(mob.control_object.density)
step(mob.control_object,direct)
step(mob.control_object,direction)
if(!mob.control_object)
return
mob.control_object.setDir(direct)
mob.control_object.setDir(direction)
else
mob.control_object.forceMove(get_step(mob.control_object,direct))
mob.control_object.forceMove(get_step(mob.control_object,direction))
#define MOVEMENT_DELAY_BUFFER 0.75
#define MOVEMENT_DELAY_BUFFER_DELTA 1.25
/client/Move(n, direct)
/client/Move(n, direction)
if(world.time < move_delay) //do not move anything ahead of this check please
return FALSE
else
next_move_dir_add = 0
next_move_dir_sub = 0
next_move_dir_add = next_move_dir_sub = NONE
var/old_move_delay = move_delay
move_delay = world.time + world.tick_lag //this is here because Move() can now be called mutiple times per tick
if(!mob || !mob.loc)
return FALSE
if(!n || !direct)
if(!n || !direction || !mob?.loc)
return FALSE
//GET RID OF THIS SOON AS MOBILITY FLAGS IS DONE
if(mob.notransform)
return FALSE //This is sota the goto stop mobs from moving var
return FALSE
if(mob.control_object)
return Move_object(direct)
return Move_object(direction)
if(!isliving(mob))
return mob.Move(n, direct)
return mob.Move(n, direction)
if(mob.stat == DEAD)
mob.ghostize()
return FALSE
@@ -48,29 +47,29 @@
var/mob/living/L = mob //Already checked for isliving earlier
if(L.incorporeal_move) //Move though walls
Process_Incorpmove(direct)
Process_Incorpmove(direction)
return FALSE
if(mob.remote_control) //we're controlling something, our movement is relayed to it
return mob.remote_control.relaymove(mob, direct)
return mob.remote_control.relaymove(mob, direction)
if(isAI(mob))
return AIMove(n,direct,mob)
return AIMove(n,direction,mob)
if(Process_Grab()) //are we restrained by someone's grip?
return
if(mob.buckled) //if we're buckled to something, tell it we moved.
return mob.buckled.relaymove(mob, direct)
return mob.buckled.relaymove(mob, direction)
if(!mob.canmove)
return FALSE
if(isobj(mob.loc) || ismob(mob.loc)) //Inside an object, tell it we moved
var/atom/O = mob.loc
return O.relaymove(mob, direct)
return O.relaymove(mob, direction)
if(!mob.Process_Spacemove(direct))
if(!mob.Process_Spacemove(direction))
return FALSE
//We are now going to move
var/add_delay = mob.movement_delay()
@@ -85,16 +84,16 @@
if(L.confused > 40)
newdir = pick(GLOB.alldirs)
else if(prob(L.confused * 1.5))
newdir = angle2dir(dir2angle(direct) + pick(90, -90))
newdir = angle2dir(dir2angle(direction) + pick(90, -90))
else if(prob(L.confused * 3))
newdir = angle2dir(dir2angle(direct) + pick(45, -45))
newdir = angle2dir(dir2angle(direction) + pick(45, -45))
if(newdir)
direct = newdir
n = get_step(L, direct)
direction = newdir
n = get_step(L, direction)
. = ..()
if((direct & (direct - 1)) && mob.loc == n) //moved diagonally successfully
if((direction & (direction - 1)) && mob.loc == n) //moved diagonally successfully
add_delay *= 2
move_delay += add_delay
if(.) // If mob is null here, we deserve the runtime
@@ -102,7 +101,7 @@
mob.throwing.finalize(FALSE)
for(var/obj/O in mob.user_movement_hooks)
O.intercept_user_move(direct, mob, n, oldloc)
O.intercept_user_move(direction, mob, n, oldloc)
var/atom/movable/P = mob.pulling
if(P && !ismob(P) && P.density)
@@ -126,22 +125,22 @@
///Process_Incorpmove
///Called by client/Move()
///Allows mobs to run though walls
/client/proc/Process_Incorpmove(direct)
/client/proc/Process_Incorpmove(direction)
var/turf/mobloc = get_turf(mob)
if(!isliving(mob))
return
var/mob/living/L = mob
switch(L.incorporeal_move)
if(INCORPOREAL_MOVE_BASIC)
var/T = get_step(L,direct)
var/T = get_step(L,direction)
if(T)
L.forceMove(T)
L.setDir(direct)
L.setDir(direction)
if(INCORPOREAL_MOVE_SHADOW)
if(prob(50))
var/locx
var/locy
switch(direct)
switch(direction)
if(NORTH)
locx = mobloc.x
locy = (mobloc.y+2)
@@ -175,12 +174,12 @@
break
else
new /obj/effect/temp_visual/dir_setting/ninja/shadow(mobloc, L.dir)
var/T = get_step(L,direct)
var/T = get_step(L,direction)
if(T)
L.forceMove(T)
L.setDir(direct)
L.setDir(direction)
if(INCORPOREAL_MOVE_JAUNT) //Incorporeal move, but blocked by holy-watered tiles and salt piles.
var/turf/open/floor/stepTurf = get_step(L, direct)
var/turf/open/floor/stepTurf = get_step(L, direction)
if(stepTurf)
for(var/obj/effect/decal/cleanable/salt/S in stepTurf)
to_chat(L, "<span class='warning'>[S] bars your passage!</span>")
@@ -197,7 +196,7 @@
return
L.forceMove(stepTurf)
L.setDir(direct)
L.setDir(direction)
return TRUE