mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
color player pings based on mina color, fix friendly fire settings ui showing up when host doesn't have it enabled, send less data from angry ghost memory sync
This commit is contained in:
parent
c6160c7d39
commit
5c3a211838
7 changed files with 29 additions and 17 deletions
|
@ -1022,7 +1022,7 @@ impl eframe::App for App {
|
|||
|
||||
ui.checkbox(&mut self.app_saved_state.show_extra_debug_stuff, tr("Show-debug-info"));
|
||||
ui.add_space(15.0);
|
||||
if self.app_saved_state.game_settings.friendly_fire || netman.friendly_fire.load(Ordering::Relaxed) {
|
||||
if netman.friendly_fire.load(Ordering::Relaxed) {
|
||||
let last = self.app_saved_state.game_settings.friendly_fire_team;
|
||||
ui.add(Slider::new(&mut self.app_saved_state.game_settings.friendly_fire_team, -1..=16));
|
||||
if last != self.app_saved_state.game_settings.friendly_fire_team {
|
||||
|
|
|
@ -17,13 +17,15 @@ pub fn player_path(path: PathBuf) -> PathBuf {
|
|||
path.join("files/system/player/unmodified.png")
|
||||
}
|
||||
|
||||
pub fn arrows_path(path: PathBuf, is_host: bool) -> PathBuf {
|
||||
let p = path.parent().unwrap().join("player_arrows");
|
||||
if is_host {
|
||||
pub fn arrows_path(path: PathBuf, is_host: bool) -> (PathBuf, PathBuf) {
|
||||
let parent = path.parent().unwrap();
|
||||
let p = parent.join("player_arrows");
|
||||
let o = parent.join("player_ping");
|
||||
(if is_host {
|
||||
p.join("arrow_host.png")
|
||||
} else {
|
||||
p.join("arrow.png")
|
||||
}
|
||||
}, o.join("arrow.png"))
|
||||
}
|
||||
|
||||
pub fn cursor_path(path: PathBuf) -> PathBuf {
|
||||
|
@ -251,7 +253,7 @@ pub fn create_player_png(
|
|||
let cosmetics = rgb.cosmetics;
|
||||
let rgb = rgb.colors;
|
||||
let tmp_path = player_path.parent().unwrap();
|
||||
let arrows_path = arrows_path(tmp_path.into(), is_host);
|
||||
let (arrows_path, ping_path) = arrows_path(tmp_path.into(), is_host);
|
||||
let cursor_path = cursor_path(tmp_path.into());
|
||||
let mut img = image::open(player_path).unwrap().into_rgba8();
|
||||
replace_color(
|
||||
|
@ -267,6 +269,13 @@ pub fn create_player_png(
|
|||
Rgba::from(rgb.player_alt),
|
||||
Rgba::from(rgb.player_arm),
|
||||
);
|
||||
let mut img_ping = image::open(ping_path).unwrap().into_rgba8();
|
||||
replace_color(
|
||||
&mut img_ping,
|
||||
Rgba::from(rgb.player_main),
|
||||
Rgba::from(rgb.player_alt),
|
||||
Rgba::from(rgb.player_arm),
|
||||
);
|
||||
let mut img_cursor = image::open(cursor_path).unwrap().into_rgba8();
|
||||
replace_color(
|
||||
&mut img_cursor,
|
||||
|
@ -278,6 +287,8 @@ pub fn create_player_png(
|
|||
img.save(path).unwrap();
|
||||
let path = tmp_path.join(format!("tmp/{}_arrow.png", id));
|
||||
img_arrow.save(path).unwrap();
|
||||
let path = tmp_path.join(format!("tmp/{}_ping.png", id));
|
||||
img_ping.save(path).unwrap();
|
||||
let path = tmp_path.join(format!("tmp/{}_cursor.png", id));
|
||||
img_cursor.save(path).unwrap();
|
||||
let img = create_arm(Rgba::from(rgb.player_forearm));
|
||||
|
@ -400,4 +411,4 @@ fn edit_by_replacing(
|
|||
|
||||
fn rgb_to_hex(rgb: [u8; 4]) -> String {
|
||||
format!("{:02X}{:02X}{:02X}", rgb[0], rgb[1], rgb[2])
|
||||
}
|
||||
}
|
|
@ -17,7 +17,9 @@ function ghost.on_world_update()
|
|||
local memory = EntityGetFirstComponentIncludingDisabled(entity, "VariableStorageComponent", "angry_ghost_projectile_memory")
|
||||
table.insert(ghosts_memory, ComponentGetValue2(memory, "value_string"))
|
||||
end
|
||||
rpc.send_ghost_data(ghosts_memory)
|
||||
if #ghosts_memory ~= 0 then
|
||||
rpc.send_ghost_data(ghosts_memory)
|
||||
end
|
||||
end
|
||||
|
||||
return ghost
|
|
@ -173,6 +173,8 @@ local function set_camera_free(enable)
|
|||
if cam ~= nil then
|
||||
ComponentSetValue2(cam, "center_camera_on_this_entity", not enable)
|
||||
ComponentSetValue2(cam, "move_camera_with_aim", not enable)
|
||||
else
|
||||
GameSetCameraFree(true)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -23,10 +23,6 @@ local function world2gui( x, y )
|
|||
return x, y, vres_scaling_factor
|
||||
end
|
||||
|
||||
local function is_suitable_target(entity)
|
||||
return EntityGetIsAlive(entity) and not EntityHasTag(entity,"ew_notplayer")
|
||||
end
|
||||
|
||||
function module.on_world_update()
|
||||
if EntityHasTag(ctx.my_player.entity, "polymorphed") and not EntityHasTag(ctx.my_player.entity, "ew_notplayer") then
|
||||
return
|
||||
|
@ -129,7 +125,7 @@ function module.on_world_update()
|
|||
img_path = "mods/quant.ew/files/system/player/tmp/" .. player_data.peer_id .. "_arrow.png"
|
||||
end
|
||||
end
|
||||
local scale = math.max(1 / 6, 0.7 - math.atan((math.sqrt(dist_sq) - tch) / 1280) / math.pi)
|
||||
local scale = math.max(1 / 6, 0.75 - math.atan((math.sqrt(dist_sq) - tch) / 1280) / math.pi)
|
||||
GuiImage(gui, gui_id, x, y, img_path, 1, scale, 0, math.atan2(player_dir_y, player_dir_x) + math.pi/2)
|
||||
gui_id = gui_id + 1
|
||||
end
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.4 KiB |
|
@ -68,6 +68,7 @@ function module.on_world_update()
|
|||
while i <= #pings do
|
||||
local pos = pings[i]
|
||||
local frame = pos[3]
|
||||
local peer_id = pos[4]
|
||||
if frame + 300 < GameGetFrameNum() then
|
||||
table.remove(pings, i)
|
||||
goto continue
|
||||
|
@ -106,14 +107,14 @@ function module.on_world_update()
|
|||
outside = true
|
||||
end
|
||||
|
||||
local img_path = "mods/quant.ew/files/system/player_ping/arrow.png"
|
||||
local img_path = "mods/quant.ew/files/system/player/tmp/".. peer_id .."_ping.png"
|
||||
if outside then
|
||||
local scale = math.max(1 / 6, 0.7 - math.atan((math.sqrt(dist_sq) - tch) / 1280) / math.pi)
|
||||
local scale = math.max(1 / 6, 0.75 - math.atan((math.sqrt(dist_sq) - tch) / 1280) / math.pi)
|
||||
local x, y = world2gui(ccx+player_dir_x, ccy+player_dir_y)
|
||||
GuiImage(gui, gui_id, x, y, img_path, 1, scale, 0, math.atan2(player_dir_y, player_dir_x) + math.pi/2)
|
||||
else
|
||||
local x, y = world2gui(pos[1], pos[2])
|
||||
GuiImage(gui, gui_id, x, y, img_path, 1, 0.7, 0, math.pi)
|
||||
GuiImage(gui, gui_id, x, y, img_path, 1, 0.75, 0, math.pi)
|
||||
end
|
||||
gui_id = gui_id + 1
|
||||
i = i + 1
|
||||
|
@ -123,7 +124,7 @@ function module.on_world_update()
|
|||
|
||||
rpc.opts_everywhere()
|
||||
function rpc.send_ping(x, y)
|
||||
table.insert(pings, {x, y, GameGetFrameNum()})
|
||||
table.insert(pings, {x, y, GameGetFrameNum(), ctx.rpc_peer_id})
|
||||
end
|
||||
|
||||
return module
|
Loading…
Add table
Add a link
Reference in a new issue