forked from Skyrat-SS13/Skyrat-tg
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #548 from Werenimal/master
Pubby Update
- Loading branch information
Showing
90 changed files
with
896 additions
and
640 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,56 @@ | ||
/** | ||
* ## block_turf_fingerprints | ||
* | ||
* Attach to a movable, prevents mobs from leaving fingerprints on the turf below it | ||
*/ | ||
/datum/element/block_turf_fingerprints | ||
element_flags = ELEMENT_DETACH_ON_HOST_DESTROY | ||
|
||
/datum/element/block_turf_fingerprints/Attach(datum/target) | ||
. = ..() | ||
if(!ismovable(target)) | ||
return ELEMENT_INCOMPATIBLE | ||
|
||
var/atom/movable/target_movable = target | ||
if(isturf(target_movable.loc)) | ||
apply_to_turf(target_movable.loc) | ||
|
||
RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(move_turf)) | ||
|
||
/datum/element/block_turf_fingerprints/Detach(atom/movable/target) | ||
. = ..() | ||
if(isturf(target.loc)) | ||
remove_from_turf(target.loc) | ||
|
||
UnregisterSignal(target, COMSIG_MOVABLE_MOVED) | ||
|
||
/datum/element/block_turf_fingerprints/proc/apply_to_turf(turf/the_turf) | ||
// It's possible two things with this element could be on the same turf, so let's avoid double-applying | ||
if(the_turf.interaction_flags_atom & INTERACT_ATOM_NO_FINGERPRINT_ATTACK_HAND) | ||
// But what if the turf has this flag by default? We still need to override register a signal. | ||
// Otherwise we may run into a very niche bug: | ||
// - A turf as this flag by default | ||
// - A movable with this element is placed on the turf | ||
// - It does not gain the flag nor register a signal | ||
// - The turf changes, and the new turf does not gain the flag | ||
if(initial(the_turf.interaction_flags_atom) & INTERACT_ATOM_NO_FINGERPRINT_ATTACK_HAND) | ||
RegisterSignal(the_turf, COMSIG_TURF_CHANGE, PROC_REF(replace_our_turf), override = TRUE) | ||
return | ||
|
||
the_turf.interaction_flags_atom |= INTERACT_ATOM_NO_FINGERPRINT_ATTACK_HAND | ||
RegisterSignal(the_turf, COMSIG_TURF_CHANGE, PROC_REF(replace_our_turf)) | ||
|
||
/datum/element/block_turf_fingerprints/proc/remove_from_turf(turf/the_turf) | ||
the_turf.interaction_flags_atom &= ~INTERACT_ATOM_NO_FINGERPRINT_ATTACK_HAND | ||
UnregisterSignal(the_turf, COMSIG_TURF_CHANGE) | ||
|
||
/datum/element/block_turf_fingerprints/proc/move_turf(atom/movable/source, atom/old_loc) | ||
SIGNAL_HANDLER | ||
if(isturf(old_loc)) | ||
remove_from_turf(old_loc) | ||
if(isturf(source.loc)) | ||
apply_to_turf(source.loc) | ||
|
||
/datum/element/block_turf_fingerprints/proc/replace_our_turf(datum/source, path, new_baseturfs, flags, post_change_callbacks) | ||
SIGNAL_HANDLER | ||
post_change_callbacks += CALLBACK(src, PROC_REF(apply_to_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
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
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.