-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Movement cross/uncross implementation. (#26762)
* refactor: Movement cross/uncross implementation. * wrong var name * fix unit tests dropping PDAs into nowhere * Add documentation. * remove unused constants * say which procs are off limits * fix simpleanimal z change runtime * helps not to leave merge conflicts * kill me * fix typecast * fix projectile/table collision * treadmills don't cause MC to crash anymore * connect_loc is appropriate here * fix windoors and teleporters * fix bonfires and clarify docs * fix proximity sensors Tested with sensors in crates, sensors in modsuits Tested new proximity component with firing projectiles at singularity Tested new proximity component with portable flashes Tested new proximity component with facehuggers * lint * fix: polarized access helper false positives * Revert "fix: polarized access helper false positives" This reverts commit 9814f98. * hopefully the right change for mindflayer steam * Changes following cameras * fix glass table collision * appears to fix doorspam * fix ore bags not picking up ore * fix signatures of /Exited * remove debug log * remove duplicate signal registrar * fix emptying bags into locations * I don't trust these nested Move calls * use connect_loc for upgraded resonator fields * use moveToNullspace * fix spiderweb crossing * fix pass checking for windows from a tile off * fix bluespace closet/transparency issues * fix mechs not interacting with doors and probably other things * fix debug * fix telepete * add some docs * stop trying to shoehorn prox monitor into cards * I should make sure things build * kill override signal warning * undef signal * not many prox monitors survive going off like this * small fixes to storage * make moving wormholes respect signals * use correct signals for pulse demon * fix pulse heart too * fix smoke signals * may have fucked singulo projectile swerve * fix singulo projectile arcing * remove duplicate define * just look at it * hopefully last cleanups of incorrect signal usage * fix squeaking * may god have mercy on my soul * Apply suggestions from code review Co-authored-by: Luc <[email protected]> Signed-off-by: warriorstar-orion <[email protected]> * lewc review * Apply suggestions from code review Co-authored-by: Burzah <[email protected]> Signed-off-by: warriorstar-orion <[email protected]> * burza review * fix bad args for grenade assemblies * Update code/__DEFINES/is_helpers.dm Co-authored-by: Luc <[email protected]> Signed-off-by: warriorstar-orion <[email protected]> --------- Signed-off-by: warriorstar-orion <[email protected]> Co-authored-by: DGamerL <[email protected]> Co-authored-by: Luc <[email protected]> Co-authored-by: Burzah <[email protected]>
- Loading branch information
1 parent
3a3bdc8
commit 79bad42
Showing
175 changed files
with
2,494 additions
and
1,325 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/// The arguments of this macro correspond directly to the argument order of /atom/movable/proc/Moved | ||
#define SET_ACTIVE_MOVEMENT(_old_loc, _direction, _forced, _oldlocs) \ | ||
active_movement = list( \ | ||
_old_loc, \ | ||
_direction, \ | ||
_forced, \ | ||
_oldlocs, \ | ||
) | ||
|
||
/// Finish any active movements | ||
#define RESOLVE_ACTIVE_MOVEMENT \ | ||
if(active_movement) { \ | ||
var/__move_args = active_movement; \ | ||
active_movement = null; \ | ||
Moved(arglist(__move_args)); \ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/// Returns a list of all locations (except the area) the movable is within. | ||
/proc/get_nested_locs(atom/movable/atom_on_location, include_turf = FALSE) | ||
. = list() | ||
var/atom/location = atom_on_location.loc | ||
var/turf/our_turf = get_turf(atom_on_location) | ||
while(location && location != our_turf) | ||
. += location | ||
location = location.loc | ||
if(our_turf && include_turf) // At this point, only the turf is left, provided it exists. | ||
. += our_turf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
#define COMSIG_CARD_DECK_FIELD_CLEAR "card_deck_field_clear" | ||
|
||
/datum/card_deck_table_tracker | ||
/// How far away you can be (in terms of table squares). | ||
var/max_table_distance | ||
/// How far away you can be (euclidean distance). | ||
var/max_total_distance | ||
/// The UID of the deck | ||
var/deck_uid | ||
/// Indicate field activity with colors on the field's turfs. | ||
var/debug = FALSE | ||
/// The deck we're tracking. | ||
var/atom/host | ||
|
||
/// The list of floors from which a player can access the card field. | ||
var/list/floors = list() | ||
/// The list of tables that the card deck's location is contiguous with. | ||
var/list/tables = list() | ||
|
||
/datum/card_deck_table_tracker/New(atom/host_, max_table_distance_ = 5) | ||
max_table_distance = max_table_distance_ | ||
max_total_distance = max_table_distance_ | ||
if(istype(host_, /obj/item/deck)) | ||
// this is important for tracking traits and attacking multiple cards. so it's not a true UID, sue me | ||
var/obj/item/deck/D = host_ | ||
deck_uid = D.main_deck_id | ||
else | ||
deck_uid = host_.UID() | ||
|
||
host = host_ | ||
RegisterSignal(host, COMSIG_MOVABLE_MOVED, PROC_REF(on_movable_moved)) | ||
lay_out_field() | ||
|
||
/datum/card_deck_table_tracker/proc/on_movable_moved(datum/source, atom/old_loc, direction, forced) | ||
SIGNAL_HANDLER // COMSIG_MOVABLE_MOVED | ||
lay_out_field() | ||
|
||
/datum/card_deck_table_tracker/proc/lay_out_field() | ||
for(var/turf/floor in floors) | ||
SEND_SIGNAL(floor, COMSIG_CARD_DECK_FIELD_CLEAR) | ||
|
||
if(!isturf(host.loc)) | ||
return | ||
|
||
floors.Cut() | ||
tables.Cut() | ||
|
||
crawl_along(host.loc, 0) | ||
|
||
for(var/obj/structure/table in tables) | ||
if(istype(table)) | ||
RegisterSignal(table, COMSIG_PARENT_QDELETING, PROC_REF(on_table_qdel), override = TRUE) | ||
|
||
for(var/turf/turf in floors) | ||
if(!istype(turf)) | ||
continue | ||
|
||
if(debug) | ||
turf.color = "#ffaaff" | ||
|
||
RegisterSignal(turf, COMSIG_ATOM_ENTERED, PROC_REF(on_atom_entered)) | ||
RegisterSignal(turf, COMSIG_ATOM_EXITED, PROC_REF(on_atom_exited)) | ||
RegisterSignal(turf, COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZED_ON, PROC_REF(on_new_atom_at_loc)) | ||
RegisterSignal(turf, COMSIG_CARD_DECK_FIELD_CLEAR, PROC_REF(on_card_deck_field_clear)) | ||
|
||
for(var/mob/living/L in turf) | ||
on_atom_entered(turf, L) | ||
|
||
/datum/card_deck_table_tracker/Destroy(force, ...) | ||
host = null | ||
for(var/turf/floor in floors) | ||
SEND_SIGNAL(floor, COMSIG_CARD_DECK_FIELD_CLEAR) | ||
for(var/mob/living/L in floor) | ||
REMOVE_TRAIT(L, TRAIT_PLAYING_CARDS, "deck_[deck_uid]") | ||
|
||
floors.Cut() | ||
tables.Cut() | ||
|
||
return ..() | ||
|
||
/datum/card_deck_table_tracker/proc/on_atom_entered(turf/source, atom/movable/entered, old_loc) | ||
SIGNAL_HANDLER // COMSIG_ATOM_ENTERED | ||
|
||
var/mob/living/L = entered | ||
if(istype(L)) | ||
ADD_TRAIT(L, TRAIT_PLAYING_CARDS, "deck_[deck_uid]") | ||
if(debug) | ||
source.color = "#ff0000" | ||
|
||
/datum/card_deck_table_tracker/proc/on_atom_exited(turf/source, atom/movable/exited, direction) | ||
SIGNAL_HANDLER // COMSIG_ATOM_EXITED | ||
|
||
var/mob/living/L = exited | ||
if(istype(L)) | ||
REMOVE_TRAIT(L, TRAIT_PLAYING_CARDS, "deck_[deck_uid]") | ||
if(debug) | ||
source.color = "#ffaaff" | ||
|
||
/datum/card_deck_table_tracker/proc/on_table_qdel(datum/source) | ||
SIGNAL_HANDLER // COMSIG_PARENT_QDELETING | ||
lay_out_field() | ||
|
||
/datum/card_deck_table_tracker/proc/on_new_atom_at_loc(turf/location, atom/created, init_flags) | ||
SIGNAL_HANDLER // COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZED_ON | ||
if(istable(created)) | ||
lay_out_field() | ||
|
||
/datum/card_deck_table_tracker/proc/on_card_deck_field_clear(atom/target) | ||
SIGNAL_HANDLER // COMSIG_CARD_DECK_FIELD_CLEAR | ||
if(debug) | ||
target.color = initial(target.color) | ||
|
||
UnregisterSignal(target, list( | ||
COMSIG_ATOM_ENTERED, | ||
COMSIG_ATOM_EXITED, | ||
COMSIG_CARD_DECK_FIELD_CLEAR, | ||
COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZED_ON, | ||
)) | ||
|
||
/datum/card_deck_table_tracker/proc/crawl_along(turf/current_turf, distance_from_start) | ||
var/obj/structure/current_table = locate(/obj/structure/table) in current_turf | ||
|
||
if(QDELETED(current_table)) | ||
// if there's no table here, we're still adjacent to a table, so this is a spot you could play from | ||
floors |= current_turf | ||
return | ||
|
||
if(current_table in tables) | ||
return | ||
|
||
tables |= current_table | ||
floors |= current_turf | ||
|
||
if(distance_from_start + 1 > max_table_distance) | ||
return | ||
|
||
for(var/direction in GLOB.alldirs) | ||
var/turf/next_turf = get_step(current_table, direction) | ||
if(!istype(next_turf)) | ||
continue | ||
if(get_dist_euclidian(get_turf(host), next_turf) > max_total_distance) | ||
continue | ||
.(next_turf, distance_from_start + 1) | ||
|
||
#undef COMSIG_CARD_DECK_FIELD_CLEAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.