-
Notifications
You must be signed in to change notification settings - Fork 819
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* doneso * complete the sentence * remove var * / * fix args * cleanup * blooom * requests * stuff * elementify * how * remove filter add scaling * adjust fix sound * remove sparks from resin
- Loading branch information
Showing
25 changed files
with
266 additions
and
66 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#define DEBRIS_SPARKS "spark" | ||
#define DEBRIS_WOOD "wood" | ||
#define DEBRIS_ROCK "rock" | ||
#define DEBRIS_GLASS "glass" | ||
#define DEBRIS_LEAF "leaf" | ||
#define DEBRIS_SNOW "snow" |
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,94 @@ | ||
|
||
/particles/debris | ||
icon = 'icons/effects/particles/generic_particles.dmi' | ||
width = 500 | ||
height = 500 | ||
count = 10 | ||
spawning = 10 | ||
lifespan = 0.7 SECONDS | ||
fade = 0.4 SECONDS | ||
drift = generator(GEN_CIRCLE, 0, 7) | ||
scale = 0.7 | ||
velocity = list(50, 0) | ||
friction = generator(GEN_NUM, 0.1, 0.15) | ||
spin = generator(GEN_NUM, -20, 20) | ||
|
||
/particles/impact_smoke | ||
icon = 'icons/effects/effects.dmi' | ||
icon_state = "smoke" | ||
width = 500 | ||
height = 500 | ||
count = 20 | ||
spawning = 20 | ||
lifespan = 0.7 SECONDS | ||
fade = 8 SECONDS | ||
grow = 0.1 | ||
scale = 0.2 | ||
spin = generator(GEN_NUM, -20, 20) | ||
velocity = list(50, 0) | ||
friction = generator(GEN_NUM, 0.1, 0.5) | ||
|
||
/datum/element/debris | ||
element_flags = ELEMENT_BESPOKE | ||
argument_hash_start_idx = 2 | ||
|
||
///Icon state of debris when impacted by a projectile | ||
var/debris = null | ||
///Velocity of debris particles | ||
var/debris_velocity = -15 | ||
///Amount of debris particles | ||
var/debris_amount = 8 | ||
///Scale of particle debris | ||
var/debris_scale = 0.7 | ||
|
||
/datum/element/debris/Attach(datum/target, _debris_icon_state, _debris_velocity = -15, _debris_amount = 8, _debris_scale = 0.7) | ||
. = ..() | ||
debris = _debris_icon_state | ||
debris_velocity = _debris_velocity | ||
debris_amount = _debris_amount | ||
debris_scale = _debris_scale | ||
RegisterSignal(target, COMSIG_ATOM_BULLET_ACT, PROC_REF(register_for_impact)) | ||
|
||
/datum/element/debris/Detach(datum/source, force) | ||
. = ..() | ||
UnregisterSignal(source, COMSIG_ATOM_BULLET_ACT) | ||
|
||
/datum/element/debris/proc/register_for_impact(datum/source, obj/projectile/proj) | ||
SIGNAL_HANDLER | ||
INVOKE_ASYNC(src, PROC_REF(on_impact), source, proj) | ||
|
||
/datum/element/debris/proc/on_impact(datum/source, obj/projectile/P) | ||
if(!P.ammo.ping) | ||
return | ||
var/angle = !isnull(P.dir_angle) ? P.dir_angle : round(Get_Angle(P.starting_turf, source), 1) | ||
var/x_component = sin(angle) * debris_velocity | ||
var/y_component = cos(angle) * debris_velocity | ||
var/x_component_smoke = sin(angle) * -15 | ||
var/y_component_smoke = cos(angle) * -15 | ||
var/obj/effect/abstract/particle_holder/debris_visuals | ||
var/obj/effect/abstract/particle_holder/smoke_visuals | ||
var/position_offset = rand(-6,6) | ||
smoke_visuals = new(source, /particles/impact_smoke) | ||
smoke_visuals.particles.position = list(position_offset, position_offset) | ||
smoke_visuals.particles.velocity = list(x_component_smoke, y_component_smoke) | ||
if(debris && !(P.ammo.flags_ammo_behavior & AMMO_ENERGY || P.ammo.flags_ammo_behavior & AMMO_XENO)) | ||
debris_visuals = new(source, /particles/debris) | ||
debris_visuals.particles.position = generator(GEN_CIRCLE, position_offset, position_offset) | ||
debris_visuals.particles.velocity = list(x_component, y_component) | ||
debris_visuals.layer = ABOVE_OBJ_LAYER + 0.02 | ||
debris_visuals.particles.icon_state = debris | ||
debris_visuals.particles.count = debris_amount | ||
debris_visuals.particles.spawning = debris_amount | ||
debris_visuals.particles.scale = debris_scale | ||
smoke_visuals.layer = ABOVE_OBJ_LAYER + 0.01 | ||
if(P.ammo.sound_bounce) | ||
var/pitch = 0 | ||
if(P.ammo.flags_ammo_behavior & AMMO_SOUND_PITCH) | ||
pitch = 55000 | ||
playsound(source, P.ammo.sound_bounce, 50, 1, frequency = pitch) | ||
addtimer(CALLBACK(src, PROC_REF(remove_ping), src, smoke_visuals, debris_visuals), 0.7 SECONDS) | ||
|
||
/datum/element/debris/proc/remove_ping(hit, obj/effect/abstract/particle_holder/smoke_visuals, obj/effect/abstract/particle_holder/debris_visuals) | ||
QDEL_NULL(smoke_visuals) | ||
if(debris_visuals) | ||
QDEL_NULL(debris_visuals) |
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
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.