Skip to content

Commit

Permalink
adds footstep based particle handlers, fixes wehm added holy steps
Browse files Browse the repository at this point in the history
  • Loading branch information
dwasint committed Nov 11, 2023
1 parent e841995 commit f5f7fbf
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 15 deletions.
2 changes: 1 addition & 1 deletion monkestation/code/modules/trading/lootbox_odds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
viable_hats += subtypesof(/obj/item/clothing/head/hats)
var/path = pick(viable_hats)
var/obj/item/clothing/head/temp = new path
var/list/viable_unusuals = subtypesof(/datum/component/particle_spewer)
var/list/viable_unusuals = subtypesof(/datum/component/particle_spewer) - /datum/component/particle_spewer/movement
var/picked_path = pick(viable_unusuals)
temp.AddComponent(/datum/component/unusual_handler, particle_path = picked_path)
return temp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
var/random_bursts = FALSE
///should we offset
var/offsets = TRUE
/// do we process?
var/processes = TRUE

/datum/component/particle_spewer/Initialize(duration = 0, spawn_interval = 0, offset_x = 0, offset_y = 0, icon_file, particle_state, equipped_offset = 0, burst_amount = 0, lifetime = 0, random_bursts = 0)
. = ..()
Expand All @@ -69,7 +71,8 @@
src.random_bursts = random_bursts
source_object = parent

START_PROCESSING(SSactualfastprocess, src)
if(processes)
START_PROCESSING(SSactualfastprocess, src)
RegisterSignal(source_object, COMSIG_ITEM_EQUIPPED, PROC_REF(handle_equip_offsets))
RegisterSignal(source_object, COMSIG_ITEM_POST_UNEQUIP, PROC_REF(reset_offsets))

Expand All @@ -96,6 +99,9 @@
if(count < spawn_interval)
return
count = 0
spawn_particles()

/datum/component/particle_spewer/proc/spawn_particles(datum/source, atom/oldloc, dir, forced)
var/burstees = burst_amount
if(random_bursts)
burstees = rand(1, burst_amount)
Expand Down Expand Up @@ -129,6 +135,7 @@

/datum/component/particle_spewer/proc/handle_equip_offsets(datum/source, mob/equipper, slot)
SIGNAL_HANDLER

offset_x -= added_x
offset_y -= added_y
added_x = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//a unique subtype of particle spewer that only runs on equip
/datum/component/particle_spewer/movement
processes = FALSE
var/mob/attached_signal

/datum/component/particle_spewer/movement/Destroy(force, silent)
UnregisterSignal(source_object, COMSIG_MOVABLE_MOVED)
. = ..()
UnregisterSignal(attached_signal, COMSIG_MOVABLE_MOVED)
attached_signal = null

/datum/component/particle_spewer/movement/Initialize(duration, spawn_interval, offset_x, offset_y, icon_file, particle_state, equipped_offset, burst_amount, lifetime, random_bursts)
. = ..()
RegisterSignal(source_object, COMSIG_MOVABLE_MOVED, PROC_REF(spawn_particles))

/datum/component/particle_spewer/movement/handle_equip_offsets(datum/source, mob/equipper, slot)
. = ..()
if(attached_signal)
UnregisterSignal(attached_signal, COMSIG_MOVABLE_MOVED)
attached_signal = null

attached_signal = equipper
RegisterSignal(equipper, COMSIG_MOVABLE_MOVED, PROC_REF(spawn_particles))

/datum/component/particle_spewer/movement/reset_offsets()
. = ..()
if(attached_signal)
UnregisterSignal(attached_signal, COMSIG_MOVABLE_MOVED)
attached_signal = null
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/datum/component/particle_spewer/movement/holy_steps
unusual_description = "holy treads"
duration = 15 SECONDS
burst_amount = 25
icon_file = 'goon/icons/effects/particles.dmi'
particle_state = "starsmall"

/datum/component/particle_spewer/movement/holy_steps/animate_particle(obj/effect/abstract/particle/spawned)
var/matrix/first = matrix()
var/matrix/second = matrix()

spawned.blend_mode = BLEND_ADD
spawned.pixel_x += rand(-3,3)
spawned.pixel_y += rand(-3,3)

first.Turn(rand(-90, 90))
first.Scale(0.5,0.5)
second.Turn(rand(-90, 90))

spawned.color = rgb(rand(1, 255), rand(1, 255), rand(1, 255))

animate(spawned, transform = first, time = 0.4 SECONDS, pixel_y = rand(-32, 32) + spawned.pixel_y, pixel_x = rand(-32, 32) + spawned.pixel_x, easing = LINEAR_EASING)
animate(transform = second, time = 0.5 SECONDS, pixel_y = spawned.pixel_y - 5, easing = LINEAR_EASING|EASE_OUT)
animate(spawned, alpha = 0, time = duration)
addtimer(CALLBACK(src, PROC_REF(delete_particle), spawned), duration)
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/datum/component/particle_spewer/shooting_star
icon_file = 'goon/icons/effects/particles.dmi'
particle_state = "beamed_eighth"

