mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 12:41:09 +01:00
Fish refactor. (#65785)
Refactors fish into proper paths. Removes aquarium behaviour intermediary datums. Moves fish functionality out of aquarium content component. Fixes flopping animation resetting on dropping. Simplifies everything. There should be no player facing changes. The animate signal is kinda weak method of solving the animate queue issue but it seemed least intrusive to me. Open to any better ideas.
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
/**
|
||||
* Create /datum/component/aquarium_content with the preset path on the target right before being inserted into aquarium and deletes itself.
|
||||
* Used to save memory from aquarium properties on common objects/stacks that won't see aquarium in 99 out of 100 rounds.
|
||||
*/
|
||||
/datum/element/deferred_aquarium_content
|
||||
element_flags = ELEMENT_BESPOKE
|
||||
id_arg_index = 2
|
||||
var/aquarium_content_type
|
||||
|
||||
/datum/element/deferred_aquarium_content/Attach(datum/target, aquarium_content_type)
|
||||
. = ..()
|
||||
if(!ismovable(target))
|
||||
return ELEMENT_INCOMPATIBLE
|
||||
if(!aquarium_content_type)
|
||||
CRASH("Deferred aquarium content missing behaviour type.")
|
||||
src.aquarium_content_type = aquarium_content_type
|
||||
|
||||
//If element is added to something already in aquarium, just create the component.
|
||||
var/atom/movable/movable_target = target
|
||||
if(istype(movable_target.loc, /obj/structure/aquarium))
|
||||
create_aquarium_component(movable_target)
|
||||
else //otherwise the component will be created when trying to insert the thing.
|
||||
RegisterSignal(target, COMSIG_AQUARIUM_BEFORE_INSERT_CHECK, .proc/create_aquarium_component)
|
||||
|
||||
/datum/element/deferred_aquarium_content/Detach(datum/target)
|
||||
. = ..()
|
||||
UnregisterSignal(target, COMSIG_AQUARIUM_BEFORE_INSERT_CHECK)
|
||||
|
||||
/datum/element/deferred_aquarium_content/proc/create_aquarium_component(datum/source)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
source.AddComponent(/datum/component/aquarium_content, aquarium_content_type)
|
||||
Detach(source)
|
||||
Reference in New Issue
Block a user