sync houre

This commit is contained in:
bgkillas 2024-11-16 10:29:27 -05:00
parent 449c416093
commit 8db3e1acea
2 changed files with 110 additions and 7 deletions

View file

@ -0,0 +1,99 @@
<Entity
name="unknown"
tags="hittable,mortal,ew_enemy_sync_extra" >
<DamageModelComponent
_enabled="1"
air_needed="0"
falling_damages="0"
fire_damage_amount="0.2"
fire_probability_of_ignition="0"
hp="20"
is_on_fire="0"
blood_material="sand_blue"
materials_create_messages="0"
materials_damage="1"
materials_how_much_damage=""
materials_that_damage=""
ragdoll_material="ice_b2"
ragdoll_filenames_file=""
ragdoll_offset_y="-6" >
</DamageModelComponent>
<GenomeDataComponent
_enabled="1"
food_chain_rank="20"
herd_id="ghost"
is_predator="1" >
</GenomeDataComponent>
<HitboxComponent
_enabled="1"
aabb_max_x="6"
aabb_max_y="0"
aabb_min_x="-6"
aabb_min_y="-20"
is_enemy="0"
is_item="0"
is_player="1" >
</HitboxComponent>
<PathFindingGridMarkerComponent
_enabled="1"
marker_offset_x="0"
marker_offset_y="0"
marker_work_flag="16" >
</PathFindingGridMarkerComponent>
<SpriteComponent
_enabled="1"
alpha="1"
has_special_scale="0"
image_file="data/buildings_gfx/ghost_crystal.xml"
is_text_sprite="0"
next_rect_animation=""
offset_x="0"
offset_y="0"
rect_animation="stand"
visible="1"
>
</SpriteComponent>
<VelocityComponent />
<SimplePhysicsComponent/>
<LightComponent
_enabled="1"
radius="96"
fade_out_time="1.5"
r="230"
g="120"
b="230"
offset_y="-6"
>
</LightComponent>
<LuaComponent
_enabled="1"
execute_on_added="1"
remove_after_executed="0"
execute_every_n_frame="-1"
script_source_file="data/scripts/buildings/ghost_crystal.lua" >
</LuaComponent>
<LuaComponent
_enabled="1"
remove_after_executed="0"
execute_every_n_frame="-1"
script_death="data/scripts/buildings/ghost_crystal_death.lua" >
</LuaComponent>
<VariableStorageComponent
_tags="ghost_id"
name="ghost_id"
value_int="0"
>
</VariableStorageComponent>
</Entity>

View file

@ -151,10 +151,7 @@ local function deserialize_phys_component(phys_component, phys_info)
end
local function get_sync_entities(return_all)
local entities = {}
table_extend_filtered(entities, EntityGetWithTag("enemy"), function (ent)
return not EntityHasTag(ent, "ew_no_enemy_sync")
end)
local entities = EntityGetWithTag("enemy") or {}
table_extend(entities, EntityGetWithTag("ew_enemy_sync_extra"))
table_extend(entities, EntityGetWithTag("plague_rat"))
table_extend(entities, EntityGetWithTag("seed_f"))
@ -349,7 +346,8 @@ function enemy_sync.host_upload_entities()
animation = ComponentGetValue2(sprite, "rect_animation")
end
local dont_cull = EntityHasTag(enemy_id, "worm") or EntityGetFirstComponent(enemy_id, "BossHealthBarComponent") ~= nil
local dont_cull = EntityGetFirstComponent(enemy_id, "BossHealthBarComponent") ~= nil
or worm ~= nil
local stains = stain_sync.get_stains(enemy_id)
@ -545,6 +543,10 @@ local function sync_enemy(enemy_info_raw, force_no_cull)
end
util.make_ephemerial(enemy_id)
local ghost = EntityGetFirstComponentIncludingDisabled(enemy_id, "GhostComponent")
if ghost ~= nil then
ComponentSetValue2(ghost, "die_if_no_home", false)
end
end
local enemy_data_new = ctx.entity_by_remote_id[remote_enemy_id]
@ -679,8 +681,10 @@ local function sync_enemy(enemy_info_raw, force_no_cull)
end
for _, sprite in pairs(EntityGetComponent(enemy_id, "SpriteComponent", "ew_sprite") or {}) do
ComponentSetValue2(sprite, "rect_animation", animation)
ComponentSetValue2(sprite, "next_rect_animation", animation)
if animation ~= nil then
ComponentSetValue2(sprite, "rect_animation", animation)
ComponentSetValue2(sprite, "next_rect_animation", animation)
end
end
::continue::