-
Notifications
You must be signed in to change notification settings - Fork 565
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extracts properties of effects into elements
- Also adds an afterimage effect, no applications yet
- Loading branch information
1 parent
a843f72
commit f96d098
Showing
21 changed files
with
195 additions
and
148 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/// Assigns an effects appearance to the appearance of a target atom | ||
/datum/element/copy_appearance | ||
|
||
/datum/element/copy_appearance/Attach(datum/target, atom/to_copy) | ||
. = ..() | ||
if (. == ELEMENT_INCOMPATIBLE) | ||
return | ||
if (!istype(target, /obj/effect)) | ||
return ELEMENT_INCOMPATIBLE | ||
if (!isatom(to_copy)) | ||
return ELEMENT_INCOMPATIBLE | ||
var/obj/effect/effect = target | ||
effect.name = to_copy.name | ||
effect.appearance = to_copy.appearance | ||
effect.setDir(to_copy.dir) | ||
effect.mouse_opacity = MOUSE_OPACITY_TRANSPARENT |
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 @@ | ||
/// Causes effect to fade over a specific duration | ||
/datum/element/fading | ||
|
||
/datum/element/fading/Attach(datum/target, duration) | ||
. = ..() | ||
if (. == ELEMENT_INCOMPATIBLE) | ||
return | ||
if (!istype(target, /obj/effect)) | ||
return ELEMENT_INCOMPATIBLE | ||
animate(target, alpha = 0, time = duration) |
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,24 @@ | ||
/// Does a pixel shift animation towards a specific target | ||
/datum/element/pixel_shifting | ||
|
||
/** | ||
* Function to attach the `shifting` element to the effect | ||
* | ||
* Params: | ||
* - target (/datum): The effect we are attaching to, should be of type /obj/effect unless you messed up | ||
* - to_shift_towards (/atom): The atom the effect will pixel shift towards | ||
* - distance_ratio (num): The percentage of the distance between the effect and `to_shift_towards` that the effect should cover (0 <= distance_ratio <= 1) | ||
* - duration (num): Duration of the animation (i.e. how fast the effect will pixel shift to its destination) | ||
*/ | ||
/datum/element/pixel_shifting/Attach(datum/target, atom/to_shift_towards, distance_ratio = 1, duration) | ||
. = ..() | ||
if (. == ELEMENT_INCOMPATIBLE) | ||
return | ||
if (!istype(target, /obj/effect)) | ||
return ELEMENT_INCOMPATIBLE | ||
if (!istype(to_shift_towards)) | ||
return ELEMENT_INCOMPATIBLE | ||
var/obj/effect/effect = target | ||
var/x_displacement = floor((to_shift_towards.x - effect.x) * distance_ratio * world.icon_size) | ||
var/y_displacement = floor((to_shift_towards.y - effect.y) * distance_ratio * world.icon_size) | ||
animate(target, pixel_x = x_displacement, pixel_y = y_displacement, time = duration) |
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,15 @@ | ||
/// Sets an effect to delete itself after a specific amount of time | ||
/datum/element/temporary | ||
|
||
/datum/element/temporary/Attach(datum/target, duration) | ||
. = ..() | ||
if (. == ELEMENT_INCOMPATIBLE) | ||
return | ||
if (!istype(target, /obj/effect)) | ||
return ELEMENT_INCOMPATIBLE | ||
addtimer(CALLBACK(src, PROC_REF(delete_effect), WEAKREF(target)), duration) | ||
|
||
/datum/element/temporary/proc/delete_effect(datum/weakref/target_ref) | ||
SIGNAL_HANDLER | ||
if (target_ref.resolve()) | ||
qdel(target_ref) |
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 @@ | ||
/obj/effect/afterimage | ||
as_image = TRUE | ||
|
||
/** | ||
* Params: | ||
* - mapload: Whether effect is maploaded | ||
* - to_copy: The atom that has an afterimage | ||
* - fading_duration: How long it takes for afterimage to fade | ||
* - fading_to_shift_ratio: How quickly afterimage will reach its target atom before fading (relative to the fading time) | ||
*/ | ||
/obj/effect/afterimage/Initialize(mapload, atom/to_copy, fading_duration, fading_to_shift_ratio = 0.5) | ||
. = ..() | ||
AddElement(/datum/element/temporary, fading_duration) | ||
AddElement(/datum/element/copy_appearance, to_copy) | ||
AddElement(/datum/element/fading, fading_duration) | ||
AddElement(/datum/element/pixel_shifting, to_copy, 1, floor(fading_duration * fading_to_shift_ratio)) |
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,67 @@ | ||
//------------------------------------------ | ||
//BLOOD HITS | ||
//------------------------------------------ | ||
|
||
/obj/effect/bloodsplatter | ||
icon = 'icons/effects/blood.dmi' | ||
var/duration = 5 | ||
layer = ABOVE_XENO_LAYER | ||
var/splatter_type = "splatter" | ||
|
||
/obj/effect/bloodsplatter/Initialize(mapload, set_dir, fx_duration, color_override) | ||
. = ..() | ||
if(color_override) | ||
color = color_override | ||
if(IS_DIAGONAL_DIR(set_dir)) | ||
icon_state = "[splatter_type][pick(1, 2, 6)]" | ||
else | ||
icon_state = "[splatter_type][pick(3, 4, 5)]" | ||
if(fx_duration) | ||
duration = fx_duration | ||
setDir(set_dir) | ||
AddElement(/datum/element/temporary, duration) | ||
var/target_pixel_x = 0 | ||
var/target_pixel_y = 0 | ||
switch(set_dir) | ||
if(NORTH) | ||
target_pixel_y = 16 | ||
if(SOUTH) | ||
target_pixel_y = -16 | ||
if(EAST) | ||
target_pixel_x = 16 | ||
if(WEST) | ||
target_pixel_x = -16 | ||
if(NORTHEAST) | ||
target_pixel_x = 16 | ||
target_pixel_y = 16 | ||
if(NORTHWEST) | ||
target_pixel_x = -16 | ||
target_pixel_y = 16 | ||
if(SOUTHEAST) | ||
target_pixel_x = 16 | ||
target_pixel_y = -16 | ||
if(SOUTHWEST) | ||
target_pixel_x = -16 | ||
target_pixel_y = -16 | ||
animate(src, pixel_x = target_pixel_x, pixel_y = target_pixel_y, alpha = 0, time = duration) | ||
|
||
|
||
/obj/effect/bloodsplatter/xenosplatter | ||
splatter_type = "csplatter" | ||
color = BLOOD_COLOR_XENO | ||
|
||
/obj/effect/bloodsplatter/human | ||
splatter_type = "csplatter" | ||
color = BLOOD_COLOR_HUMAN | ||
|
||
/obj/effect/bloodsplatter/hellhound | ||
splatter_type = "csplatter" | ||
color = BLOOD_COLOR_YAUTJA | ||
|
||
/obj/effect/bloodsplatter/yautjasplatter | ||
splatter_type = "csplatter" | ||
color = BLOOD_COLOR_YAUTJA_DARK | ||
|
||
/obj/effect/bloodsplatter/synthsplatter | ||
splatter_type = "csplatter" | ||
color = BLOOD_COLOR_SYNTHETIC |
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,22 @@ | ||
//------------------------------------------ | ||
//Shockwaves | ||
//------------------------------------------ | ||
|
||
/obj/effect/shockwave | ||
icon = 'icons/effects/light_overlays/shockwave.dmi' | ||
icon_state = "shockwave" | ||
plane = DISPLACEMENT_PLATE_RENDER_LAYER | ||
pixel_x = -496 | ||
pixel_y = -496 | ||
|
||
/obj/effect/shockwave/Initialize(mapload, radius, speed, easing_type = LINEAR_EASING, y_offset, x_offset) | ||
. = ..() | ||
if(!speed) | ||
speed = 1 | ||
if(y_offset) | ||
pixel_y += y_offset | ||
if(x_offset) | ||
pixel_x += x_offset | ||
AddElement(/datum/element/temporary, 0.5 * radius * speed) | ||
transform = matrix().Scale(32 / 1024, 32 / 1024) | ||
animate(src, time = 0.5 * radius * speed, transform=matrix().Scale((32 / 1024) * radius * 1.5, (32 / 1024) * radius * 1.5), easing = easing_type) |
This file was deleted.
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
Oops, something went wrong.