More strict checks during entity unpacking

This commit is contained in:
Pavel Shevaev 2023-11-21 13:37:57 +03:00
parent b0f8d4eb0f
commit ce5454d509
1 changed files with 8 additions and 8 deletions

View File

@ -8,8 +8,8 @@
EcsPackedEntityWithWorld e = default;
stack.PopRelease().Decode(ref e);
if (e.Unpack(out EcsWorld world, out int id) == false)
return null;
if(e.Unpack(out EcsWorld world, out int id) == false)
throw new Exception("No entity found");
ref var cmp = ref world.GetPool<{{o.name}}>().Ensure(id);
@ -31,7 +31,7 @@
EcsPackedEntityWithWorld e = default;
stack.PopRelease().Decode(ref e);
if (e.Unpack(out EcsWorld world, out int id) == false)
if(e.Unpack(out EcsWorld world, out int id) == false)
return null;
world.GetPool<{{o.name}}>().Del(id);
@ -56,7 +56,7 @@
var dv = bhl.Val.New(frm.vm);
if (e.Unpack(out EcsWorld world, out int id) == false)
if(e.Unpack(out EcsWorld world, out int id) == false)
dv.SetBool(false);
else
dv.SetBool(world.GetPool<{{o.name}}>().Has(id));
@ -101,8 +101,8 @@
EcsPackedEntityWithWorld e = default;
stack.PopRelease().Decode(ref e);
if (e.Unpack(out EcsWorld world, out int id) == false)
return null;
if(e.Unpack(out EcsWorld world, out int id) == false)
throw new Exception("No entity found");
ref var cmp = ref world.GetPool<{{o.name}}>().Ensure(id);
var v = cmp.{{f.name}};
@ -145,8 +145,8 @@
stack.PopRelease().Decode(ref e);
if (e.Unpack(out EcsWorld world, out int id) == false)
return null;
if(e.Unpack(out EcsWorld world, out int id) == false)
throw new Exception("No entity found");
ref var cmp = ref world.GetPool<{{o.name}}>().Ensure(id);