Open HeladoDeBrownie opened 3 years ago
this calls for a mixin, call it EventSource
, with methods emit
and register
. emit
takes an event name and optional arguments and runs all registered callbacks. register
takes an event name and a function and registers the function as a callback
SceneView.broadcast_position
and SceneView.broadcast_sprite
are both functions that serve a purpose that will be implemented in Scene
itself instead. they will be removed completely along with all references to self.session
in that module
this necessitates a change in Network/Session.lua
as well. it will call listen
on the Scene
instead of having to tell the SceneView
about itself
Session
needs to know when itsScene
is modified. this logic happens inSceneView
. it ought to happen inScene
instead, by way of callback registration or the like, so thatSceneView
doesn't have to care what a session islikewise,
Chunk
's api is somewhat defensive when it comes to accessing its sprites, because it needs to know when to update itself when they've changed. this can likewise be handled inSprite
itself using callback registration