From 793b2ce7754477952485a786fe5bf6bc32fcb9ab Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Mon, 23 Dec 2024 18:28:34 +0100 Subject: [PATCH] first --- code/__HELPERS/paths/path.dm | 26 +++++++++---------- code/__HELPERS/paths/sssp.dm | 4 +-- code/controllers/subsystem/pathfinder.dm | 22 ++++++++-------- code/datums/holocall.dm | 8 +++--- .../gamemodes/malfunction/Malf_Modules.dm | 4 +-- code/game/turfs/turf.dm | 6 ++--- .../contractor/datums/objective_contract.dm | 6 ++--- .../mob/living/simple_animal/bot/bot.dm | 8 +++--- .../hostile/megafauna/megafauna.dm | 9 ++++--- code/modules/shuttle/on_move.dm | 13 +++++++--- 10 files changed, 57 insertions(+), 49 deletions(-) diff --git a/code/__HELPERS/paths/path.dm b/code/__HELPERS/paths/path.dm index e01bea57f7c..e0ccc347da6 100644 --- a/code/__HELPERS/paths/path.dm +++ b/code/__HELPERS/paths/path.dm @@ -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. @@ -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 @@ -38,7 +38,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. @@ -48,30 +48,30 @@ * * 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 @@ -215,7 +215,7 @@ /** - * 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. @@ -323,7 +323,7 @@ /// Pass information for the object we are pulling, if any var/datum/can_pass_info/pulling_info = null - /// 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 diff --git a/code/__HELPERS/paths/sssp.dm b/code/__HELPERS/paths/sssp.dm index 38772f1620e..5e650216ca9 100644 --- a/code/__HELPERS/paths/sssp.dm +++ b/code/__HELPERS/paths/sssp.dm @@ -213,8 +213,8 @@ 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 diff --git a/code/controllers/subsystem/pathfinder.dm b/code/controllers/subsystem/pathfinder.dm index 379aedc77b2..664a79b7c69 100644 --- a/code/controllers/subsystem/pathfinder.dm +++ b/code/controllers/subsystem/pathfinder.dm @@ -64,9 +64,9 @@ SUBSYSTEM_DEF(pathfinder) /// 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 @@ -75,21 +75,21 @@ SUBSYSTEM_DEF(pathfinder) /// 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 @@ -141,9 +141,9 @@ SUBSYSTEM_DEF(pathfinder) /// 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 @@ -171,7 +171,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, we'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 @@ -201,7 +201,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 diff --git a/code/datums/holocall.dm b/code/datums/holocall.dm index 377c3a0f552..c7e645a29c6 100644 --- a/code/datums/holocall.dm +++ b/code/datums/holocall.dm @@ -20,10 +20,10 @@ var/call_start_time -//creates a holocall made by `caller` from `calling_pad` to `callees` -/datum/holocall/New(mob/living/caller, obj/machinery/hologram/holopad/calling_pad, list/callees) +//creates a holocall made by `requester` from `calling_pad` to `callees` +/datum/holocall/New(mob/living/requester, obj/machinery/hologram/holopad/calling_pad, list/callees) call_start_time = world.time - user = caller + user = requester calling_pad.outgoing_call = src calling_holopad = calling_pad dialed_holopads = list() @@ -34,7 +34,7 @@ dialed_holopads += H var/area/area = get_area(H) LAZYADD(H.holo_calls, src) - H.atom_say("[area] голопад звонит: входящий вызов от [caller]!") + H.atom_say("[area] голопад звонит: входящий вызов от [requester]!") if(!dialed_holopads.len) calling_holopad.atom_say("Сбой соединения.") diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm index c45c18d14bf..de5d8343e67 100644 --- a/code/game/gamemodes/malfunction/Malf_Modules.dm +++ b/code/game/gamemodes/malfunction/Malf_Modules.dm @@ -487,7 +487,7 @@ enable_text = "You tap into the station's powernet. Click on a machine to detonate it, or use the ability again to cancel." disable_text = "You release your hold on the powernet." -/obj/effect/proc_holder/ranged_ai/overload_machine/InterceptClickOn(mob/living/caller, params, obj/machinery/target) +/obj/effect/proc_holder/ranged_ai/overload_machine/InterceptClickOn(mob/living/requester, params, obj/machinery/target) if(..()) return if(ranged_ability_user.incapacitated()) @@ -542,7 +542,7 @@ enable_text = "You tap into the station's powernet. Click on a machine to animate it, or use the ability again to cancel." disable_text = "You release your hold on the powernet." -/obj/effect/proc_holder/ranged_ai/override_machine/InterceptClickOn(mob/living/caller, params, obj/machinery/target) +/obj/effect/proc_holder/ranged_ai/override_machine/InterceptClickOn(mob/living/requester, params, obj/machinery/target) if(..()) return if(ranged_ability_user.incapacitated()) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 337e11f4264..03351c6cad7 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -712,16 +712,16 @@ * 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 + * * requester: 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/requester, list/access, simulated_only, no_id = FALSE) var/static/space_type_cache = typecacheof(/turf/space) . = list() - var/datum/can_pass_info/pass_info = new(caller, access, no_id) + var/datum/can_pass_info/pass_info = new(requester, access, no_id) for(var/iter_dir in GLOB.cardinal) var/turf/turf_to_check = get_step(src, iter_dir) if(!turf_to_check || (simulated_only && space_type_cache[turf_to_check.type])) diff --git a/code/modules/antagonists/traitor/contractor/datums/objective_contract.dm b/code/modules/antagonists/traitor/contractor/datums/objective_contract.dm index 71b7e8920cf..6fe5ac0e6b4 100644 --- a/code/modules/antagonists/traitor/contractor/datums/objective_contract.dm +++ b/code/modules/antagonists/traitor/contractor/datums/objective_contract.dm @@ -260,7 +260,7 @@ * Returns whether the extraction process can be started. * * Arguments: - * * caller - The person trying to call the extraction. + * * requester - The person trying to call the extraction. */ -/datum/objective/contract/proc/can_start_extraction_process(mob/living/carbon/human/caller) - return get_area(caller) == extraction_zone && get_area(target.current) == extraction_zone +/datum/objective/contract/proc/can_start_extraction_process(mob/living/carbon/human/requester) + return get_area(requester) == extraction_zone && get_area(target.current) == extraction_zone diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index e1d9a031e38..2199f6168da 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -681,8 +681,8 @@ Pass the desired type path itself, declaring a temporary var beforehand is not r access_card.access = prev_access -/mob/living/simple_animal/bot/proc/call_bot(caller, turf/waypoint, message = TRUE) - if(isAI(caller) && calling_ai && calling_ai != src) //Prevents an override if another AI is controlling this bot. +/mob/living/simple_animal/bot/proc/call_bot(requester, turf/waypoint, message = TRUE) + if(isAI(requester) && calling_ai && calling_ai != src) //Prevents an override if another AI is controlling this bot. return FALSE bot_reset() //Reset a bot before setting it to call mode. @@ -694,7 +694,7 @@ Pass the desired type path itself, declaring a temporary var beforehand is not r all_access.access = get_all_accesses() set_path(get_path_to(src, waypoint, max_distance = 200, access = all_access.GetAccess())) - calling_ai = caller //Link the AI to the bot! + calling_ai = requester //Link the AI to the bot! ai_waypoint = waypoint if(path && length(path)) //Ensures that a valid path is calculated! @@ -704,7 +704,7 @@ Pass the desired type path itself, declaring a temporary var beforehand is not r access_card.access = all_access.GetAccess() //Give the bot all-access while under the AI's command. if(client) reset_access_timer_id = addtimer(CALLBACK(src, PROC_REF(bot_reset)), 60 SECONDS, TIMER_UNIQUE|TIMER_OVERRIDE|TIMER_STOPPABLE) //if the bot is player controlled, they get the extra access for a limited time - to_chat(src, span_notice("[span_big("Приоритетный маршрут установлен [calling_ai] [caller]. Проследуйте в локацию [end_area.name].")]
[path.len-1]
метров до точки назначения. Вам выдан неограниченный доступ к шлюзам на следующие 60 секунд.")) + to_chat(src, span_notice("[span_big("Приоритетный маршрут установлен [calling_ai] [requester]. Проследуйте в локацию [end_area.name].")]
[path.len-1]
метров до точки назначения. Вам выдан неограниченный доступ к шлюзам на следующие 60 секунд.")) if(message) to_chat(calling_ai, span_notice("[bicon(src)] [capitalize(declent_ru(NOMINATIVE))] вызван в локацию [end_area.name]. [length(path)-1] метров до точки назначения.")) pathset = TRUE diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm index fd85acf4831..4b250d58fbe 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm @@ -117,14 +117,17 @@ if(!istype(get_area(src), /area/shuttle)) //I'll be funny and make non teleported enrage mobs not lose enrage. Harder to pull off, and also funny when it happens accidently. Or if one gets on the escape shuttle. unrage() -/mob/living/simple_animal/hostile/megafauna/onShuttleMove(turf/oldT, turf/T1, rotation, mob/caller) +/mob/living/simple_animal/hostile/megafauna/onShuttleMove(turf/oldT, turf/T1, rotation, mob/requester) var/turf/oldloc = loc . = ..() + if(!.) return + var/turf/newloc = loc - mob_attack_logs += "[time_stamp()] Moved via shuttle from [COORD(oldloc)] to [COORD(newloc)] caller: [caller ? "[caller]" : "unknown" ]" - message_admins("Megafauna[stat == DEAD ? "(DEAD)" : null] [src] ([ADMIN_FLW(src,"FLW")]) moved via shuttle from [ADMIN_COORDJMP(oldloc)] to [ADMIN_COORDJMP(newloc)][caller ? " called by [ADMIN_LOOKUPFLW(caller)]" : ""]") + + mob_attack_logs += "[time_stamp()] Moved via shuttle from [COORD(oldloc)] to [COORD(newloc)] requester: [requester ? "[requester]" : "unknown" ]" + message_admins("Megafauna[stat == DEAD ? "(DEAD)" : null] [src] ([ADMIN_FLW(src,"FLW")]) moved via shuttle from [ADMIN_COORDJMP(oldloc)] to [ADMIN_COORDJMP(newloc)][requester ? " called by [ADMIN_LOOKUPFLW(requester)]" : ""]") /mob/living/simple_animal/hostile/megafauna/proc/devour(mob/living/L) if(!L) diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm index 466fa7050d5..c9fc25865e3 100644 --- a/code/modules/shuttle/on_move.dm +++ b/code/modules/shuttle/on_move.dm @@ -1,25 +1,30 @@ // Shuttle on-movement // -/atom/movable/proc/onShuttleMove(turf/oldT, turf/T1, rotation, mob/caller) +/atom/movable/proc/onShuttleMove(turf/oldT, turf/T1, rotation, mob/requester) if(light && light_system == STATIC_LIGHT) update_light() + if(rotation) shuttleRotate(rotation) + forceMove(T1) SSdemo.mark_dirty(src) - return 1 + + return TRUE /obj/effect/landmark/shuttle_import/onShuttleMove() // Used for marking where to preview/load shuttles - return 0 + return FALSE /obj/docking_port/onShuttleMove() // Stationary ports shouldn't move, mobile ones move themselves - return 0 + return FALSE /obj/machinery/door/airlock/onShuttleMove() . = ..() + if(!.) return + INVOKE_ASYNC(src, PROC_REF(close), 0, 1) // Close any nearby airlocks as well for(var/obj/machinery/door/airlock/D in orange(1, src))