mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
Migrating Code to use Proper Byond Move() Code (#8667)
* Initial Commit All CanPass replaced with cross, all CheckExit replaced with uncross * Commit #2 Cross() argment turf/target now has a standard value of src.loc, the basis for this is the fact that Cross() should technically only be called with a default value by Move() code when moving to a new turf thus everything on it the target turf should be the src.loc * Commit #3 All move code has now been unhacked, all of it is functional except for border objects which still retain none of their original functionality * Commit #2 Cross() argment turf/target now has a standard value of src.loc, the basis for this is the fact that Cross() should technically only be called with a default value by Move() code when moving to a new turf thus everything on it the target turf should be the src.loc * Commit #2 Cross() argment turf/target now has a standard value of src.loc, the basis for this is the fact that Cross() should technically only be called with a default value by Move() code when moving to a new turf thus everything on it the target turf should be the src.loc (reverted from commit fdee8c8b687a4d1f305bdc5f5e1a59ebeacb4702) * Fuck me * Okay Redo * Hello, I am finished
This commit is contained in:
@@ -1,12 +1,7 @@
|
||||
/atom/proc/CanPass(atom/movable/mover, turf/target, height=1.5, air_group = 0)
|
||||
//Purpose: Determines if the object (or airflow) can pass this atom.
|
||||
//Called by: Movement, airflow.
|
||||
//Inputs: The moving atom (optional), target turf, "height" and air group
|
||||
//Outputs: Boolean if can pass.
|
||||
|
||||
/atom/movable/Cross(atom/movable/mover, turf/target, height=1.5, air_group = 0)
|
||||
return (!density || !height || air_group)
|
||||
|
||||
/turf/CanPass(atom/movable/mover, turf/target, height=1.5, air_group = 0)
|
||||
/turf/proc/Cross(atom/movable/mover, turf/target, height=1.5, air_group = 0)
|
||||
if(!target) return 0
|
||||
|
||||
if(istype(mover)) // turf/Enter(...) will perform more advanced checks
|
||||
@@ -17,29 +12,30 @@
|
||||
return 0
|
||||
|
||||
for(var/obj/obstacle in src)
|
||||
if(!obstacle.CanPass(mover, target, height, air_group))
|
||||
if(!obstacle.Cross(mover, target, height, air_group))
|
||||
return 0
|
||||
if(target != src)
|
||||
for(var/obj/obstacle in target)
|
||||
if(!obstacle.CanPass(mover, src, height, air_group))
|
||||
if(!obstacle.Cross(mover, src, height, air_group))
|
||||
return 0
|
||||
|
||||
return 1
|
||||
|
||||
//Basically another way of calling CanPass(null, other, 0, 0) and CanPass(null, other, 1.5, 1).
|
||||
//Basically another way of calling Cross(null, other, 0, 0) and Cross(null, other, 1.5, 1).
|
||||
//Returns:
|
||||
// 0 - Not blocked
|
||||
// AIR_BLOCKED - Blocked
|
||||
// ZONE_BLOCKED - Not blocked, but zone boundaries will not cross.
|
||||
// BLOCKED - Blocked, zone boundaries will not cross even if opened.
|
||||
atom/proc/c_airblock(turf/other)
|
||||
/atom/proc/c_airblock(turf/other)
|
||||
|
||||
/atom/movable/c_airblock(turf/other)
|
||||
#ifdef ZASDBG
|
||||
ASSERT(isturf(other))
|
||||
#endif
|
||||
return !CanPass(null, other, 0, 0) + 2*!CanPass(null, other, 1.5, 1)
|
||||
return !Cross(null, other, 0, 0) + 2*!Cross(null, other, 1.5, 1)
|
||||
|
||||
|
||||
turf/c_airblock(turf/other)
|
||||
/turf/c_airblock(turf/other)
|
||||
#ifdef ZASDBG
|
||||
ASSERT(isturf(other))
|
||||
#endif
|
||||
|
||||
@@ -175,7 +175,7 @@ client/proc/Test_ZAS_Connection(var/turf/simulated/T as turf)
|
||||
|
||||
for(var/direction in cardinal)
|
||||
var/turf/simulated/adjacent = get_step(current, direction)
|
||||
if(!current.ZCanPass(adjacent))
|
||||
if(!current.ZCross(adjacent))
|
||||
continue
|
||||
if(turfs.Find(adjacent))
|
||||
current_adjacents += adjacent
|
||||
|
||||
@@ -223,7 +223,7 @@ Attach to transfer valve and open. BOOM.
|
||||
|
||||
//Spread the fire.
|
||||
if(!(locate(/obj/fire) in enemy_tile))
|
||||
if( prob( 50 + 50 * (firelevel/zas_settings.Get(/datum/ZAS_Setting/fire_firelevel_multiplier)) ) && S.CanPass(null, enemy_tile, 0,0) && enemy_tile.CanPass(null, S, 0,0))
|
||||
if( prob( 50 + 50 * (firelevel/zas_settings.Get(/datum/ZAS_Setting/fire_firelevel_multiplier)) ) && S.Cross(null, enemy_tile, 0,0) && enemy_tile.Cross(null, S, 0,0))
|
||||
new/obj/fire(enemy_tile)
|
||||
|
||||
//seperate part of the present gas
|
||||
|
||||
@@ -17,7 +17,7 @@ Important Functions:
|
||||
|
||||
air_master.mark_for_update(turf)
|
||||
When stuff happens, call this. It works on everything. You basically don't need to worry about any other
|
||||
functions besides CanPass().
|
||||
functions besides Cross().
|
||||
|
||||
Notes for people who used ZAS before:
|
||||
There is no connected_zones anymore.
|
||||
|
||||
Reference in New Issue
Block a user