add ew_sync_child tag

This commit is contained in:
bgkillas 2025-03-05 03:58:15 -05:00
parent abd3c321f6
commit a51b7c9af1
4 changed files with 22 additions and 16 deletions

View file

@ -40,6 +40,7 @@ return module
-- ew_ghost_rnd, for something to sync perk ghosts rng -- ew_ghost_rnd, for something to sync perk ghosts rng
-- ew_projectile_position_sync, syncs a projectile by des -- ew_projectile_position_sync, syncs a projectile by des
-- ew_unique, kills an entity if another one was spawned within the same chunk on any peer, by filename -- ew_unique, kills an entity if another one was spawned within the same chunk on any peer, by filename
-- ew_sync_child, syncs a thing in des ignoring weather its a child or not
-- var components(by name not tag): -- var components(by name not tag):
-- ew_peer_id, on all peers, contains peerid in value_string -- ew_peer_id, on all peers, contains peerid in value_string

View file

@ -115,7 +115,7 @@ fn entity_is_excluded(entity: EntityID) -> eyre::Result<bool> {
|| ENTITY_EXCLUDES.contains(&filename) || ENTITY_EXCLUDES.contains(&filename)
|| filename.starts_with(good) || filename.starts_with(good)
|| entity.has_tag("player_unit") || entity.has_tag("player_unit")
|| entity.root()? != Some(entity)) || (entity.root()? != Some(entity) && !entity.has_tag("ew_sync_child")))
} }
impl EntitySync { impl EntitySync {

View file

@ -119,6 +119,25 @@ for _, filename in ipairs(unique) do
util.add_tag_to(filename, "ew_unique") util.add_tag_to(filename, "ew_unique")
end end
local projs = {
"data/entities/projectiles/deck/rock.xml",
"data/entities/projectiles/deck/levitation_field.xml",
"data/entities/projectiles/bomb.xml",
"data/entities/projectiles/propane_tank.xml",
"data/entities/projectiles/deck/disc_bullet_big.xml",
"data/entities/projectiles/deck/disc_bullet_bigger.xml",
"data/entities/projectiles/deck/black_hole.xml",
"data/entities/projectiles/deck/black_hole_giga.xml",
"data/entities/projectiles/deck/white_hole.xml",
"data/entities/projectiles/deck/white_hole_giga.xml",
"data/entities/projectiles/deck/orb_laseremitter_four.xml",
"data/entities/projectiles/deck/projectile_transmutation_field.xml",
}
for _, proj in ipairs(projs) do
util.add_tag_to(proj, "ew_projectile_position_sync")
end
util.add_cross_call("ew_broken_wand", function(ent, x, y) util.add_cross_call("ew_broken_wand", function(ent, x, y)
local gid local gid
for _, v in ipairs(EntityGetComponent(ent, "VariableStorageComponent") or {}) do for _, v in ipairs(EntityGetComponent(ent, "VariableStorageComponent") or {}) do

View file

@ -275,21 +275,7 @@ function OnProjectileFired(
end end
end end
--ewext.sync_projectile(projectile_id, shooter_player_data.peer_id, rng) --ewext.sync_projectile(projectile_id, shooter_player_data.peer_id, rng)
elseif elseif EntityHasTag(projectile_id, "ew_projectile_position_sync") then
n == "data/entities/projectiles/deck/rock.xml"
or n == "data/entities/projectiles/deck/levitation_field.xml"
or n == "data/entities/projectiles/bomb.xml"
or n == "data/entities/projectiles/propane_tank.xml"
or n == "data/entities/projectiles/deck/disc_bullet_big.xml"
or n == "data/entities/projectiles/deck/disc_bullet_bigger.xml"
or n == "data/entities/projectiles/deck/black_hole.xml"
or n == "data/entities/projectiles/deck/black_hole_giga.xml"
or n == "data/entities/projectiles/deck/white_hole.xml"
or n == "data/entities/projectiles/deck/white_hole_giga.xml"
or n == "data/entities/projectiles/deck/orb_laseremitter_four.xml"
or n == "data/entities/projectiles/deck/projectile_transmutation_field.xml"
or EntityHasTag(projectile_id, "ew_projectile_position_sync")
then
local body = EntityGetFirstComponentIncludingDisabled(projectile_id, "PhysicsBody2Component") local body = EntityGetFirstComponentIncludingDisabled(projectile_id, "PhysicsBody2Component")
local proj = EntityGetFirstComponentIncludingDisabled(projectile_id, "ProjectileComponent") local proj = EntityGetFirstComponentIncludingDisabled(projectile_id, "ProjectileComponent")
local life = EntityGetFirstComponentIncludingDisabled(projectile_id, "LifetimeComponent") local life = EntityGetFirstComponentIncludingDisabled(projectile_id, "LifetimeComponent")