From 89a8f94ac0206412c1a2d7b8766d97dbdbd36253 Mon Sep 17 00:00:00 2001 From: Alexander M Pickering Date: Tue, 21 Jan 2025 16:03:25 -0600 Subject: work --- src/ecs.moon | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'src/ecs.moon') diff --git a/src/ecs.moon b/src/ecs.moon index d20984a..182f09d 100644 --- a/src/ecs.moon +++ b/src/ecs.moon @@ -28,11 +28,12 @@ class Entity @c_by_type = {} --Entity is responsible for the component -> entity link - @components = componenets or {} + @components = components or {} for name, component in pairs(@components) component.entity = @ @c_by_type[component.__class] = @c_by_type[component.__class] or {} @c_by_type[component.__class][name] = component + for name, component in pairs(@components) component\join(@) add: (cid, component) => component.entity = @ @@ -70,21 +71,21 @@ class PredictedComponent extends Component @netc_name = netc_name @calculate = calculate join: (entity) => - @net = entity[@netc_name] + @net = @entity\get(@netc_name) forward: () => - for proeprty, calculation in pairs(@calculate) + for property, calculation in pairs(@calculate) @properties[property] = calculation(@) -class GraphicsComponent extends Component - new: (name, properties) => - assert(properties and properties.node , "Failed to find node for graphics component") - super(name, properties) - static: () => - @@static - buffer_size: () => - error("Subclasses of GraphicsComponent must implement a buffer_size() method") - populate_buffer: (buffer, offset) => - error("Subclasses of GraphicsComponent must implement a populate_buffer() method") +-- componnt moved to world.moon +--class GraphicsComponent extends Component +-- new: (name, properties) => +-- print("Got name", name, "and properties", properties) +-- assert(properties and properties.node , "Failed to find node for graphics component") +-- super(name, properties) +-- static: () => +-- @@static +-- node: () => +-- @properties.node class PhysicsComponent extends Component new: (name, properties) => -- cgit v1.2.3-70-g09d2