mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-27 05:57:24 +01:00
-tg- Move Refactor
This commit ports /tg/'s move refactor. The throwing system has been replaced entirely, removing the necessity of throw_at_fast and resolving multiple outstanding issues, such as crossbows being unusable. Spacedrifting has also been upgraded to function with the new throwing system. It is now it's own process. Tickcomp has been killed, and the config values have been adjusted to more or less match live Paradise. All mobs now share a common Bump() proc. There are only four mobtypes which do not, including humans and simple animals. With the exception of mob types that do not ever want to Bump() or be Bumped(), they should call the parent proc. Human movement slowdown has been moderately tweaked in how it stacks effects; It shouldn't be significantly different from a player perspective. Mobs will now spread fire if they bump into another mob. I don't want to set the world on fiiiire, I just want start a flame in your heart~ For player facing changes: Input delay has been reduced by roughly ~50ms for any direction keys, by advantage of a previously unknown flag on byond verbs which allow them to operate independently from the tick rate of the server. You may need to clear your interface.dmf file if you have a custom skin for this change to function.
This commit is contained in:
+124
-133
@@ -15,21 +15,27 @@
|
||||
return 1
|
||||
return (!mover.density || !density || lying)
|
||||
|
||||
//The byond version of these verbs wait for the next tick before acting.
|
||||
// instant verbs however can run mid tick or even during the time between ticks.
|
||||
/client/verb/moveup()
|
||||
set name = ".moveup"
|
||||
set instant = 1
|
||||
Move(get_step(mob, NORTH), NORTH)
|
||||
|
||||
/client/North()
|
||||
..()
|
||||
/client/verb/movedown()
|
||||
set name = ".movedown"
|
||||
set instant = 1
|
||||
Move(get_step(mob, SOUTH), SOUTH)
|
||||
|
||||
/client/verb/moveright()
|
||||
set name = ".moveright"
|
||||
set instant = 1
|
||||
Move(get_step(mob, EAST), EAST)
|
||||
|
||||
/client/South()
|
||||
..()
|
||||
|
||||
|
||||
/client/West()
|
||||
..()
|
||||
|
||||
|
||||
/client/East()
|
||||
..()
|
||||
/client/verb/moveleft()
|
||||
set name = ".moveleft"
|
||||
set instant = 1
|
||||
Move(get_step(mob, WEST), WEST)
|
||||
|
||||
|
||||
/client/Northeast()
|
||||
@@ -105,12 +111,11 @@
|
||||
|
||||
/client/verb/toggle_throw_mode()
|
||||
set hidden = 1
|
||||
if(!istype(mob, /mob/living/carbon))
|
||||
return
|
||||
if(!mob.stat && isturf(mob.loc) && !mob.restrained())
|
||||
mob:toggle_throw_mode()
|
||||
if(iscarbon(mob))
|
||||
var/mob/living/carbon/C = mob
|
||||
C.toggle_throw_mode()
|
||||
else
|
||||
return
|
||||
to_chat(usr, "<span class='danger'>This mob type cannot throw items.</span>")
|
||||
|
||||
|
||||
/client/verb/drop_item()
|
||||
@@ -134,16 +139,16 @@
|
||||
/client/proc/Move_object(direct)
|
||||
if(mob && mob.control_object)
|
||||
if(mob.control_object.density)
|
||||
step(mob.control_object,direct)
|
||||
if(!mob.control_object) return
|
||||
mob.control_object.dir = direct
|
||||
step(mob.control_object, direct)
|
||||
if(!mob.control_object)
|
||||
return
|
||||
mob.control_object.setDir(direct)
|
||||
else
|
||||
mob.control_object.forceMove(get_step(mob.control_object,direct))
|
||||
mob.control_object.forceMove(get_step(mob.control_object, direct))
|
||||
return
|
||||
|
||||
|
||||
/client/Move(n, direct)
|
||||
|
||||
if(viewingCanvas)
|
||||
view = world.view //Reset the view
|
||||
winset(src, "mapwindow.map", "icon-size=[src.reset_stretch]")
|
||||
@@ -152,19 +157,28 @@
|
||||
if(mob.hud_used)
|
||||
mob.hud_used.show_hud(HUD_STYLE_STANDARD)
|
||||
|
||||
if(mob.control_object) Move_object(direct)
|
||||
if(world.time < move_delay)
|
||||
return
|
||||
|
||||
if(world.time < move_delay) return
|
||||
move_delay = world.time + world.tick_lag //this is here because Move() can now be called multiple times per tick
|
||||
if(!mob || !mob.loc)
|
||||
return 0
|
||||
|
||||
if(!isliving(mob)) return mob.Move(n,direct)
|
||||
if(mob.notransform)
|
||||
return 0 //This is sota the goto stop mobs from moving var
|
||||
|
||||
if(moving) return 0
|
||||
if(mob.control_object)
|
||||
return Move_object(direct)
|
||||
|
||||
if(!mob) return
|
||||
if(!isliving(mob))
|
||||
return mob.Move(n, direct)
|
||||
|
||||
if(mob.stat==DEAD) return
|
||||
if(mob.stat == DEAD)
|
||||
mob.ghostize()
|
||||
return 0
|
||||
|
||||
if(mob.notransform) return//This is sota the goto stop mobs from moving var
|
||||
if(moving)
|
||||
return 0
|
||||
|
||||
if(isliving(mob))
|
||||
var/mob/living/L = mob
|
||||
@@ -172,126 +186,105 @@
|
||||
Process_Incorpmove(direct)
|
||||
return
|
||||
|
||||
if(Process_Grab()) return
|
||||
|
||||
if(mob.buckled) //if we're buckled to something, tell it we moved.
|
||||
return mob.buckled.relaymove(mob, direct)
|
||||
|
||||
if(mob.remote_control) //we're controlling something, our movement is relayed to it
|
||||
if(mob.remote_control) //we're controlling something, our movement is relayed to it
|
||||
return mob.remote_control.relaymove(mob, direct)
|
||||
|
||||
if(isAI(mob))
|
||||
if(istype(mob.loc, /obj/item/device/aicard))
|
||||
var/obj/O = mob.loc
|
||||
return O.relaymove(mob, direct) //aicards have special relaymove stuff
|
||||
return AIMove(n,direct,mob)
|
||||
return O.relaymove(mob, direct) // aicards have special relaymove stuff
|
||||
return AIMove(n, direct, mob)
|
||||
|
||||
|
||||
if(Process_Grab())
|
||||
return
|
||||
|
||||
if(mob.buckled) //if we're buckled to something, tell it we moved.
|
||||
return mob.buckled.relaymove(mob, direct)
|
||||
|
||||
if(!mob.canmove)
|
||||
return
|
||||
|
||||
//if(istype(mob.loc, /turf/space) || (mob.flags & NOGRAV))
|
||||
// if(!mob.Process_Spacemove(0)) return 0
|
||||
|
||||
if(!mob.lastarea)
|
||||
mob.lastarea = get_area(mob.loc)
|
||||
|
||||
if(isobj(mob.loc) || ismob(mob.loc))//Inside an object, tell it we moved
|
||||
if(isobj(mob.loc) || ismob(mob.loc)) //Inside an object, tell it we moved
|
||||
var/atom/O = mob.loc
|
||||
return O.relaymove(mob, direct)
|
||||
|
||||
if(istype(mob.get_active_hand(), /obj/item))
|
||||
var/obj/item/I = mob.get_active_hand()
|
||||
I.moved(mob, n, direct)
|
||||
|
||||
|
||||
if(!mob.Process_Spacemove(direct))
|
||||
return 0
|
||||
return 0
|
||||
|
||||
if(isturf(mob.loc))
|
||||
|
||||
if(mob.restrained())//Why being pulled while cuffed prevents you from moving
|
||||
for(var/mob/M in range(mob, 1))
|
||||
if(M.pulling == mob)
|
||||
if(!M.restrained() && M.stat == 0 && M.canmove && mob.Adjacent(M))
|
||||
to_chat(src, "<span class='notice'>You're restrained! You can't move!</span>")
|
||||
return 0
|
||||
else
|
||||
M.stop_pulling()
|
||||
|
||||
if(mob.pinned.len)
|
||||
to_chat(src, "<span class='notice'>You're pinned to a wall by [mob.pinned[1]]!</span>")
|
||||
return 0
|
||||
|
||||
var/turf/T = mob.loc
|
||||
move_delay = world.time//set move delay
|
||||
move_delay += T.slowdown
|
||||
mob.last_movement = world.time
|
||||
switch(mob.m_intent)
|
||||
if("run")
|
||||
if(mob.drowsyness > 0)
|
||||
move_delay += 6
|
||||
move_delay += 1+config.run_speed
|
||||
if("walk")
|
||||
move_delay += 1+config.walk_speed
|
||||
move_delay += mob.movement_delay()
|
||||
|
||||
if(config.Tickcomp)
|
||||
move_delay -= 1.3
|
||||
var/tickcomp = ((1/(world.tick_lag))*1.3)
|
||||
move_delay = move_delay + tickcomp
|
||||
|
||||
//We are now going to move
|
||||
moving = 1
|
||||
//Something with pulling things
|
||||
if(locate(/obj/item/weapon/grab, mob))
|
||||
move_delay = max(move_delay, world.time + 7)
|
||||
var/list/L = mob.ret_grab()
|
||||
if(istype(L, /list))
|
||||
if(L.len == 2)
|
||||
L -= mob
|
||||
var/mob/M = L[1]
|
||||
if(M)
|
||||
if((get_dist(mob, M) <= 1 || M.loc == mob.loc))
|
||||
. = ..()
|
||||
if(isturf(M.loc))
|
||||
var/diag = get_dir(mob, M)
|
||||
if((diag - 1) & diag)
|
||||
else
|
||||
diag = null
|
||||
if((get_dist(mob, M) > 1 || diag))
|
||||
step(M, get_dir(M.loc, T))
|
||||
if(mob.restrained()) // Why being pulled while cuffed prevents you from moving
|
||||
for(var/mob/M in orange(1, mob))
|
||||
if(M.pulling == mob)
|
||||
if(!M.incapacitated() && mob.Adjacent(M))
|
||||
to_chat(src, "<span class='warning'>You're restrained! You can't move!</span>")
|
||||
move_delay = world.time + 10
|
||||
return 0
|
||||
else
|
||||
for(var/mob/M in L)
|
||||
M.other_mobs = 1
|
||||
if(mob != M)
|
||||
M.animate_movement = 3
|
||||
for(var/mob/M in L)
|
||||
spawn( 0 )
|
||||
step(M, direct)
|
||||
return
|
||||
spawn( 1 )
|
||||
M.other_mobs = null
|
||||
M.animate_movement = 2
|
||||
return
|
||||
M.stop_pulling()
|
||||
|
||||
else if(mob.confused)
|
||||
step(mob, pick(cardinal))
|
||||
else
|
||||
. = ..()
|
||||
|
||||
for(var/obj/item/weapon/grab/G in mob)
|
||||
if(G.state == GRAB_NECK)
|
||||
mob.setDir(reverse_dir[direct])
|
||||
G.adjust_position()
|
||||
for(var/obj/item/weapon/grab/G in mob.grabbed_by)
|
||||
G.adjust_position()
|
||||
//We are now going to move
|
||||
moving = 1
|
||||
move_delay = mob.movement_delay() + world.time
|
||||
mob.last_movement = world.time
|
||||
|
||||
if(locate(/obj/item/weapon/grab, mob))
|
||||
move_delay = max(move_delay, world.time + 7)
|
||||
var/list/L = mob.ret_grab()
|
||||
if(istype(L, /list))
|
||||
if(L.len == 2)
|
||||
L -= mob
|
||||
var/mob/M = L[1]
|
||||
if(M)
|
||||
if((get_dist(mob, M) <= 1 || M.loc == mob.loc))
|
||||
var/turf/prev_loc = mob.loc
|
||||
. = ..()
|
||||
if(M && isturf(M.loc)) // Mob may get deleted during parent call
|
||||
var/diag = get_dir(mob, M)
|
||||
if((diag - 1) & diag)
|
||||
else
|
||||
diag = null
|
||||
if((get_dist(mob, M) > 1 || diag))
|
||||
step(M, get_dir(M.loc, prev_loc))
|
||||
else
|
||||
for(var/mob/M in L)
|
||||
M.other_mobs = 1
|
||||
if(mob != M)
|
||||
M.animate_movement = 3
|
||||
for(var/mob/M in L)
|
||||
spawn(0)
|
||||
step(M, direct)
|
||||
return
|
||||
spawn(1)
|
||||
M.other_mobs = null
|
||||
M.animate_movement = 2
|
||||
return
|
||||
|
||||
else if(mob.confused)
|
||||
step(mob, pick(cardinal))
|
||||
else
|
||||
. = ..()
|
||||
|
||||
for(var/obj/item/weapon/grab/G in mob)
|
||||
if(G.state == GRAB_NECK)
|
||||
mob.setDir(reverse_dir[direct])
|
||||
G.adjust_position()
|
||||
for(var/obj/item/weapon/grab/G in mob.grabbed_by)
|
||||
G.adjust_position()
|
||||
|
||||
moving = 0
|
||||
if(mob && .)
|
||||
if(mob.throwing)
|
||||
mob.throwing.finalize(FALSE)
|
||||
|
||||
for(var/obj/O in mob)
|
||||
O.on_mob_move(direct, mob)
|
||||
|
||||
moving = 0
|
||||
if(mob && .)
|
||||
mob.throwing = 0
|
||||
|
||||
return .
|
||||
|
||||
return
|
||||
|
||||
|
||||
///Process_Grab()
|
||||
@@ -408,13 +401,13 @@
|
||||
var/atom/movable/backup = get_spacemove_backup()
|
||||
if(backup)
|
||||
if(istype(backup) && movement_dir && !backup.anchored)
|
||||
if(backup.newtonian_move(turn(movement_dir, 180))) //You're pushing off something movable, so it moves
|
||||
src << "<span class='info'>You push off of [backup] to propel yourself.</span>"
|
||||
var/opposite_dir = turn(movement_dir, 180)
|
||||
if(backup.newtonian_move(opposite_dir)) //You're pushing off something movable, so it moves
|
||||
to_chat(src, "<span class='notice'>You push off of [backup] to propel yourself.</span>")
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/mob/get_spacemove_backup()
|
||||
var/atom/movable/dense_object_backup
|
||||
for(var/A in orange(1, get_turf(src)))
|
||||
if(isarea(A))
|
||||
continue
|
||||
@@ -434,9 +427,7 @@
|
||||
return AM
|
||||
if(pulling == AM)
|
||||
continue
|
||||
dense_object_backup = AM
|
||||
break
|
||||
. = dense_object_backup
|
||||
. = AM
|
||||
|
||||
|
||||
/mob/proc/mob_has_gravity(turf/T)
|
||||
|
||||
Reference in New Issue
Block a user