-
Notifications
You must be signed in to change notification settings - Fork 439
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Opacity Standartisation (#5258)
* Opacity Standartization * Typo
- Loading branch information
Showing
64 changed files
with
298 additions
and
276 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,47 @@ | ||
/** | ||
* Attached to movable atoms with opacity. Listens to them move and updates their old and new turf loc's opacity accordingly. | ||
*/ | ||
/datum/element/light_blocking | ||
element_flags = ELEMENT_DETACH | ||
|
||
|
||
/datum/element/light_blocking/Attach(datum/target) | ||
. = ..() | ||
if(!ismovable(target)) | ||
return ELEMENT_INCOMPATIBLE | ||
RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(on_target_move)) | ||
var/atom/movable/movable_target = target | ||
if(!isturf(movable_target.loc)) | ||
return | ||
for(var/turf/turf_loc as anything in movable_target.locs) | ||
turf_loc.add_opacity_source(target) | ||
|
||
|
||
/datum/element/light_blocking/Detach(datum/target) | ||
. = ..() | ||
var/atom/movable/movable_target = target | ||
UnregisterSignal(movable_target, COMSIG_MOVABLE_MOVED) | ||
if(!isturf(movable_target.loc)) | ||
return | ||
for(var/turf/turf_loc as anything in movable_target.locs) | ||
turf_loc.remove_opacity_source(target) | ||
|
||
|
||
///Updates old and new turf loc opacities. | ||
/datum/element/light_blocking/proc/on_target_move(atom/movable/source, atom/old_loc, dir, forced, list/old_locs) | ||
SIGNAL_HANDLER | ||
if(isturf(old_loc)) | ||
var/turf/old_turf = old_loc | ||
old_turf.remove_opacity_source(source) | ||
/* | ||
if(old_locs) | ||
for(var/turf/old_turf as anything in old_locs) // after movement refactor | ||
old_turf.remove_opacity_source(source) | ||
else | ||
var/turf/old_turf = old_loc | ||
old_turf.remove_opacity_source(source) | ||
*/ | ||
if(isturf(source.loc)) | ||
for(var/turf/new_turf as anything in source.locs) | ||
new_turf.add_opacity_source(source) | ||
|
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.