fix egui light mode happening, notplayer not having health bar, allow notplayer to take poly material damage, maybe fix a rare poly crash

This commit is contained in:
bgkillas 2024-10-11 09:38:10 -04:00
parent cc43dd1dfc
commit cfb1dd9eb8
7 changed files with 39 additions and 36 deletions

View file

@ -4,7 +4,7 @@ use bookkeeping::{
save_state::SaveState,
};
use clipboard::{ClipboardContext, ClipboardProvider};
use eframe::egui::{self, Align2, Button, Color32, Context, DragValue, FontDefinitions, FontFamily, ImageButton, InnerResponse, Key, Margin, OpenUrl, Rect, RichText, ScrollArea, Slider, TextureOptions, Ui, UiBuilder, Vec2, Window};
use eframe::egui::{self, Align2, Button, Color32, Context, DragValue, FontDefinitions, FontFamily, ImageButton, InnerResponse, Key, Margin, OpenUrl, Rect, RichText, ScrollArea, Slider, TextureOptions, Ui, UiBuilder, Vec2, Visuals, Window};
use egui_plot::{Plot, PlotPoint, PlotUi, Text};
use image::DynamicImage::ImageRgba8;
use image::RgbaImage;
@ -274,6 +274,7 @@ fn square_button_icon(ui: &mut Ui, icon: egui::Image) -> egui::Response {
impl App {
pub fn new(cc: &eframe::CreationContext<'_>, args: Args) -> Self {
cc.egui_ctx.set_visuals(Visuals::dark());
let mut saved_state: AppSavedState = cc
.storage
.and_then(|storage| eframe::get_value(storage, eframe::APP_KEY))

View file

@ -126,13 +126,14 @@ local function player_died()
perk_fns.update_perks_for_entity(perk_data, ctx.my_player.entity, allow_notplayer_perk)
EntitySetName(ctx.my_player.entity, ctx.my_id.."?")
util.set_ent_health(ctx.my_player.entity, {max_hp, max_hp})
send_player_cosmetics(ctx.my_id)
remove_inventory_tags()
local iron = LoadGameEffectEntityTo(ctx.my_player.entity, "mods/quant.ew/files/system/local_health/notplayer/iron_stomach.xml")
EntityAddTag(iron, "kill_on_revive")
remove_healthbar_locally()
LoadGameEffectEntityTo(ctx.my_player.entity, "mods/quant.ew/files/system/spectate/no_tinker.xml")
set_cosmetics_locally(ctx.my_id)
polymorph.switch_entity(ent + 1)
remove_inventory_tags()
remove_healthbar_locally()
for _, child in ipairs(EntityGetAllChildren(ctx.my_player.entity) or {}) do
if EntityGetName(child) == "cursor" or EntityGetName(child) == "notcursor" then
EntityKill(child)
@ -332,7 +333,6 @@ ctx.cap.health = {
local ent = end_poly_effect(ctx.my_player.entity)
ctx.my_player.entity = ent
player_died()
polymorph.switch_entity(ent)
end
end,
}

View file

@ -145,8 +145,8 @@
hp="4"
is_on_fire="0"
materials_damage="1"
materials_that_damage="acid,lava,blood_cold_vapour,blood_cold,poison,radioactive_gas,radioactive_gas_static,rock_static_radioactive,rock_static_poison,ice_radioactive_static,ice_radioactive_glass,ice_acid_static,ice_acid_glass,magic_gas_hp_regeneration,gold_radioactive,gold_static_radioactive,poo_gas"
materials_how_much_damage="0.005,0.003,0.0006,0.0009,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.005,-0.005,0.0002,0.0002,0.004,0.0005,0.00001"
materials_that_damage="acid,lava,blood_cold_vapour,blood_cold,poison,radioactive_gas,radioactive_gas_static,rock_static_radioactive,rock_static_poison,ice_radioactive_static,ice_radioactive_glass,ice_acid_static,ice_acid_glass,magic_gas_hp_regeneration,gold_radioactive,gold_static_radioactive,poo_gas,magic_liquid_random_polymorph,magic_liquid_polymorph,magic_liquid_unstable_polymorph,magic_gas_polymorph"
materials_how_much_damage="0.005,0.003,0.0006,0.0009,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,-0.005,0.0002,0.0002,0.00001,0.001,0.001,0.001,0.001"
ragdoll_filenames_file="data/ragdolls/player/filenames.txt"
ragdoll_offset_y="-5"
ragdollify_child_entity_sprites="1"

View file

@ -3,12 +3,6 @@ local wandfinder = dofile_once("mods/quant.ew/files/system/notplayer_ai/wandfind
dofile_once("mods/quant.ew/files/system/player_tether/player_tether.lua")
local spectate = dofile_once("mods/quant.ew/files/system/spectate/spectate.lua")
--TODO item position sync
--TODO enemy sync in rust??
--TODO if player tether is enabled, allow picking teams
local MAX_RADIUS = 128*5
local state

View file

@ -55,27 +55,35 @@ function send_player_cosmetics(id)
ModDoesFileExist("mods/quant.ew/files/system/player/tmp/no_crown"))
end
rpc.opts_everywhere()
function rpc.set_cosmetics_all(id, amulet, gem, crown)
for peer_id, player_data in pairs(ctx.players) do
if peer_id == id then
local player_entity = player_data.entity
local player_components = EntityGetComponent(player_entity, "SpriteComponent", "character")
if player_components ~= nil then
for _, comp in ipairs(player_components) do
if comp == nil then
goto continue
end
if amulet and ComponentGetValue2(comp, "image_file") == "data/enemies_gfx/player_amulet.xml" then
EntitySetComponentIsEnabled(player_entity, comp, false)
elseif gem and ComponentGetValue2(comp, "image_file") == "data/enemies_gfx/player_amulet_gem.xml" then
EntitySetComponentIsEnabled(player_entity, comp, false)
elseif crown and ComponentGetValue2(comp, "image_file") == "data/enemies_gfx/player_hat2.xml" then
EntitySetComponentIsEnabled(player_entity, comp, false)
end
::continue::
end
local function set_cosmetics(id, amulet, gem, crown)
local player_entity = ctx.players[id].entity
local player_components = EntityGetComponent(player_entity, "SpriteComponent", "character")
if player_components ~= nil then
for _, comp in ipairs(player_components) do
if comp == nil then
goto continue
end
if amulet and ComponentGetValue2(comp, "image_file") == "data/enemies_gfx/player_amulet.xml" then
EntitySetComponentIsEnabled(player_entity, comp, false)
elseif gem and ComponentGetValue2(comp, "image_file") == "data/enemies_gfx/player_amulet_gem.xml" then
EntitySetComponentIsEnabled(player_entity, comp, false)
elseif crown and ComponentGetValue2(comp, "image_file") == "data/enemies_gfx/player_hat2.xml" then
EntitySetComponentIsEnabled(player_entity, comp, false)
end
::continue::
end
end
end
function set_cosmetics_locally(id)
set_cosmetics(id,
ModDoesFileExist("mods/quant.ew/files/system/player/tmp/no_amulet"),
ModDoesFileExist("mods/quant.ew/files/system/player/tmp/no_amulet_gem"),
ModDoesFileExist("mods/quant.ew/files/system/player/tmp/no_crown"))
end
rpc.opts_everywhere()
function rpc.set_cosmetics_all(id, amulet, gem, crown)
set_cosmetics(id, amulet, gem, crown)
end

View file

@ -78,7 +78,7 @@ end
function module.on_world_update_post()
local ent = np.GetPlayerEntity()
if ent ~= ctx.my_player.entity then
if ent ~= nil and ent ~= ctx.my_player.entity then
module.switch_entity(ent)
end
end

View file

@ -69,8 +69,8 @@ def make_release_assets():
os.chdir("noita-proxy")
#subprocess.run(["cross", "build", "--release", "--target", "x86_64-unknown-linux-gnu"], check=True)
#subprocess.run(["cargo", "build", "--release", "--target", "x86_64-pc-windows-gnu"], check=True)
subprocess.run(["cross", "build", "--release", "--target", "x86_64-unknown-linux-gnu"], check=True)
subprocess.run(["cargo", "build", "--release", "--target", "x86_64-pc-windows-gnu"], check=True)
os.chdir("..")