diff --git a/tpl/bind_ecslite.twig b/tpl/bind_ecslite.twig index c9b2581..6851d9a 100644 --- a/tpl/bind_ecslite.twig +++ b/tpl/bind_ecslite.twig @@ -11,7 +11,7 @@ if(e.Unpack(out EcsWorld world, out int id) == false) throw new Exception("No entity found"); - ref var cmp = ref world.GetPool<{{token_or(o, 'bhl_native_class', o.name)}}>().Ensure(id); + world.GetPool<{{token_or(o, 'bhl_native_class', o.name)}}>().Ensure(id); return null; } @@ -160,17 +160,32 @@ if(e.Unpack(out EcsWorld world, out int id) == false) throw new Exception("No entity found"); - ref var cmp = ref world.GetPool<{{token_or(o, 'bhl_native_class', o.name)}}>().Ensure(id); + var pool = world.GetPool<{{token_or(o, 'bhl_native_class', o.name)}}>(); - {%~ if m.returntype %} - var return_val = - {%- endif ~%} + {%~ if m.returntype %} + if(pool.Has(id)) + { + var return_val = - cmp.{{m.name}}( - {%- for arg in m.args ~%} __{{arg.name}}{% if not loop.last %},{% endif %} {%- endfor ~%} - ); + pool.Get(id).{{m.name}}( + {%- for arg in m.args ~%} __{{arg.name}}{% if not loop.last %},{% endif %} {%- endfor ~%} + ); - {{ bhl_bind.return_val(m, 'return_val') }} + {{ bhl_bind.return_val(m, 'return_val') }} + } + else + { + //unspecified value + var dv = bhl.Val.New(frm.vm); + stack.Push(dv); + } + {%- else ~%} + + pool.Ensure(id).{{m.name}}( + {%- for arg in m.args ~%} __{{arg.name}}{% if not loop.last %},{% endif %} {%- endfor ~%} + ); + + {%- endif ~%} return null; }