mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
sync projectile effects on entitys better, remove projectile effects on death and stuff, add max players option
This commit is contained in:
parent
661388cc9c
commit
7f3032b918
6 changed files with 56 additions and 62 deletions
|
@ -77,8 +77,8 @@ pub struct GameSettings {
|
|||
enemy_sync_interval: u32,
|
||||
randomize_perks: bool,
|
||||
progress: Vec<String>,
|
||||
max_players: u32
|
||||
}
|
||||
|
||||
impl Default for GameSettings {
|
||||
fn default() -> Self {
|
||||
GameSettings {
|
||||
|
@ -97,6 +97,7 @@ impl Default for GameSettings {
|
|||
chunk_target: 32,
|
||||
enemy_sync_interval: 3,
|
||||
progress: Vec::new(),
|
||||
max_players: 250
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -442,6 +443,7 @@ impl App {
|
|||
let peer = net::steam_networking::SteamPeer::new_host(
|
||||
steamworks::LobbyType::Private,
|
||||
self.steam_state.as_ref().unwrap().client.clone(),
|
||||
self.app_saved_state.game_settings.max_players
|
||||
);
|
||||
let netman = net::NetManager::new(PeerVariant::Steam(peer), self.get_netman_init());
|
||||
self.set_netman_settings(&netman);
|
||||
|
@ -663,8 +665,11 @@ impl App {
|
|||
ui.add(DragValue::new(&mut game_settings.seed));
|
||||
});
|
||||
ui.add_space(10.0);
|
||||
ui.label("Max players");
|
||||
ui.add(Slider::new(&mut game_settings.max_players, 2..=250));
|
||||
ui.add_space(10.0);
|
||||
ui.label(tr("Amount-of-chunks-host-has-loaded-at-once-synced-enemies-and-physics-objects-need-to-be-loaded-in-by-host-to-be-rendered-by-clients"));
|
||||
ui.add(Slider::new(&mut game_settings.chunk_target, 1..=64));
|
||||
ui.add(Slider::new(&mut game_settings.chunk_target, 12..=64));
|
||||
|
||||
ui.add_space(20.0);
|
||||
ui.label(tr("connect_settings_player_tether_desc"));
|
||||
|
@ -1254,6 +1259,7 @@ pub fn host_cli(port: u16) {
|
|||
let peer = net::steam_networking::SteamPeer::new_host(
|
||||
steamworks::LobbyType::Private,
|
||||
state.client,
|
||||
250
|
||||
);
|
||||
PeerVariant::Steam(peer)
|
||||
};
|
||||
|
|
|
@ -326,7 +326,7 @@ pub struct SteamPeer {
|
|||
}
|
||||
|
||||
impl SteamPeer {
|
||||
pub fn new_host(lobby_type: LobbyType, client: steamworks::Client) -> Self {
|
||||
pub fn new_host(lobby_type: LobbyType, client: steamworks::Client, max_players: u32) -> Self {
|
||||
let (sender, events) = channel::unbounded();
|
||||
|
||||
let connections = Connections::new(&client);
|
||||
|
@ -334,7 +334,7 @@ impl SteamPeer {
|
|||
let matchmaking = client.matchmaking();
|
||||
{
|
||||
let sender = sender.clone();
|
||||
matchmaking.create_lobby(lobby_type, 100, {
|
||||
matchmaking.create_lobby(lobby_type, max_players, {
|
||||
let client = client.clone();
|
||||
move |lobby| {
|
||||
let matchmaking = client.matchmaking();
|
||||
|
|
|
@ -16,11 +16,15 @@ function effect_sync.get_ent_effects(entity)
|
|||
local list = {}
|
||||
for _, ent in ipairs(EntityGetAllChildren(entity) or {}) do
|
||||
-- Do not include disabled components here
|
||||
local com = EntityGetFirstComponent(ent, "GameEffectComponent")
|
||||
if com ~= nil then
|
||||
local name = ComponentGetValue2(com, "effect")
|
||||
if not IGNORE_EFFECTS[name] and filename ~= EntityGetFilename(ent) and not EntityHasTag(ent, "perk_entity") then
|
||||
table.insert(list, ent)
|
||||
if EntityHasTag(ent, "projectile") then
|
||||
table.insert(list, ent)
|
||||
else
|
||||
local com = EntityGetFirstComponent(ent, "GameEffectComponent")
|
||||
if com ~= nil then
|
||||
local name = ComponentGetValue2(com, "effect")
|
||||
if not IGNORE_EFFECTS[name] and filename ~= EntityGetFilename(ent) and not EntityHasTag(ent, "perk_entity") then
|
||||
table.insert(list, ent)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -69,21 +73,26 @@ function effect_sync.remove_all_effects(entity)
|
|||
end
|
||||
end
|
||||
|
||||
local function get_name(effect)
|
||||
local com = EntityGetFirstComponentIncludingDisabled(effect1, "GameEffectComponent")
|
||||
local name
|
||||
if com == nil then
|
||||
name = EntityGetFilename(effect)
|
||||
else
|
||||
name = ComponentGetValue2(com, "effect")
|
||||
if name == "CUSTOM" then
|
||||
name = ComponentGetValue2(com, "custom_effect_id")
|
||||
end
|
||||
end
|
||||
return name
|
||||
end
|
||||
|
||||
local function remove_duplicates(effects)
|
||||
for i, effect1 in ipairs(effects) do
|
||||
local com1 = EntityGetFirstComponentIncludingDisabled(effect1, "GameEffectComponent")
|
||||
local name1 = ComponentGetValue2(com1, "effect")
|
||||
if name1 == "CUSTOM" then
|
||||
name1 = ComponentGetValue2(com1, "custom_effect_id")
|
||||
end
|
||||
local name1 = get_name(effect1)
|
||||
for j, effect2 in ipairs(effects) do
|
||||
if i ~= j and EntityGetIsAlive(effect1) and EntityGetIsAlive(effect2) then
|
||||
local com2 = EntityGetFirstComponentIncludingDisabled(effect2, "GameEffectComponent")
|
||||
local name2 = ComponentGetValue2(com2, "effect")
|
||||
if name2 == "CUSTOM" then
|
||||
name2 = ComponentGetValue2(com2, "custom_effect_id")
|
||||
end
|
||||
if name1 == name2 then
|
||||
if name1 == get_name(effect2) then
|
||||
if i < j then
|
||||
EntityKill(effect1)
|
||||
else
|
||||
|
@ -112,25 +121,16 @@ function effect_sync.apply_effects(effects, entity)
|
|||
local serialized = EntityCreateNew()
|
||||
np.DeserializeEntity(serialized, effect)
|
||||
local com = EntityGetFirstComponentIncludingDisabled(serialized, "GameEffectComponent")
|
||||
local effect_name = ComponentGetValue2(com, "effect")
|
||||
if effect_name == "CUSTOM" then
|
||||
effect_name = ComponentGetValue2(com, "custom_effect_id")
|
||||
end
|
||||
local effect_name = get_name(serialized)
|
||||
for _, old_effect in ipairs(old_local_effects) do
|
||||
local old_com = EntityGetFirstComponentIncludingDisabled(old_effect, "GameEffectComponent")
|
||||
if old_com ~= nil then
|
||||
local old_name = ComponentGetValue2(old_com, "effect")
|
||||
if old_name == "CUSTOM" then
|
||||
old_name = ComponentGetValue2(old_com, "custom_effect_id")
|
||||
end
|
||||
if old_name == effect_name then
|
||||
if ComponentGetValue2(old_com, "frames") ~= -1 then
|
||||
ComponentSetValue2(old_com, "frames", 999999999)
|
||||
end
|
||||
EntityKill(serialized)
|
||||
table.insert(effect_names, effect_name)
|
||||
goto continue
|
||||
if effect_name == get_name(old_effect) then
|
||||
if old_com ~= nil and ComponentGetValue2(old_com, "frames") ~= -1 then
|
||||
ComponentSetValue2(old_com, "frames", 999999999)
|
||||
end
|
||||
EntityKill(serialized)
|
||||
table.insert(effect_names, effect_name)
|
||||
goto continue
|
||||
end
|
||||
end
|
||||
if com ~= nil and ComponentGetValue2(com, "frames") ~= -1 then
|
||||
|
@ -142,19 +142,13 @@ function effect_sync.apply_effects(effects, entity)
|
|||
end
|
||||
for _, old_effect in ipairs(old_local_effects) do
|
||||
local old_com = EntityGetFirstComponentIncludingDisabled(old_effect, "GameEffectComponent")
|
||||
if old_com ~= nil then
|
||||
local old_name = EntityGetFilename(old_effect)
|
||||
if old_name == name then
|
||||
if ComponentGetValue2(old_com, "frames") ~= -1 then
|
||||
ComponentSetValue2(old_com, "frames", 999999999)
|
||||
end
|
||||
local name3 = ComponentGetValue2(old_com, "effect")
|
||||
if name3 == "CUSTOM" then
|
||||
name3 = ComponentGetValue2(old_com, "custom_effect_id")
|
||||
end
|
||||
table.insert(effect_names, name3)
|
||||
goto continue
|
||||
local old_name = get_name(old_effect)
|
||||
if name == old_name then
|
||||
if old_com ~= nil and ComponentGetValue2(old_com, "frames") ~= -1 then
|
||||
ComponentSetValue2(old_com, "frames", 999999999)
|
||||
end
|
||||
table.insert(effect_names, old_name)
|
||||
goto continue
|
||||
end
|
||||
end
|
||||
local ent = EntityLoad(name)
|
||||
|
@ -166,11 +160,7 @@ function effect_sync.apply_effects(effects, entity)
|
|||
if com ~= nil and ComponentGetValue2(com, "frames") ~= -1 then
|
||||
ComponentSetValue2(com, "frames", 999999999)
|
||||
end
|
||||
local name3 = ComponentGetValue2(com, "effect")
|
||||
if name3 == "CUSTOM" then
|
||||
name3 = ComponentGetValue2(com, "custom_effect_id")
|
||||
end
|
||||
table.insert(effect_names, name3)
|
||||
table.insert(effect_names, get_name(ent))
|
||||
::continue::
|
||||
end
|
||||
|
||||
|
@ -178,11 +168,7 @@ function effect_sync.apply_effects(effects, entity)
|
|||
local local_effects = effect_sync.get_ent_effects(entity)
|
||||
if #local_effects > #effect_names then
|
||||
for _, effect in ipairs(local_effects) do
|
||||
local com = EntityGetFirstComponentIncludingDisabled(effect, "GameEffectComponent")
|
||||
local local_name = ComponentGetValue2(com, "effect")
|
||||
if local_name == "CUSTOM" then
|
||||
local_name = ComponentGetValue2(com, "custom_effect_id")
|
||||
end
|
||||
local local_name = get_name(effect)
|
||||
for _, name in ipairs(effect_names) do
|
||||
if name == local_name then
|
||||
goto cont
|
||||
|
|
|
@ -264,7 +264,7 @@ ctx.cap.health = {
|
|||
for _, child in pairs(EntityGetAllChildren(ctx.my_player.entity) or {}) do
|
||||
if not EntityHasTag(child, "perk_entity") then
|
||||
local com = EntityGetFirstComponentIncludingDisabled(child, "GameEffectComponent")
|
||||
if com ~= nil then
|
||||
if com ~= nil or EntityHasTag(child, "projectile") then
|
||||
EntityKill(child)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -94,8 +94,8 @@
|
|||
herd_id="notplayer"
|
||||
food_chain_rank="20"
|
||||
is_predator="1"
|
||||
berserk_dont_attack_friends="1"
|
||||
></GenomeDataComponent>
|
||||
<!--berserk_dont_attack_friends="1"-->
|
||||
|
||||
<CharacterPlatformingComponent
|
||||
animation_to_play=""
|
||||
|
|
|
@ -59,7 +59,7 @@ local water_mats = {"water", "swamp", "water_swamp", "water_salt", "blood", "mud
|
|||
local ignore_spell = {"ANTIHEAL", "BLACK_HOLE", "BLACK_HOLE_DEATH_TRIGGER", "POWERDIGGER", "DIGGER", "PIPE_BOMB", "PIPE_BOMB_DEATH_TRIGGER", "GRENADE_LARGE", "CRUMBLING_EARTH", "HEAL_BULLET", "FISH",
|
||||
"TELEPORT_PROJECTILE_CLOSER", "TELEPORT_PROJECTILE_STATIC", "SWAPPER_PROJECTILE", "TELEPORT_PROJECTILE", "TELEPORT_PROJECTILE_SHORT", "WHITE_HOLE", "CESSATION", "ADD_TRIGGER",
|
||||
"ADD_TIMER", "ADD_DEATH_TRIGGER", "DIVIDE_2", "DIVIDE_3", "DIVIDE_4", "DIVIDE_10", "GAMMA", "MU", "ALPHA", "OMEGA", "PHI", "SIGMA", "TAU", "SUMMON_PORTAL", "DUPLICATE",
|
||||
"IF_PROJECTILE", "IF_HP", "IF_ENEMY", "IF_HALF", "IF_ELSE", "IF_END", "ALL_SPELLS"}
|
||||
"IF_PROJECTILE", "IF_HP", "IF_ENEMY", "IF_HALF", "IF_ELSE", "IF_END", "ALL_SPELLS", "SUMMON_ROCK", "SUMMON_EGG"}
|
||||
|
||||
local function get_potions_of_type(type)
|
||||
local potions = {}
|
||||
|
@ -419,12 +419,14 @@ local function init_state()
|
|||
items = child
|
||||
end
|
||||
local com = EntityGetFirstComponentIncludingDisabled(child, "GameEffectComponent")
|
||||
if com ~= nil then
|
||||
if com ~= nil or EntityHasTag(child, "projectile") then
|
||||
if ComponentGetValue2(com, "effect") == "CHARM" then
|
||||
EntityKill(child)
|
||||
end
|
||||
end
|
||||
end
|
||||
local genome = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity)
|
||||
ComponentSetValue2(genome, "berserk_dont_attack_friends", 1)
|
||||
state = {
|
||||
entity = ctx.my_player.entity,
|
||||
control_component = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "ControlsComponent"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue