Skip to content

Commit

Permalink
More 516 prep (rename caller vars)
Browse files Browse the repository at this point in the history
  • Loading branch information
Absolucy committed Sep 12, 2024
1 parent d1325ff commit dbcd7b2
Show file tree
Hide file tree
Showing 30 changed files with 201 additions and 201 deletions.
14 changes: 7 additions & 7 deletions code/__HELPERS/paths/jps.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

/datum/pathfind/jps
/// The movable we are pathing
var/atom/movable/caller
var/atom/movable/requester
/// The turf we're trying to path to (note that this won't track a moving target)
var/turf/end
/// The open list/stack we pop nodes out from (TODO: make this a normal list and macro-ize the heap operations to reduce proc overhead)
Expand All @@ -73,9 +73,9 @@
///Defines how we handle diagonal moves. See __DEFINES/path.dm
var/diagonal_handling = DIAGONAL_REMOVE_CLUNKY

/datum/pathfind/jps/proc/setup(atom/movable/caller, list/access, max_distance, simulated_only, avoid, list/datum/callback/on_finish, atom/goal, mintargetdist, skip_first, diagonal_handling)
src.caller = caller
src.pass_info = new(caller, access)
/datum/pathfind/jps/proc/setup(atom/movable/requester, list/access, max_distance, simulated_only, avoid, list/datum/callback/on_finish, atom/goal, mintargetdist, skip_first, diagonal_handling)
src.requester = requester
src.pass_info = new(requester, access)
src.max_distance = max_distance
src.simulated_only = simulated_only
src.avoid = avoid
Expand All @@ -89,12 +89,12 @@

/datum/pathfind/jps/Destroy(force)
. = ..()
caller = null
requester = null
end = null
open = null

/datum/pathfind/jps/start()
start = start || get_turf(caller)
start = start || get_turf(requester)
. = ..()
if(!.)
return .
Expand All @@ -116,7 +116,7 @@
. = ..()
if(!.)
return .
if(QDELETED(caller))
if(QDELETED(requester))
return FALSE

while(!open.is_empty() && !path)
Expand Down
26 changes: 13 additions & 13 deletions code/__HELPERS/paths/path.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* It will yield until a path is returned, using magic
*
* Arguments:
* * caller: The movable atom that's trying to find the path
* * requester: The movable atom that's trying to find the path
* * end: What we're trying to path to. It doesn't matter if this is a turf or some other atom, we're gonna just path to the turf it's on anyway
* * max_distance: The maximum number of steps we can take in a given path to search (default: 30, 0 = infinite)
* * mintargetdistance: Minimum distance to the target before path returns, could be used to get near a target, but not right to it - for an AI mob with a gun, for example.
Expand All @@ -14,16 +14,16 @@
* * skip_first: Whether or not to delete the first item in the path. This would be done because the first item is the starting tile, which can break movement for some creatures.
* * diagonal_handling: defines how we handle diagonal moves. see __DEFINES/path.dm
*/
/proc/get_path_to(atom/movable/caller, atom/end, max_distance = 30, mintargetdist, access=list(), simulated_only = TRUE, turf/exclude, skip_first=TRUE, diagonal_handling=DIAGONAL_REMOVE_CLUNKY)
/proc/get_path_to(atom/movable/requester, atom/end, max_distance = 30, mintargetdist, access=list(), simulated_only = TRUE, turf/exclude, skip_first=TRUE, diagonal_handling=DIAGONAL_REMOVE_CLUNKY)
var/list/hand_around = list()
// We're guarenteed that list will be the first list in pathfinding_finished's argset because of how callback handles the arguments list
var/datum/callback/await = list(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(pathfinding_finished), hand_around))
if(!SSpathfinder.pathfind(caller, end, max_distance, mintargetdist, access, simulated_only, exclude, skip_first, diagonal_handling, await))
if(!SSpathfinder.pathfind(requester, end, max_distance, mintargetdist, access, simulated_only, exclude, skip_first, diagonal_handling, await))
return list()

UNTIL(length(hand_around))
var/list/return_val = hand_around[1]
if(!islist(return_val) || (QDELETED(caller) || QDELETED(end))) // It's trash, just hand back empty to make it easy
if(!islist(return_val) || (QDELETED(requester) || QDELETED(end))) // It's trash, just hand back empty to make it easy
return list()
return return_val

Expand All @@ -37,7 +37,7 @@
* It will yield until a path is returned, using magic
*
* Arguments:
* * caller: The movable atom that's trying to find the path
* * requester: The movable atom that's trying to find the path
* * end: What we're trying to path to. It doesn't matter if this is a turf or some other atom, we're gonna just path to the turf it's on anyway
* * max_distance: The maximum number of steps we can take in a given path to search (default: 30, 0 = infinite)
* * mintargetdistance: Minimum distance to the target before path returns, could be used to get near a target, but not right to it - for an AI mob with a gun, for example.
Expand All @@ -47,29 +47,29 @@
* * exclude: If we want to avoid a specific turf, like if we're a mulebot who already got blocked by some turf
* * skip_first: Whether or not to delete the first item in the path. This would be done because the first item is the starting tile, which can break movement for some creatures.
*/
/proc/get_swarm_path_to(atom/movable/caller, atom/end, max_distance = 30, mintargetdist, age = MAP_REUSE_INSTANT, access = list(), simulated_only = TRUE, turf/exclude, skip_first=TRUE)
/proc/get_swarm_path_to(atom/movable/requester, atom/end, max_distance = 30, mintargetdist, age = MAP_REUSE_INSTANT, access = list(), simulated_only = TRUE, turf/exclude, skip_first=TRUE)
var/list/hand_around = list()
// We're guarenteed that list will be the first list in pathfinding_finished's argset because of how callback handles the arguments list
var/datum/callback/await = list(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(pathfinding_finished), hand_around))
if(!SSpathfinder.swarmed_pathfind(caller, end, max_distance, mintargetdist, age, access, simulated_only, exclude, skip_first, await))
if(!SSpathfinder.swarmed_pathfind(requester, end, max_distance, mintargetdist, age, access, simulated_only, exclude, skip_first, await))
return list()

UNTIL(length(hand_around))
var/list/return_val = hand_around[1]
if(!islist(return_val) || (QDELETED(caller) || QDELETED(end))) // It's trash, just hand back empty to make it easy
if(!islist(return_val) || (QDELETED(requester) || QDELETED(end))) // It's trash, just hand back empty to make it easy
return list()
return return_val

/proc/get_sssp(atom/movable/caller, max_distance = 30, access = list(), simulated_only = TRUE, turf/exclude)
/proc/get_sssp(atom/movable/requester, max_distance = 30, access = list(), simulated_only = TRUE, turf/exclude)
var/list/hand_around = list()
// We're guarenteed that list will be the first list in pathfinding_finished's argset because of how callback handles the arguments list
var/datum/callback/await = list(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(pathfinding_finished), hand_around))
if(!SSpathfinder.build_map(caller, get_turf(caller), max_distance, access, simulated_only, exclude, await))
if(!SSpathfinder.build_map(requester, get_turf(requester), max_distance, access, simulated_only, exclude, await))
return null

UNTIL(length(hand_around))
var/datum/path_map/return_val = hand_around[1]
if(!istype(return_val, /datum/path_map) || (QDELETED(caller))) // It's trash, just hand back null to make it easy
if(!istype(return_val, /datum/path_map) || (QDELETED(requester))) // It's trash, just hand back null to make it easy
return null
return return_val

Expand Down Expand Up @@ -202,7 +202,7 @@
return modified_path

/**
* For seeing if we can actually move between 2 given turfs while accounting for our access and the caller's pass_flags
* For seeing if we can actually move between 2 given turfs while accounting for our access and the requester's pass_flags
*
* Assumes destinantion turf is non-dense - check and shortcircuit in code invoking this proc to avoid overhead.
* Makes some other assumptions, such as assuming that unless declared, non dense objects will not block movement.
Expand Down Expand Up @@ -315,7 +315,7 @@
/// Let's avoid this
var/camera_type

/// Weakref to the caller used to generate this info
/// Weakref to the requester used to generate this info
/// Should not use this almost ever, it's for context and to allow for proc chains that
/// Require a movable
var/datum/weakref/caller_ref = null
Expand Down
4 changes: 2 additions & 2 deletions code/__HELPERS/paths/sssp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@
/// Our current position in the working queue
var/working_index

/datum/pathfind/sssp/proc/setup(atom/movable/caller, list/access, turf/center, max_distance, simulated_only, turf/avoid, list/datum/callback/on_finish)
src.pass_info = new(caller, access)
/datum/pathfind/sssp/proc/setup(atom/movable/requester, list/access, turf/center, max_distance, simulated_only, turf/avoid, list/datum/callback/on_finish)
src.pass_info = new(requester, access)
src.start = center
src.max_distance = max_distance
src.simulated_only = simulated_only
Expand Down
22 changes: 11 additions & 11 deletions code/controllers/subsystem/pathfinder.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,31 +61,31 @@ SUBSYSTEM_DEF(pathfinder)
currentmaps.len--

/// Initiates a pathfind. Returns true if we're good, FALSE if something's failed
/datum/controller/subsystem/pathfinder/proc/pathfind(atom/movable/caller, atom/end, max_distance = 30, mintargetdist, access = list(), simulated_only = TRUE, turf/exclude, skip_first = TRUE, diagonal_handling = DIAGONAL_REMOVE_CLUNKY, list/datum/callback/on_finish)
/datum/controller/subsystem/pathfinder/proc/pathfind(atom/movable/requester, atom/end, max_distance = 30, mintargetdist, access = list(), simulated_only = TRUE, turf/exclude, skip_first = TRUE, diagonal_handling = DIAGONAL_REMOVE_CLUNKY, list/datum/callback/on_finish)
var/datum/pathfind/jps/path = new()
path.setup(caller, access, max_distance, simulated_only, exclude, on_finish, end, mintargetdist, skip_first, diagonal_handling)
path.setup(requester, access, max_distance, simulated_only, exclude, on_finish, end, mintargetdist, skip_first, diagonal_handling)
if(path.start())
active_pathing += path
return TRUE
return FALSE

/// Initiates a swarmed pathfind. Returns TRUE if we're good, FALSE if something's failed
/// If a valid pathmap exists for the TARGET turf we'll use that, otherwise we have to build a new one
/datum/controller/subsystem/pathfinder/proc/swarmed_pathfind(atom/movable/caller, atom/end, max_distance = 30, mintargetdist = 0, age = MAP_REUSE_INSTANT, access = list(), simulated_only = TRUE, turf/exclude, skip_first = TRUE, list/datum/callback/on_finish)
/datum/controller/subsystem/pathfinder/proc/swarmed_pathfind(atom/movable/requester, atom/end, max_distance = 30, mintargetdist = 0, age = MAP_REUSE_INSTANT, access = list(), simulated_only = TRUE, turf/exclude, skip_first = TRUE, list/datum/callback/on_finish)
var/turf/target = get_turf(end)
var/datum/can_pass_info/pass_info = new(caller, access)
var/datum/can_pass_info/pass_info = new(requester, access)
// If there's a map we can use already, use it
var/datum/path_map/valid_map = get_valid_map(pass_info, target, simulated_only, exclude, age, include_building = TRUE)
if(valid_map && valid_map.expand(max_distance))
path_map_passalong(on_finish, get_turf(caller), mintargetdist, skip_first, valid_map)
path_map_passalong(on_finish, get_turf(requester), mintargetdist, skip_first, valid_map)
return TRUE

// Otherwise we're gonna make a new one, and turn it into a path for the callbacks passed into us
var/list/datum/callback/pass_in = list()
pass_in += CALLBACK(GLOBAL_PROC, /proc/path_map_passalong, on_finish, get_turf(caller), mintargetdist, skip_first)
pass_in += CALLBACK(GLOBAL_PROC, /proc/path_map_passalong, on_finish, get_turf(requester), mintargetdist, skip_first)
// And to allow subsequent calls to reuse the same map, we'll put a placeholder in the cache, and fill it up when the pathing finishes
var/datum/path_map/empty = new()
empty.pass_info = new(caller, access)
empty.pass_info = new(requester, access)
empty.start = target
empty.pass_space = simulated_only
empty.avoid = exclude
Expand Down Expand Up @@ -133,9 +133,9 @@ SUBSYSTEM_DEF(pathfinder)
source_to_maps[target] -= same_target

/// Initiates a SSSP run. Returns true if we're good, FALSE if something's failed
/datum/controller/subsystem/pathfinder/proc/build_map(atom/movable/caller, turf/source, max_distance = 30, access = list(), simulated_only = TRUE, turf/exclude, list/datum/callback/on_finish)
/datum/controller/subsystem/pathfinder/proc/build_map(atom/movable/requester, turf/source, max_distance = 30, access = list(), simulated_only = TRUE, turf/exclude, list/datum/callback/on_finish)
var/datum/pathfind/sssp/path = new()
path.setup(caller, access, source, max_distance, simulated_only, exclude, on_finish)
path.setup(requester, access, source, max_distance, simulated_only, exclude, on_finish)
if(path.start())
active_pathing += path
return TRUE
Expand All @@ -160,7 +160,7 @@ SUBSYSTEM_DEF(pathfinder)
/// Optionally takes a max age to accept (defaults to 0 seconds) and a minimum acceptable range
/// If include_building is true and we can only find a building path, ew'll use that instead. tho we will wait for it to finish first
/datum/controller/subsystem/pathfinder/proc/get_valid_map(datum/can_pass_info/pass_info, turf/target, simulated_only = TRUE, turf/exclude, age = MAP_REUSE_INSTANT, min_range = -INFINITY, include_building = FALSE)
// Walk all the maps that match our caller's turf OR our target's
// Walk all the maps that match our requester's turf OR our target's
// Then hold onto em. If their cache time is short we can reuse/expand them, if not we'll have to make a new one
var/oldest_time = world.time - age
/// Backup return value used if no finished pathmaps are found
Expand Down Expand Up @@ -189,7 +189,7 @@ SUBSYSTEM_DEF(pathfinder)
/// Takes a set of pathfind info, returns all valid pathmaps that would work
/// Takes an optional minimum range arg
/datum/controller/subsystem/pathfinder/proc/get_valid_maps(datum/can_pass_info/pass_info, turf/target, simulated_only = TRUE, turf/exclude, age = MAP_REUSE_INSTANT, min_range = -INFINITY, include_building = FALSE)
// Walk all the maps that match our caller's turf OR our target's
// Walk all the maps that match our requester's turf OR our target's
// Then hold onto em. If their cache time is short we can reuse/expand them, if not we'll have to make a new one
var/list/valid_maps = list()
var/oldest_time = world.time - age
Expand Down
6 changes: 3 additions & 3 deletions code/datums/actions/cooldown_action.dm
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
return PreActivate(user)

/// Intercepts client owner clicks to activate the ability
/datum/action/cooldown/proc/InterceptClickOn(mob/living/caller, params, atom/target)
/datum/action/cooldown/proc/InterceptClickOn(mob/living/user, params, atom/target)
if(!IsAvailable(feedback = TRUE))
return FALSE
if(!target)
Expand All @@ -233,8 +233,8 @@

// And if we reach here, the action was complete successfully
if(unset_after_click)
unset_click_ability(caller, refund_cooldown = FALSE)
caller.next_click = world.time + click_cd_override
unset_click_ability(user, refund_cooldown = FALSE)
user.next_click = world.time + click_cd_override

return TRUE

Expand Down
8 changes: 4 additions & 4 deletions code/datums/actions/innate_action.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@
on_who.click_intercept = null

/// Handles whenever a mob clicks on something
/datum/action/innate/proc/InterceptClickOn(mob/living/caller, params, atom/clicked_on)
/datum/action/innate/proc/InterceptClickOn(mob/living/user, params, atom/clicked_on)
if(!IsAvailable(feedback = TRUE))
unset_ranged_ability(caller)
unset_ranged_ability(user)
return FALSE
if(!clicked_on)
return FALSE

return do_ability(caller, clicked_on)
return do_ability(user, clicked_on)

/// Actually goes through and does the click ability
/datum/action/innate/proc/do_ability(mob/living/caller, atom/clicked_on)
/datum/action/innate/proc/do_ability(mob/living/user, atom/clicked_on)
return FALSE

/datum/action/innate/Remove(mob/removed_from)
Expand Down
4 changes: 2 additions & 2 deletions code/datums/components/plumbing/_plumbing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@
tile_covered = should_hide
parent_obj.update_appearance()

/datum/component/plumbing/proc/change_ducting_layer(obj/caller, obj/changer, new_layer = DUCT_LAYER_DEFAULT)
/datum/component/plumbing/proc/change_ducting_layer(obj/user, obj/changer, new_layer = DUCT_LAYER_DEFAULT)
SIGNAL_HANDLER
ducting_layer = new_layer

Expand Down Expand Up @@ -393,7 +393,7 @@
demand_connects = NORTH
supply_connects = SOUTH

/datum/component/plumbing/manifold/change_ducting_layer(obj/caller, obj/changer, new_layer)
/datum/component/plumbing/manifold/change_ducting_layer(obj/user, obj/changer, new_layer)
return

#define READY 2
Expand Down
6 changes: 3 additions & 3 deletions code/datums/holocall.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
///calls from a head of staff autoconnect, if the receiving pad is not secure.
var/head_call = FALSE

//creates a holocall made by `caller` from `calling_pad` to `callees`
/datum/holocall/New(mob/living/caller, obj/machinery/holopad/calling_pad, list/callees, elevated_access = FALSE)
//creates a holocall made by `caller_user` from `calling_pad` to `callees`
/datum/holocall/New(mob/living/caller_user, obj/machinery/holopad/calling_pad, list/callees, elevated_access = FALSE)
call_start_time = world.time
user = caller
user = caller_user
calling_pad.outgoing_call = src
calling_holopad = calling_pad
head_call = elevated_access
Expand Down
6 changes: 3 additions & 3 deletions code/game/machinery/hologram.dm
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,9 @@ Possible to do for anyone motivated enough:
for(var/I in holo_calls)
var/datum/holocall/HC = I
var/list/call_data = list(
caller = HC.user,
connected = HC.connected_holopad == src ? TRUE : FALSE,
ref = REF(HC)
"caller" = HC.user,
"connected" = HC.connected_holopad == src ? TRUE : FALSE,
"ref" = REF(HC)
)
data["holo_calls"] += list(call_data)
return data
Expand Down
6 changes: 3 additions & 3 deletions code/game/machinery/porta_turret/portable_turret.dm
Original file line number Diff line number Diff line change
Expand Up @@ -708,13 +708,13 @@ DEFINE_BITFIELD(turret_flags, list(
remote_controller = null
return TRUE

/obj/machinery/porta_turret/proc/InterceptClickOn(mob/living/caller, params, atom/A)
/obj/machinery/porta_turret/proc/InterceptClickOn(mob/living/user, params, atom/A)
if(!manual_control)
return FALSE
if(!can_interact(caller))
if(!can_interact(user))
remove_control()
return FALSE
log_combat(caller,A,"fired with manual turret control at")
log_combat(user,A,"fired with manual turret control at")
target(A)
return TRUE

Expand Down
6 changes: 3 additions & 3 deletions code/game/turfs/turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -743,16 +743,16 @@ GLOBAL_LIST_EMPTY(station_turfs)
* Returns adjacent turfs to this turf that are reachable, in all cardinal directions
*
* Arguments:
* * caller: The movable, if one exists, being used for mobility checks to see what tiles it can reach
* * source: The movable, if one exists, being used for mobility checks to see what tiles it can reach
* * access: A list that decides if we can gain access to doors that would otherwise block a turf
* * simulated_only: Do we only worry about turfs with simulated atmos, most notably things that aren't space?
* * no_id: When true, doors with public access will count as impassible
*/
/turf/proc/reachableAdjacentTurfs(atom/movable/caller, list/access, simulated_only, no_id = FALSE)
/turf/proc/reachableAdjacentTurfs(atom/movable/source, list/access, simulated_only, no_id = FALSE)
var/static/space_type_cache = typecacheof(/turf/open/space)
. = list()

var/datum/can_pass_info/pass_info = new(caller, access, no_id)
var/datum/can_pass_info/pass_info = new(source, access, no_id)
for(var/iter_dir in GLOB.cardinals)
var/turf/turf_to_check = get_step(src,iter_dir)
if(!turf_to_check || (simulated_only && space_type_cache[turf_to_check.type]))
Expand Down
Loading

0 comments on commit dbcd7b2

Please sign in to comment.