unusual_description = "melody"
duration = 2.5 SECONDS
burst_amount = 5
offsets = FALSE

/datum/component/particle_spewer/shooting_star/animate_particle(obj/effect/abstract/particle/spawned)
var/matrix/first = matrix()
var/matrix/second = matrix()
var/matrix/default = matrix()

if(prob(30))
spawned.icon_state = "eighth"
if(prob(25))
spawned.icon_state = "quarter"

spawned.pixel_x += rand(-12, 12)
spawned.pixel_y += rand(-6, 6)
first.Turn(rand(-90, 90))
first.Scale(0.1, 0.1)
spawned.transform = first

second = first
second.Scale(3,3)
second.Turn(rand(-90, 90))

animate(spawned, transform = second, time = 1, alpha = 220)
animate(transform = default, time = duration + rand(-5, 5), pixel_y = spawned.pixel_y + 32, alpha = 1)

addtimer(CALLBACK(src, PROC_REF(delete_particle), spawned), duration + 0.6 SECONDS)

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/datum/component/particle_spewer/shooting_star
/datum/component/particle_spewer/movement/shooting_star
icon_file = 'goon/icons/effects/particles.dmi'
particle_state = "starsmall"

Expand All @@ -9,10 +9,12 @@
//has a chance to randomly change on animate
var/direction = NORTH

/datum/component/particle_spewer/shooting_star/animate_particle(obj/effect/abstract/particle/spawned)
if(prob(10))
direction = pick(NORTH, SOUTH, EAST, WEST)

/datum/component/particle_spewer/movement/shooting_star/spawn_particles(datum/source, atom/oldloc, dir, forced)
. = ..()
direction = dir

/datum/component/particle_spewer/movement/shooting_star/animate_particle(obj/effect/abstract/particle/spawned)

spawned.dir = direction
if(prob(30))
spawned.icon_state = "starlarge"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
/datum/component/particle_spewer/weh
/datum/component/particle_spewer/movement/weh
unusual_description = "weh"
duration = 15 SECONDS
burst_amount = 5
duration = 10 SECONDS
burst_amount = 3

/datum/component/particle_spewer/weh/animate_particle(obj/effect/abstract/particle/spawned)
particle_state = "map_plushie_lizard"
icon_file = 'icons/obj/toys/plushes.dmi'

/datum/component/particle_spewer/movement/weh/animate_particle(obj/effect/abstract/particle/spawned)
var/matrix/first = matrix()
var/matrix/second = matrix()

spawned.blend_mode = BLEND_ADD
spawned.pixel_x += rand(-3,3)
spawned.pixel_y += rand(-3,3)

Expand All @@ -17,7 +19,7 @@

spawned.color = rgb(rand(1, 255), rand(1, 255), rand(1, 255))

animate(spawned, transform = first, time = 0.4 SECONDS, pixel_y = rand(-32, 32) + spawned.pixel_y, pixel_x = rand(-32, 32) + spawned.pixel_x, easing = LINEAR_EASING)
animate(transform = second, time = 0.5 SECONDS, pixel_y = spawned.pixel_y - 5, easing = LINEAR_EASING|EASE_OUT)
animate(spawned, transform = first, time = 0.4 SECONDS, pixel_y = rand(-1, 48) + spawned.pixel_y, pixel_x = rand(-32, 32) + spawned.pixel_x)
animate(transform = second, time = 0.5 SECONDS, pixel_y = spawned.pixel_y - 32)
animate(spawned, alpha = 0, time = duration)
addtimer(CALLBACK(src, PROC_REF(delete_particle), spawned), duration)
5 changes: 4 additions & 1 deletion tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -6345,9 +6345,12 @@
#include "monkestation\code\modules\trading\lootbox_odds.dm"
#include "monkestation\code\modules\trading\save_unusual_preference.dm"
#include "monkestation\code\modules\trading\unusual_effects\_unusual_component.dm"
#include "monkestation\code\modules\trading\unusual_effects\animation_housing\_spawning_component.dm"
#include "monkestation\code\modules\trading\unusual_effects\animation_housing\__spawning_component.dm"
#include "monkestation\code\modules\trading\unusual_effects\animation_housing\_footprint.dm"
#include "monkestation\code\modules\trading\unusual_effects\animation_housing\confetti.dm"
#include "monkestation\code\modules\trading\unusual_effects\animation_housing\galaxies.dm"
#include "monkestation\code\modules\trading\unusual_effects\animation_housing\holy_steps.dm"
#include "monkestation\code\modules\trading\unusual_effects\animation_housing\music.dm"
#include "monkestation\code\modules\trading\unusual_effects\animation_housing\shooting_stars.dm"
#include "monkestation\code\modules\trading\unusual_effects\animation_housing\snow.dm"
#include "monkestation\code\modules\trading\unusual_effects\animation_housing\weh.dm"
Expand Down

0 comments on commit f5f7fbf

Please sign in to comment.