Implemented Remote shop spawning.

This commit is contained in:
IQuant 2024-09-16 17:53:11 +03:00
parent 96595a4c68
commit 9ad1ac0219
3 changed files with 13 additions and 2 deletions

View file

@ -44,7 +44,8 @@ local function run_spawn_fn(fn_name, x, y, ...)
local eid = ret local eid = ret
ctx.cap.item_sync.globalize(eid, true, ctx.rpc_peer_id) ctx.cap.item_sync.globalize(eid, true, ctx.rpc_peer_id)
local x, y = EntityGetTransform(eid) local x, y = EntityGetTransform(eid)
EntityLoad("mods/quant.ew/files/system/gen_sync/tmp_shop_area.xml", x, y) local minishop = EntityLoad("mods/quant.ew/files/system/gen_sync/tmp_shop_area.xml", x, y)
EntityAddChild(eid, minishop)
end end
end end

View file

@ -2,6 +2,7 @@
tags="shop" > tags="shop" >
<HitboxComponent <HitboxComponent
_tags="enabled_in_world"
aabb_min_x="-5" aabb_min_x="-5"
aabb_min_y="-5" aabb_min_y="-5"
aabb_max_x="5" aabb_max_x="5"
@ -11,5 +12,9 @@
is_item="0" is_item="0"
is_player="0" is_player="0"
offset.x="0" offset.x="0"
offset.y="0" /> offset.y="0"
/>
<InheritTransformComponent _tags="enabled_in_world"/>
<LuaComponent _tags="enabled_in_world" execute_every_n_frame="300" script_source_file="mods/quant.ew/files/system/gen_sync/tmp_shop_script.lua"/>
</Entity> </Entity>

View file

@ -0,0 +1,5 @@
local ent = GetUpdatedEntityID()
local x, y = EntityGetTransform(ent)
if DoesWorldExistAt(x-5, y-5, x+5, y+5) then
EntityKill(ent)
end