diff --git a/noita-proxy/src/bookkeeping/mod_manager.rs b/noita-proxy/src/bookkeeping/mod_manager.rs index 5221f98e..f41e37c2 100644 --- a/noita-proxy/src/bookkeeping/mod_manager.rs +++ b/noita-proxy/src/bookkeeping/mod_manager.rs @@ -81,7 +81,7 @@ impl ModmanagerSettings { if cfg!(target_os = "windows") { // Noita uses AppData folder instead of %AppData% let appdata_path = PathBuf::from( - std::env::var_os("USERPROFILE").expect("homepath to be defined on windows"), + env::var_os("USERPROFILE").expect("homepath to be defined on windows"), ) .join("AppData"); info!("Appdata path: {}", appdata_path.display()); diff --git a/noita-proxy/src/bookkeeping/noita_launcher.rs b/noita-proxy/src/bookkeeping/noita_launcher.rs index 3918f910..21481924 100644 --- a/noita-proxy/src/bookkeeping/noita_launcher.rs +++ b/noita-proxy/src/bookkeeping/noita_launcher.rs @@ -80,7 +80,7 @@ impl NoitaLauncher { } } - fn is_noita_running(&mut self) -> bool { + fn check_if_noita_running(&mut self) -> bool { match self.noita_process.as_mut().map(|child| child.try_wait()) { Some(Ok(Some(_))) => false, // Already exited Some(Ok(None)) => true, // Not yet exited @@ -90,7 +90,7 @@ impl NoitaLauncher { } pub fn launch_token(&mut self) -> LaunchTokenResult { - if self.is_noita_running() { + if self.check_if_noita_running() { return LaunchTokenResult::AlreadyStarted; } diff --git a/noita-proxy/src/bookkeeping/self_update.rs b/noita-proxy/src/bookkeeping/self_update.rs index 45665bf6..4edaded2 100644 --- a/noita-proxy/src/bookkeeping/self_update.rs +++ b/noita-proxy/src/bookkeeping/self_update.rs @@ -160,7 +160,7 @@ fn proxy_bin_name() -> &'static str { } fn proxy_downloader_for(download_path: PathBuf) -> Result { - let client = reqwest::blocking::Client::builder().timeout(None).build()?; + let client = Client::builder().timeout(None).build()?; get_latest_release(&client) .and_then(|release| release.get_release_assets(&client)) .and_then(|asset_list| asset_list.find_by_name(proxy_asset_name()).cloned()) diff --git a/noita-proxy/src/lib.rs b/noita-proxy/src/lib.rs index 7be1196c..692bed8c 100644 --- a/noita-proxy/src/lib.rs +++ b/noita-proxy/src/lib.rs @@ -369,7 +369,7 @@ impl App { self.change_state_to_netman(netman, player_path(self.modmanager_settings.mod_path())); } - fn connect_screen(&mut self, ctx: &egui::Context) { + fn connect_screen(&mut self, ctx: &Context) { egui::CentralPanel::default().show(ctx, |ui| { if self.app_saved_state.times_started % 20 == 0 { let image = egui::Image::new(egui::include_image!("../assets/longleg.png")) @@ -670,7 +670,7 @@ fn draw_bg(ui: &mut Ui) { } impl eframe::App for App { - fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { + fn update(&mut self, ctx: &Context, _frame: &mut eframe::Frame) { ctx.request_repaint_after(Duration::from_millis(500)); match &mut self.state { AppState::Connect => { @@ -777,10 +777,8 @@ impl eframe::App for App { } ui.add_space(15.0); - if netman.peer.is_host() { - if ui.button(tr("netman_show_settings")).clicked() { - self.show_settings = true; - } + if netman.peer.is_host() && ui.button(tr("netman_show_settings")).clicked() { + self.show_settings = true; } ui.add_space(15.0); diff --git a/noita-proxy/src/net.rs b/noita-proxy/src/net.rs index 830dcbcc..2d576d6f 100644 --- a/noita-proxy/src/net.rs +++ b/noita-proxy/src/net.rs @@ -49,7 +49,7 @@ pub fn ws_encode_proxy_bin(key: u8, data: &[u8]) -> tungstenite::Message { tungstenite::Message::Binary(buf) } -pub(crate) fn ws_encode_mod(peer: omni::OmniPeerId, data: &[u8]) -> tungstenite::Message { +pub(crate) fn ws_encode_mod(peer: OmniPeerId, data: &[u8]) -> tungstenite::Message { let mut buf = Vec::new(); buf.push(1u8); buf.extend_from_slice(&peer.0.to_le_bytes()); @@ -137,7 +137,7 @@ impl NetManager { .into() } - pub(crate) fn send(&self, peer: omni::OmniPeerId, msg: &NetMsg, reliability: Reliability) { + pub(crate) fn send(&self, peer: OmniPeerId, msg: &NetMsg, reliability: Reliability) { let encoded = lz4_flex::compress_prepend_size(&bitcode::encode(msg)); self.peer.send(peer, encoded.clone(), reliability).ok(); // TODO log } @@ -261,7 +261,7 @@ impl NetManager { &NetMsg::StartGame { settings: self.settings.lock().unwrap().clone(), }, - tangled::Reliability::Reliable, + Reliability::Reliable, ); create_player_png( &self.init_settings.mod_path, diff --git a/noita-proxy/src/net/steam_networking.rs b/noita-proxy/src/net/steam_networking.rs index e9190d7b..082177c0 100644 --- a/noita-proxy/src/net/steam_networking.rs +++ b/noita-proxy/src/net/steam_networking.rs @@ -18,7 +18,7 @@ use crate::{ releases::Version, }; -use super::omni::{self, OmniNetworkEvent}; +use super::omni::OmniNetworkEvent; #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum ConnectError { @@ -444,7 +444,7 @@ impl SteamPeer { } SteamEvent::PeerDisconnectedFromLobby(id) => { self.connections.disconnect(id); - returned_events.push(omni::OmniNetworkEvent::PeerDisconnected(id.into())) + returned_events.push(OmniNetworkEvent::PeerDisconnected(id.into())) } SteamEvent::PeerStateChanged => self.update_lobby_list(), } @@ -456,14 +456,14 @@ impl SteamPeer { .identity_peer() .steam_id() .expect("only steam ids are supported"); - returned_events.push(omni::OmniNetworkEvent::Message { + returned_events.push(OmniNetworkEvent::Message { src: steam_id.into(), data: message.data().to_vec(), // TODO eliminate clone here. }) } let mut fully_connected = self.connections.connected.lock().unwrap(); for steam_id in fully_connected.iter() { - returned_events.push(omni::OmniNetworkEvent::PeerConnected((*steam_id).into())) + returned_events.push(OmniNetworkEvent::PeerConnected((*steam_id).into())) } fully_connected.clear(); diff --git a/noita-proxy/src/net/world/world_model.rs b/noita-proxy/src/net/world/world_model.rs index 1ebd5e2a..6964f2cc 100644 --- a/noita-proxy/src/net/world/world_model.rs +++ b/noita-proxy/src/net/world/world_model.rs @@ -54,7 +54,7 @@ impl ChunkData { } impl WorldModel { - fn to_chunk_coords(x: i32, y: i32) -> (ChunkCoord, usize) { + fn get_chunk_coords(x: i32, y: i32) -> (ChunkCoord, usize) { let chunk_x = x.div_euclid(CHUNK_SIZE as i32); let chunk_y = y.div_euclid(CHUNK_SIZE as i32); let x = x.rem_euclid(CHUNK_SIZE as i32) as usize; @@ -64,7 +64,7 @@ impl WorldModel { } fn set_pixel(&mut self, x: i32, y: i32, pixel: Pixel) { - let (chunk_coord, offset) = Self::to_chunk_coords(x, y); + let (chunk_coord, offset) = Self::get_chunk_coords(x, y); let chunk = self.chunks.entry(chunk_coord).or_default(); let current = chunk.pixel(offset); if current != pixel { @@ -74,7 +74,7 @@ impl WorldModel { } fn get_pixel(&self, x: i32, y: i32) -> Pixel { - let (chunk_coord, offset) = Self::to_chunk_coords(x, y); + let (chunk_coord, offset) = Self::get_chunk_coords(x, y); self.chunks .get(&chunk_coord) .map(|chunk| chunk.pixel(offset)) @@ -94,7 +94,7 @@ impl WorldModel { } else { PixelFlags::Normal }; - for _ in 0..(run.length) { + for _ in 0..run.length { self.set_pixel( header.x + x, header.y + y, @@ -143,7 +143,7 @@ impl WorldModel { let chunk = self.chunks.entry(delta.chunk_coord).or_default(); let mut offset = 0; for run in delta.runs.iter() { - for _ in 0..(run.length) { + for _ in 0..run.length { if let Some(pixel) = run.data { chunk.set_compact_pixel(offset, pixel) } @@ -190,7 +190,7 @@ impl WorldModel { let chunk = self.chunks.entry(chunk).or_default(); let mut offset = 0; for run in &chunk_data.runs { - for _ in 0..(run.length) { + for _ in 0..run.length { let pixel = run.data; chunk.set_compact_pixel(offset, pixel); offset += 1; diff --git a/noita-proxy/src/player_cosmetics.rs b/noita-proxy/src/player_cosmetics.rs index 6531192f..83eedba9 100644 --- a/noita-proxy/src/player_cosmetics.rs +++ b/noita-proxy/src/player_cosmetics.rs @@ -11,8 +11,7 @@ use std::io::{BufRead, BufReader}; use std::path::{Path, PathBuf}; pub fn player_path(path: PathBuf) -> PathBuf { - let path = path.join("files/system/player/unmodified.png"); - path + path.join("files/system/player/unmodified.png") } pub fn replace_color(image: &mut RgbaImage, main: Rgba, alt: Rgba, arm: Rgba) { @@ -75,7 +74,7 @@ pub fn add_cosmetics( match i { 2 | 4 | 6 if hat && cosmetics.0 => *pixel = Rgba::from([255, 244, 140, 255]), 10 | 14 if hat && cosmetics.0 => *pixel = Rgba::from([191, 141, 65, 255]), - 11 | 12 | 13 if hat && cosmetics.0 => *pixel = Rgba::from([255, 206, 98, 255]), + 11..=13 if hat && cosmetics.0 => *pixel = Rgba::from([255, 206, 98, 255]), 61 if gem && cosmetics.2 => *pixel = Rgba::from([255, 242, 162, 255]), 68 if gem && cosmetics.2 => *pixel = Rgba::from([255, 227, 133, 255]), 69 if gem && cosmetics.2 => *pixel = Rgba::from([255, 94, 38, 255]), @@ -228,7 +227,7 @@ pub fn create_player_png( let cosmetics = rgb.1; let rgb = rgb.2; let tmp_path = player_path.parent().unwrap(); - let mut img = image::open(&player_path).unwrap().into_rgba8(); + let mut img = image::open(player_path).unwrap().into_rgba8(); replace_color( &mut img, Rgba::from(rgb.player_main), @@ -269,15 +268,15 @@ pub fn create_player_png( &[ ( "MARKER_HAT2_ENABLED", - (if cosmetics.0 { "1" } else { "0" }).into(), + (if cosmetics.0 { "image_file=\"data/enemies_gfx/player_hat2.xml\"" } else { "0" }).into(), ), ( "MARKER_AMULET_ENABLED", - (if cosmetics.1 { "1" } else { "0" }).into(), + (if cosmetics.1 { "image_file=\"data/enemies_gfx/player_amulet.xml\"" } else { "0" }).into(), ), ( "MARKER_AMULET_GEM_ENABLED", - (if cosmetics.2 { "1" } else { "0" }).into(), + (if cosmetics.2 { "image_file=\"data/enemies_gfx/player_amulet_gem.xml\"" } else { "0" }).into(), ), ( "MARKER_MAIN_SPRITE", @@ -342,4 +341,4 @@ fn edit_by_replacing( fn rgb_to_hex(rgb: [u8; 4]) -> String { format!("{:02X}{:02X}{:02X}", rgb[0], rgb[1], rgb[2]) -} +} \ No newline at end of file diff --git a/noita-proxy/src/recorder.rs b/noita-proxy/src/recorder.rs index 5974106c..fc9e2a13 100644 --- a/noita-proxy/src/recorder.rs +++ b/noita-proxy/src/recorder.rs @@ -34,15 +34,14 @@ pub(crate) struct Recorder { impl Default for Recorder { // This is a debug feature, so error handling can be lazier than usual. fn default() -> Self { - let exe_path = std::env::current_exe().expect("path to exist"); + let exe_path = env::current_exe().expect("path to exist"); let exe_dir_path = exe_path.parent().unwrap(); let recordings_base = exe_dir_path.join("crashcatcher_recordings"); // Find the earliest free path to put recordings in. let recording_dir = (1u64..) .map(|num| recordings_base.join(format!("recording_{num:02}"))) - .skip_while(|path| path.try_exists().unwrap_or(true)) - .next() + .find(|path| !path.try_exists().unwrap_or(true)) .expect("at least one name should be free"); fs::create_dir_all(&recording_dir).expect("can create directory"); diff --git a/noita-proxy/tangled/examples/chat.rs b/noita-proxy/tangled/examples/chat.rs index 09af8f95..92805b1c 100644 --- a/noita-proxy/tangled/examples/chat.rs +++ b/noita-proxy/tangled/examples/chat.rs @@ -17,9 +17,9 @@ fn main() { tracing::subscriber::set_global_default(subscriber).unwrap(); let mut args = args().skip(1); - let peer = match args.next().as_ref().map(|s| s.as_str()) { + let peer = match args.next().as_deref() { Some("host") => { - let bind_addr = match args.next().map_or(None, |arg| arg.parse().ok()) { + let bind_addr = match args.next().and_then(|arg| arg.parse().ok()) { Some(addr) => addr, None => { println!("Expected an address:port to host on as a second argument"); @@ -29,7 +29,7 @@ fn main() { Peer::host(bind_addr, None) } Some("connect") => { - let connect_addr = match args.next().map_or(None, |arg| arg.parse().ok()) { + let connect_addr = match args.next().and_then(|arg| arg.parse().ok()) { Some(addr) => addr, None => { println!("Expected an address:port to connect to as a second argument"); diff --git a/quant.ew/NoitaPatcher/noitapatcher/nsew/world.lua b/quant.ew/NoitaPatcher/noitapatcher/nsew/world.lua index 06e2607f..040d01d3 100644 --- a/quant.ew/NoitaPatcher/noitapatcher/nsew/world.lua +++ b/quant.ew/NoitaPatcher/noitapatcher/nsew/world.lua @@ -163,7 +163,7 @@ function world.encode_area(chunk_map, start_x, start_y, end_x, end_y, encoded_ar return encoded_area end -local PixelRun_const_ptr = ffi.typeof("struct PixelRun const*") +--local PixelRun_const_ptr = ffi.typeof("struct PixelRun const*") --- Load an encoded area back into the world. -- @param grid_world @@ -228,7 +228,7 @@ function world.decode(grid_world, header, pixel_runs) -- we skip positions like this. goto next_pixel end - + local cell_type = pixel.vtable.get_cell_type(pixel) if cell_type == C.CELL_TYPE_LIQUID then @@ -264,4 +264,4 @@ function world.decode(grid_world, header, pixel_runs) end end -return world +return world \ No newline at end of file diff --git a/quant.ew/NoitaPatcher/noitapatcher/nsew/world_orig.lua b/quant.ew/NoitaPatcher/noitapatcher/nsew/world_orig.lua index c82af160..ab142bb8 100644 --- a/quant.ew/NoitaPatcher/noitapatcher/nsew/world_orig.lua +++ b/quant.ew/NoitaPatcher/noitapatcher/nsew/world_orig.lua @@ -185,7 +185,7 @@ function world.encode_area(chunk_map, start_x, start_y, end_x, end_y, encoded_ar return encoded_area end -local PixelRun_const_ptr = ffi.typeof("struct PixelRun const*") +--local PixelRun_const_ptr = ffi.typeof("struct PixelRun const*") ---Load an encoded area back into the world. ---@param grid_world unknown @@ -260,4 +260,4 @@ function world.decode(grid_world, header, pixel_runs) end end -return world +return world \ No newline at end of file diff --git a/quant.ew/files/core/ctx.lua b/quant.ew/files/core/ctx.lua index e2bffce2..f78283a6 100644 --- a/quant.ew/files/core/ctx.lua +++ b/quant.ew/files/core/ctx.lua @@ -7,7 +7,7 @@ local ctx = { } setmetatable(ctx.hook, { - __index = function (_, k) + __index = function (_, _) return function() end end }) @@ -74,4 +74,4 @@ function ctx.load_system(system_name) return ctx.dofile_and_add_hooks("mods/quant.ew/files/system/"..system_name.."/"..system_name..".lua", system_name) end -return ctx +return ctx \ No newline at end of file diff --git a/quant.ew/files/core/inventory_helper.lua b/quant.ew/files/core/inventory_helper.lua index ceb47578..17850d64 100644 --- a/quant.ew/files/core/inventory_helper.lua +++ b/quant.ew/files/core/inventory_helper.lua @@ -1,6 +1,5 @@ local np = require("noitapatcher") local EZWand = dofile_once("mods/quant.ew/files/lib/EZWand.lua") -local pretty = dofile_once("mods/quant.ew/files/lib/pretty_print.lua") local util = dofile_once("mods/quant.ew/files/core/util.lua") local inventory_helper = {} @@ -28,7 +27,7 @@ function inventory_helper.get_inventory_items(player_data, inventory_name) if(not player)then return {} end - local inventory = nil + local inventory local player_child_entities = EntityGetAllChildren( player ) if ( player_child_entities ~= nil ) then @@ -96,7 +95,7 @@ function inventory_helper.serialize_single_item(item) end function inventory_helper.deserialize_single_item(item_data) - local item = nil + local item local x, y = item_data[3], item_data[4] if item_data[1] then item = EZWand(item_data[2], x, y, false).entity_id @@ -150,7 +149,7 @@ function inventory_helper.deserialize_single_item(item_data) ComponentSetValue2(item_cost_component, "stealable", true) end) end - + util.ensure_component_present(item, "SpriteComponent", "shop_cost", { image_file = "data/fonts/font_pixel_white.xml", @@ -175,7 +174,7 @@ function inventory_helper.get_item_data(player_data, fresh) if (not inventory2Comp) or inventory2Comp == 0 then return {}, {} end - + local mActiveItem = ComponentGetValue2(inventory2Comp, "mActiveItem") local wandData = {} local spellData = {} @@ -185,7 +184,7 @@ function inventory_helper.get_item_data(player_data, fresh) local item_x, item_y = EntityGetTransform(item) SetRandomSeed(item + slot_x + item_x, slot_y + item_y) - + if(entity_is_wand(item))then table.insert(wandData, { @@ -252,16 +251,16 @@ local function pickup_item(entity, item) EntityAddChild( child, item) end end - + EntitySetComponentsWithTagEnabled( item, "enabled_in_world", false ) EntitySetComponentsWithTagEnabled( item, "enabled_in_hand", false ) EntitySetComponentsWithTagEnabled( item, "enabled_in_inventory", true ) - + local wand_children = EntityGetAllChildren(item) or {} - + for k, v in ipairs(wand_children)do EntitySetComponentsWithTagEnabled( item, "enabled_in_world", false ) - end + end end function inventory_helper.set_item_data(item_data, player_data) @@ -279,12 +278,12 @@ function inventory_helper.set_item_data(item_data, player_data) if (item_data ~= nil) then - local active_item_entity = nil + local active_item_entity for k, itemInfo in ipairs(item_data) do - local x, y = EntityGetTransform(player) - local item_entity = nil - local item = nil + --local x, y = EntityGetTransform(player) + local item_entity + local item if(itemInfo.is_wand)then item = inventory_helper.deserialize_single_item(itemInfo.data) item = EZWand(item) @@ -351,7 +350,7 @@ end function inventory_helper.has_inventory_changed(player_data) local prev_inventory = player_data.prev_inventory_hash - + local inventory_hash = 0 for _, item in ipairs(GameGetAllInventoryItems(player_data.entity) or {}) do local item_comp = EntityGetFirstComponentIncludingDisabled(item, "ItemComponent") @@ -362,4 +361,4 @@ function inventory_helper.has_inventory_changed(player_data) return inventory_hash ~= prev_inventory end -return inventory_helper +return inventory_helper \ No newline at end of file diff --git a/quant.ew/files/core/net.lua b/quant.ew/files/core/net.lua index 04a7153c..4afaccc8 100644 --- a/quant.ew/files/core/net.lua +++ b/quant.ew/files/core/net.lua @@ -80,8 +80,8 @@ function net.init() reactor:run(function() local sock = net.sock while true do - local msg_decoded = nil - local msg = sock:await() + local msg_decoded + local msg = sock:await() if string.byte(msg, 1, 1) == 2 then local msg_l = string.sub(msg, 2) local res = string_split(msg_l, " ") @@ -102,7 +102,7 @@ function net.init() -- for _, b in ipairs(peer_id_b) do -- peer_id = peer_id + b * mult -- mult = mult * 256 - -- end + -- end local peer_id = "" for _, b in ipairs(peer_id_b) do peer_id = hex_table[b+1] .. peer_id @@ -143,7 +143,7 @@ function net.init() pollnet.sleep_ms(100) --print("Waiting for connection...") end - + end local DEST_PROXY = 1 @@ -199,4 +199,4 @@ function net.send_fire(fire_info) net.send("fire", fire_info, true) end -return net +return net \ No newline at end of file diff --git a/quant.ew/files/core/util.lua b/quant.ew/files/core/util.lua index fccd6161..983a5438 100644 --- a/quant.ew/files/core/util.lua +++ b/quant.ew/files/core/util.lua @@ -121,7 +121,7 @@ function util.set_ent_firing_blocked(entity, do_block) local inventory2Comp = EntityGetFirstComponentIncludingDisabled(entity, "Inventory2Component") if(inventory2Comp ~= nil)then local items = GameGetAllInventoryItems(entity) - for i, item in ipairs(items or {}) do + for _, item in ipairs(items or {}) do local ability = EntityGetFirstComponentIncludingDisabled( item, "AbilityComponent" ); if ability then if(do_block)then @@ -167,7 +167,7 @@ util.load_ents_tags = util.cached_fn(function(path) local tags_string = string.match(text, [[tags="(.-)">]]) local tags = util.string_split(tags_string, ",") - + return tags end) @@ -198,4 +198,4 @@ function util.get_or_create_component(entity, component_name, tag) return component end -return util +return util \ No newline at end of file diff --git a/quant.ew/files/lib/bitser.lua b/quant.ew/files/lib/bitser.lua index cca2d2a7..0dae78db 100644 --- a/quant.ew/files/lib/bitser.lua +++ b/quant.ew/files/lib/bitser.lua @@ -26,10 +26,10 @@ local setmetatable = setmetatable local ffi = require("ffi") local buf_pos = 0 local buf_size = -1 -local buf = nil +local buf local buf_is_writable = true -local writable_buf = nil -local writable_buf_size = nil +local writable_buf +local writable_buf_size local includeMetatables = true -- togglable with bitser.includeMetatables(false) local SEEN_LEN = {} diff --git a/quant.ew/files/lib/pollnet.lua b/quant.ew/files/lib/pollnet.lua index b8167d15..e62202c7 100644 --- a/quant.ew/files/lib/pollnet.lua +++ b/quant.ew/files/lib/pollnet.lua @@ -64,11 +64,11 @@ do local maj_req, min_req, pat_req = split_version(API_VERSION) local maj_dll, min_dll, pat_dll = split_version(POLLNET_VERSION) if maj_dll ~= maj_req then - error("Incompatible Pollnet binary: expected " .. API_VERSION + error("Incompatible Pollnet binary: expected " .. API_VERSION .. " got " .. POLLNET_VERSION) end if (min_dll < min_req) or (min_dll == min_req and pat_dll < pat_req) then - error("Incompatible Pollnet binary: expected " .. API_VERSION + error("Incompatible Pollnet binary: expected " .. API_VERSION .. " got " .. POLLNET_VERSION) end end @@ -83,7 +83,7 @@ local POLLNET_RESULT_CODES = { [6] = "newclient" } -local _ctx = nil +local _ctx local function init_ctx() if _ctx then return end @@ -131,8 +131,8 @@ local function format_headers(headers) error("HTTP headers must be table|string, got: " .. tostring(headers)) end local keys = {} - for name, _ in pairs(headers) do - table.insert(keys, name) + for name, _ in pairs(headers) do + table.insert(keys, name) end table.sort(keys) local frags = {} @@ -176,7 +176,7 @@ function socket_mt:http_get(url, headers, ret_body_only) headers = format_headers(headers or "") ret_body_only = not not ret_body_only return self:_open( - pollnet.pollnet_simple_http_get, + pollnet.pollnet_simple_http_get, url, headers, ret_body_only @@ -190,10 +190,10 @@ function socket_mt:http_post(url, headers, body, ret_body_only) }) ret_body_only = not not ret_body_only return self:_open( - pollnet.pollnet_simple_http_post, + pollnet.pollnet_simple_http_post, url, headers, - body, + body, #body, ret_body_only ) @@ -253,11 +253,11 @@ end function socket_mt:_get_message() local msg_size = pollnet.pollnet_get_data_size(_ctx, self._socket) if msg_size > 0 then - -- Note: unsafe_get_data_ptr requires careful consideration to use safely! + -- Note: unsafe_get_data_ptr requires careful consideration to use safely! -- Here we are OK because ffi.string copies the data to a new Lua string, -- so we only hang on to the pointer long enough for the copy. local raw_pointer = pollnet.pollnet_unsafe_get_data_ptr(_ctx, self._socket) - if raw_pointer == nil then + if raw_pointer == nil then error("Impossible situation: msg_size > 0 but null data pointer") end return ffi.string(raw_pointer, msg_size) @@ -268,7 +268,7 @@ end function socket_mt:poll() self._last_message = nil - if not self._socket then + if not self._socket then self._status = "invalid" return false, "invalid" end @@ -317,7 +317,7 @@ function socket_mt:await() return false, "timeout" end local happy, msg = self:poll() - if not happy then + if not happy then self:close() return false, "error: " .. tostring(msg) end @@ -429,11 +429,11 @@ end local function invoke_handler(handler, req, expose_errors) local happy, res = pcall(handler, req) - if happy then - return res + if happy then + return res else return { - status = "500", + status = "500", body = (expose_errors and tostring(res)) or "Internal Error" } end @@ -467,7 +467,7 @@ local exports = { VERSION = POLLNET_VERSION, init = init_ctx, init_hack_static = init_ctx_hack_static, - shutdown = shutdown_ctx, + shutdown = shutdown_ctx, Socket = Socket, Reactor = Reactor, pollnet = pollnet, diff --git a/quant.ew/files/lib/pretty_print.lua b/quant.ew/files/lib/pretty_print.lua index 20d60861..cf54eae5 100644 --- a/quant.ew/files/lib/pretty_print.lua +++ b/quant.ew/files/lib/pretty_print.lua @@ -3,43 +3,43 @@ pretty_print.table = function(node) -- to make output beautiful local function tab(amt) local str = "" - for i=1,amt do + for _ =1,amt do str = str .. "\t" end return str end - + local cache, stack, output = {},{},{} local depth = 1 local output_str = "{\n" - + while true do local size = 0 - for k,v in pairs(node) do + for _, _ in pairs(node) do size = size + 1 end - + local cur_index = 1 for k,v in pairs(node) do if (cache[node] == nil) or (cur_index >= cache[node]) then - + if (string.find(output_str,"}",output_str:len())) then output_str = output_str .. ",\n" elseif not (string.find(output_str,"\n",output_str:len())) then output_str = output_str .. "\n" end - + -- This is necessary for working with HUGE tables otherwise we run out of memory using concat on huge strings table.insert(output,output_str) output_str = "" - + local key if (type(k) == "number" or type(k) == "boolean") then key = "["..tostring(k).."]" else key = "['"..tostring(k).."']" end - + if (type(v) == "number" or type(v) == "boolean") then output_str = output_str .. tab(depth) .. key .. " = "..tostring(v) elseif (type(v) == "table") then @@ -51,7 +51,7 @@ pretty_print.table = function(node) else output_str = output_str .. tab(depth) .. key .. " = '"..tostring(v).."'" end - + if (cur_index == size) then output_str = output_str .. "\n" .. tab(depth-1) .. "}" else @@ -63,10 +63,10 @@ pretty_print.table = function(node) output_str = output_str .. "\n" .. tab(depth-1) .. "}" end end - + cur_index = cur_index + 1 end - + if (#stack > 0) then node = stack[#stack] stack[#stack] = nil @@ -75,11 +75,11 @@ pretty_print.table = function(node) break end end - + -- This is necessary for working with HUGE tables otherwise we run out of memory using concat on huge strings table.insert(output,output_str) output_str = table.concat(output) - + return output_str end return pretty_print \ No newline at end of file diff --git a/quant.ew/files/system/damage/sync.lua b/quant.ew/files/system/damage/sync.lua index 850b04aa..9a096e18 100644 --- a/quant.ew/files/system/damage/sync.lua +++ b/quant.ew/files/system/damage/sync.lua @@ -23,7 +23,7 @@ local function damage_received(damage, message, entity_id, add_healing_effect) if not was_my_player then return end - + module.recent_damage = module.recent_damage + damage if message ~= nil then module.recent_message = message @@ -62,7 +62,7 @@ function module.on_local_player_spawn(my_player) }) end ComponentSetValue2(damage_model, "wait_for_kill_flag_on_death", true) - + end function module.on_world_update_client() @@ -75,7 +75,7 @@ function module.on_world_update_client() end end -local last_health = nil +local last_health local function do_health_diff(hp, max_hp) local current_hp = util.get_ent_health(ctx.my_player.entity) @@ -155,21 +155,21 @@ ctx.cap.health = { rpc.opts_reliable() function rpc.deal_damage(damage, message) - local message = GameTextGetTranslatedOrNot(message) .. " ("..ctx.rpc_player_data.name..")" - module.last_damage_message = message + local message_n = GameTextGetTranslatedOrNot(message) .. " ("..ctx.rpc_player_data.name..")" + module.last_damage_message = message_n if ctx.is_host then local host_entity_id = ctx.my_player.entity local protection_component_id = GameGetGameEffect(host_entity_id, "PROTECTION_ALL") if protection_component_id ~= 0 then EntitySetComponentIsEnabled(host_entity_id, protection_component_id, false) end - + module.inflict_damage(damage) if protection_component_id ~= 0 then EntitySetComponentIsEnabled(host_entity_id, protection_component_id, true) end end - GamePrint(string.format("Got %.2f damage: %s", damage*25, message)) + GamePrint(string.format("Got %.2f damage: %s", damage*25, message_n)) end function rpc.update_shared_health(hp, max_hp) @@ -228,4 +228,4 @@ function rpc.melee_damage_client(target_peer, damage, message) end np.CrossCallAdd("ew_ds_client_damaged", rpc.melee_damage_client) -return module +return module \ No newline at end of file diff --git a/quant.ew/files/system/ending/ending.lua b/quant.ew/files/system/ending/ending.lua index d6e915d2..b15559c0 100644 --- a/quant.ew/files/system/ending/ending.lua +++ b/quant.ew/files/system/ending/ending.lua @@ -1,7 +1,6 @@ local util = dofile_once("mods/quant.ew/files/core/util.lua") local ctx = dofile_once("mods/quant.ew/files/core/ctx.lua") local net = dofile_once("mods/quant.ew/files/core/net.lua") -local player_fns = dofile_once("mods/quant.ew/files/core/player_fns.lua") local np = require("noitapatcher") local rpc = net.new_rpc_namespace() @@ -22,4 +21,4 @@ np.CrossCallAdd("ew_ending_sequence", function() rpc.gather_and_do_ending(x, y) end) -return module +return module \ No newline at end of file diff --git a/quant.ew/files/system/enemy_sync.lua b/quant.ew/files/system/enemy_sync.lua index 7f1bf063..c1af2eaf 100644 --- a/quant.ew/files/system/enemy_sync.lua +++ b/quant.ew/files/system/enemy_sync.lua @@ -16,7 +16,7 @@ local spawned_by_us = {} np.CrossCallAdd("ew_es_death_notify", function(enemy_id, responsible_id) local player_data = player_fns.get_player_data_by_local_entity_id(responsible_id) - local responsible = nil + local responsible if player_data ~= nil then responsible = player_data.peer_id else @@ -83,7 +83,7 @@ function enemy_sync.host_upload_entities() end local hp, max_hp, has_hp = util.get_ent_health(enemy_id) - local phys_info = nil + local phys_info -- Some things (like physics object) don't react well to making their entities ephemerial. local not_ephemerial = false @@ -106,7 +106,7 @@ function enemy_sync.host_upload_entities() -- local laser_sight_data = nil -- local laser_sight = EntityGetFirstComponentIncludingDisabled(enemy_id, "SpriteComponent", "laser_sight") -- if laser_sight ~= nil and laser_sight ~= 0 then - -- -- local x, y, r = + -- -- local x, y, r = -- end table.insert(enemy_data_list, {enemy_id, filename, x, y, vx, vy, hp, max_hp, phys_info, not_ephemerial}) @@ -217,7 +217,7 @@ function rpc.handle_enemy_data(enemy_data) local has_died = filename == nil local frame = GameGetFrameNum() - + if confirmed_kills[remote_enemy_id] then goto continue end @@ -225,7 +225,7 @@ function rpc.handle_enemy_data(enemy_data) if ctx.entity_by_remote_id[remote_enemy_id] ~= nil and not EntityGetIsAlive(ctx.entity_by_remote_id[remote_enemy_id].id) then ctx.entity_by_remote_id[remote_enemy_id] = nil end - + if ctx.entity_by_remote_id[remote_enemy_id] == nil then if filename == nil then goto continue @@ -265,9 +265,9 @@ function rpc.handle_enemy_data(enemy_data) end - local enemy_data = ctx.entity_by_remote_id[remote_enemy_id] - enemy_data.frame = frame - local enemy_id = enemy_data.id + local enemy_data_new = ctx.entity_by_remote_id[remote_enemy_id] + enemy_data_new.frame = frame + local enemy_id = enemy_data_new.id local phys_component = EntityGetFirstComponent(enemy_id, "PhysicsBody2Component") if phys_component ~= nil and phys_component ~= 0 and phys_info ~= nil then @@ -329,4 +329,4 @@ function rpc.replicate_projectile(seri_ent, position_x, position_y, target_x, ta end -return enemy_sync +return enemy_sync \ No newline at end of file diff --git a/quant.ew/files/system/extra_genomes/extra_genomes.lua b/quant.ew/files/system/extra_genomes/extra_genomes.lua index 15fa8b63..c69ed7ed 100644 --- a/quant.ew/files/system/extra_genomes/extra_genomes.lua +++ b/quant.ew/files/system/extra_genomes/extra_genomes.lua @@ -11,13 +11,13 @@ end local content = ModTextFileGetContent("data/genome_relations.csv") ---The function works like this: genome_name is the name of your new genome/faction, ---default_relation_ab is the relation with all the horizontal genomes which relations weren't specified in the table, ---default_relation_ba is the relation with all the vertical genomes which relations weren't specified in the table, ---self relation is the genome's relation with itself, +--The function works like this: genome_name is the name of your new genome/faction, +--default_relation_ab is the relation with all the horizontal genomes which relations weren't specified in the table, +--default_relation_ba is the relation with all the vertical genomes which relations weren't specified in the table, +--self relation is the genome's relation with itself, --relations is a table which directly specifies the value of the genome relation with. -local function add_new_genome(content, genome_name, default_relation_ab, default_relation_ba, self_relation, relations) +local function add_new_genome(genome_name, default_relation_ab, default_relation_ba, self_relation, relations) local lines = split_string(content, "\r\n") local output = "" local genome_order = {} @@ -32,7 +32,7 @@ local function add_new_genome(content, genome_name, default_relation_ab, default end local line = genome_name - for i, v in ipairs(genome_order) do + for _, v in ipairs(genome_order) do line = line .. "," .. (relations[v] or default_relation_ab) end output = output .. line .. "," .. self_relation @@ -40,11 +40,11 @@ local function add_new_genome(content, genome_name, default_relation_ab, default return output end -content = add_new_genome(content, "notplayer", 100, 100, 100, { +content = add_new_genome("notplayer", 100, 100, 100, { player = 0, }) -content = add_new_genome(content, "player_pvp", 0, 0, 0, {}) +content = add_new_genome("player_pvp", 0, 0, 0, {}) ModTextFileSetContent("data/genome_relations.csv", content) diff --git a/quant.ew/files/system/fungal_shift/sync.lua b/quant.ew/files/system/fungal_shift/sync.lua index 51afe497..6e25e012 100644 --- a/quant.ew/files/system/fungal_shift/sync.lua +++ b/quant.ew/files/system/fungal_shift/sync.lua @@ -59,7 +59,7 @@ function rpc.fungal_shift(conversions, iter, from_material_name) local add_icon = true local children = EntityGetAllChildren(entity) if children ~= nil then - for i,it in ipairs(children) do + for _,it in ipairs(children) do if ( EntityGetName(it) == "fungal_shift_ui_icon" ) then add_icon = false break @@ -90,4 +90,4 @@ np.CrossCallAdd("ew_fungal_shift", function(iter, from_material_name) conversions = {} end) -return module +return module \ No newline at end of file diff --git a/quant.ew/files/system/heart_pickups/sync.lua b/quant.ew/files/system/heart_pickups/sync.lua index e3228a90..c4af7d6d 100644 --- a/quant.ew/files/system/heart_pickups/sync.lua +++ b/quant.ew/files/system/heart_pickups/sync.lua @@ -1,7 +1,6 @@ local ctx = dofile_once("mods/quant.ew/files/core/ctx.lua") local net = dofile_once("mods/quant.ew/files/core/net.lua") local util = dofile_once("mods/quant.ew/files/core/util.lua") -local player_fns = dofile_once("mods/quant.ew/files/core/player_fns.lua") ModLuaFileAppend("data/scripts/items/heart.lua", "mods/quant.ew/files/system/heart_pickups/append/heart.lua") ModLuaFileAppend("data/scripts/items/heart_better.lua", "mods/quant.ew/files/system/heart_pickups/append/heart_better.lua") @@ -28,9 +27,9 @@ local function heart_pickup(heart) local max_hp_increase = max_hp_increase_table[heart] local hp, max_hp = ctx.cap.health.health(), ctx.cap.health.max_health() - local cap = util.get_ent_health_cap(ctx.my_player.entity) + --local cap = util.get_ent_health_cap(ctx.my_player.entity) local player_count = tonumber(GlobalsGetValue("ew_player_count", "1")) - + local max_hp_old = max_hp if max_hp_increase ~= nil then @@ -76,4 +75,4 @@ function rpc.heart_pickup(heart) heart_pickup(heart) end -return module +return module \ No newline at end of file diff --git a/quant.ew/files/system/item_sync.lua b/quant.ew/files/system/item_sync.lua index 1ea2773e..590fdc4f 100644 --- a/quant.ew/files/system/item_sync.lua +++ b/quant.ew/files/system/item_sync.lua @@ -2,7 +2,6 @@ local inventory_helper = dofile_once("mods/quant.ew/files/core/inventory_helper.lua") local ctx = dofile_once("mods/quant.ew/files/core/ctx.lua") local net = dofile_once("mods/quant.ew/files/core/net.lua") -local util = dofile_once("mods/quant.ew/files/core/util.lua") dofile_once("data/scripts/lib/coroutines.lua") @@ -92,7 +91,7 @@ function item_sync.host_localize_item(gid, peer_id) return end ctx.item_prevent_localize[gid] = true - + if table.contains(pending_remove, gid) then GamePrint("Item localize prevented, already taken") return @@ -130,10 +129,10 @@ function item_sync.make_item_global(item, instant) value_string = gid, }) end - local vel = EntityGetFirstComponentIncludingDisabled(item, "VelocityComponent") - if vel then - local vx, vy = ComponentGetValue2(vel, "mVelocity") - end + --local vel = EntityGetFirstComponentIncludingDisabled(item, "VelocityComponent") + --if vel then + -- local vx, vy = ComponentGetValue2(vel, "mVelocity") + --end local item_data = inventory_helper.serialize_single_item(item) item_data.gid = gid ctx.item_prevent_localize[gid] = false @@ -186,7 +185,7 @@ function item_sync.on_world_update_client() if thrown_item ~= nil and not EntityHasTag(thrown_item, "ew_client_item") then item_sync.make_item_global(thrown_item) end - + local picked_item = get_global_ent("ew_picked") if picked_item ~= nil and EntityHasTag(picked_item, "ew_global_item") then local gid = item_sync.get_global_item_id(picked_item) @@ -252,8 +251,8 @@ function rpc.initial_items(item_list) for _, item_data in ipairs(item_list) do local item = item_sync.find_by_gid(item_data.gid) if item == nil then - local item = inventory_helper.deserialize_single_item(item_data) - add_stuff_to_globalized_item(item, item_data.gid) + local item_new = inventory_helper.deserialize_single_item(item_data) + add_stuff_to_globalized_item(item_new, item_data.gid) end end end @@ -295,4 +294,4 @@ ctx.cap.item_sync = { end } -return item_sync +return item_sync \ No newline at end of file diff --git a/quant.ew/files/system/kolmi/kolmi.lua b/quant.ew/files/system/kolmi/kolmi.lua index 3451d6e5..e7407cfd 100644 --- a/quant.ew/files/system/kolmi/kolmi.lua +++ b/quant.ew/files/system/kolmi/kolmi.lua @@ -1,7 +1,6 @@ local util = dofile_once("mods/quant.ew/files/core/util.lua") local ctx = dofile_once("mods/quant.ew/files/core/ctx.lua") local net = dofile_once("mods/quant.ew/files/core/net.lua") -local player_fns = dofile_once("mods/quant.ew/files/core/player_fns.lua") local np = require("noitapatcher") dofile_once("data/scripts/lib/coroutines.lua") @@ -67,7 +66,7 @@ function rpc.kolmi_shield(is_on, orbcount) if kolmi == nil or kolmi == 0 then return end - + if switch_shield(kolmi, is_on) then return end @@ -137,4 +136,4 @@ ctx.cap.item_sync.register_pickup_handler(function(item_id) end end) -return module +return module \ No newline at end of file diff --git a/quant.ew/files/system/local_health/local_health.lua b/quant.ew/files/system/local_health/local_health.lua index f623018b..8b60cc26 100644 --- a/quant.ew/files/system/local_health/local_health.lua +++ b/quant.ew/files/system/local_health/local_health.lua @@ -94,18 +94,18 @@ function module.on_world_update() rpc.send_status(status) end - local hp, max_hp, has_hp = util.get_ent_health(ctx.my_player.entity) + local hp_new, max_hp_new, has_hp = util.get_ent_health(ctx.my_player.entity) if not ctx.my_player.currently_polymorphed and has_hp then - if hp <= 0 then + if hp_new <= 0 then -- Restore the player back to small amount of hp. - util.set_ent_health(ctx.my_player.entity, {5/25, max_hp}) + util.set_ent_health(ctx.my_player.entity, {5/25, max_hp_new}) player_died() end end - if notplayer_active then - local controls = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "ControlsComponent") - end + --if notplayer_active then + -- local controls = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "ControlsComponent") + --end end function module.on_world_update_client() diff --git a/quant.ew/files/system/nickname.lua b/quant.ew/files/system/nickname.lua index 632470af..bfe6feb9 100644 --- a/quant.ew/files/system/nickname.lua +++ b/quant.ew/files/system/nickname.lua @@ -1,13 +1,12 @@ local ctx = dofile_once("mods/quant.ew/files/core/ctx.lua") local net = dofile_once("mods/quant.ew/files/core/net.lua") -local player_fns = dofile_once("mods/quant.ew/files/core/player_fns.lua") local rpc = net.new_rpc_namespace() local util = dofile_once("mods/quant.ew/files/core/util.lua") local nickname = {} - + function nickname.parse( font_filename ) local id_width = {} @@ -18,7 +17,7 @@ function nickname.parse( font_filename ) local id = 0 local width = 0 - + for k, split in ipairs(util.string_split(file, "%s")) do --print(string.sub(line, 2, 9)) @@ -49,13 +48,13 @@ function nickname.parse( font_filename ) if (split == "") then space_open = true end end - + return id_width end @@ -67,7 +66,7 @@ function nickname.calculate_textwidth(text, font) local l = string.sub( text, i, i) if (l == " ") then textwidth = textwidth + font["space"] - else + else local c_id = string.byte(l) --GamePrint("Char: ".. l .. ". Id: "..tostring(c_id)) textwidth = textwidth + (font[c_id] or 1) @@ -137,4 +136,4 @@ function rpc.send_name(name) nickname.add_label(ctx.rpc_player_data.entity, name, "data/fonts/font_pixel_white.xml", 0.75) end -return nickname +return nickname \ No newline at end of file diff --git a/quant.ew/files/system/notplayer_ai/notplayer_ai.lua b/quant.ew/files/system/notplayer_ai/notplayer_ai.lua index 36a0f53d..987d1d3c 100644 --- a/quant.ew/files/system/notplayer_ai/notplayer_ai.lua +++ b/quant.ew/files/system/notplayer_ai/notplayer_ai.lua @@ -3,7 +3,7 @@ local wandfinder = dofile_once("mods/quant.ew/files/system/notplayer_ai/wandfind local MAX_RADIUS = 128*4 -local state = nil +local state local module = {} @@ -65,9 +65,9 @@ local function init_state() } end -local target = nil +local target -local last_length = nil +local last_length local last_did_hit = false @@ -307,8 +307,8 @@ local function update() ComponentSetValue2(state.control_component, "mButtonFrameFly", GameGetFrameNum()+1) end state.was_w = state.control_w - local _, y = EntityGetTransform(ctx.my_player.entity) - ComponentSetValue2(state.control_component, "mFlyingTargetY", y - 10) + local _, y_n = EntityGetTransform(ctx.my_player.entity) + ComponentSetValue2(state.control_component, "mFlyingTargetY", y_n - 10) if (GameGetFrameNum() % 300) == 299 then teleport_to_next_hm() diff --git a/quant.ew/files/system/patch_dragon_boss/dragonspot_script.lua b/quant.ew/files/system/patch_dragon_boss/dragonspot_script.lua index d22211c3..1076b337 100644 --- a/quant.ew/files/system/patch_dragon_boss/dragonspot_script.lua +++ b/quant.ew/files/system/patch_dragon_boss/dragonspot_script.lua @@ -7,7 +7,7 @@ function collision_trigger() local entity_id = GetUpdatedEntityID() local pos_x, pos_y = EntityGetTransform( entity_id ) - local eid = EntityLoad( "mods/quant.ew/files/system/patch_dragon_boss/dragon_boss_extra.xml", pos_x, pos_y ) + EntityLoad( "mods/quant.ew/files/system/patch_dragon_boss/dragon_boss_extra.xml", pos_x, pos_y ) EntityLoad( "data/entities/particles/image_emitters/magical_symbol_fast.xml", pos_x, pos_y ) EntityKill( entity_id ) diff --git a/quant.ew/files/system/patch_meat_biome/patch_meat_biome.lua b/quant.ew/files/system/patch_meat_biome/patch_meat_biome.lua index e299fd9e..c12afd9a 100644 --- a/quant.ew/files/system/patch_meat_biome/patch_meat_biome.lua +++ b/quant.ew/files/system/patch_meat_biome/patch_meat_biome.lua @@ -1,4 +1,3 @@ -local util = dofile_once("mods/quant.ew/files/core/util.lua") local ctx = dofile_once("mods/quant.ew/files/core/ctx.lua") ModLuaFileAppend("data/scripts/misc/no_heal_in_meat_biome.lua", "mods/quant.ew/files/system/patch_meat_biome/append/biome_check.lua") diff --git a/quant.ew/files/system/perk_patches/append/perks_common.lua b/quant.ew/files/system/perk_patches/append/perks_common.lua index 99174777..0abbf93a 100644 --- a/quant.ew/files/system/perk_patches/append/perks_common.lua +++ b/quant.ew/files/system/perk_patches/append/perks_common.lua @@ -1,14 +1,3 @@ -local function patch_perk(perk_id, ignore_original_func, fn) - local perk_data = get_perk_with_id(perk_list, perk_id) - local old_func = perk_data.func - perk_data.func = function(entity_perk_item, entity_who_picked, item_name, pickup_count) - if not ignore_original_func then - old_func(entity_perk_item, entity_who_picked, item_name, pickup_count) - end - fn(entity_perk_item, entity_who_picked, item_name, pickup_count) - end -end - local function hide_perk(perk_id) local perk_data = get_perk_with_id(perk_list, perk_id) perk_data.not_in_default_perk_pool = true diff --git a/quant.ew/files/system/perk_patches/append/perks_local.lua b/quant.ew/files/system/perk_patches/append/perks_local.lua index 8325ef1a..f36ba3af 100644 --- a/quant.ew/files/system/perk_patches/append/perks_local.lua +++ b/quant.ew/files/system/perk_patches/append/perks_local.lua @@ -1,14 +1,3 @@ -local function patch_perk(perk_id, ignore_original_func, fn) - local perk_data = get_perk_with_id(perk_list, perk_id) - local old_func = perk_data.func - perk_data.func = function(entity_perk_item, entity_who_picked, item_name, pickup_count) - if not ignore_original_func then - old_func(entity_perk_item, entity_who_picked, item_name, pickup_count) - end - fn(entity_perk_item, entity_who_picked, item_name, pickup_count) - end -end - local function hide_perk(perk_id) local perk_data = get_perk_with_id(perk_list, perk_id) perk_data.not_in_default_perk_pool = true diff --git a/quant.ew/files/system/perk_patches/init.lua b/quant.ew/files/system/perk_patches/init.lua index 6a0978be..25eef68c 100644 --- a/quant.ew/files/system/perk_patches/init.lua +++ b/quant.ew/files/system/perk_patches/init.lua @@ -1,7 +1,5 @@ -local util = dofile_once("mods/quant.ew/files/core/util.lua") local ctx = dofile_once("mods/quant.ew/files/core/ctx.lua") local net = dofile_once("mods/quant.ew/files/core/net.lua") -local player_fns = dofile_once("mods/quant.ew/files/core/player_fns.lua") local np = require("noitapatcher") local rpc = net.new_rpc_namespace() @@ -38,4 +36,4 @@ end np.CrossCallAdd("ew_perks_modify_max_hp", rpc.modify_max_hp) -return module +return module \ No newline at end of file diff --git a/quant.ew/files/system/player/player_cosmetics.lua b/quant.ew/files/system/player/player_cosmetics.lua index 5b27858d..37a2c87f 100644 --- a/quant.ew/files/system/player/player_cosmetics.lua +++ b/quant.ew/files/system/player/player_cosmetics.lua @@ -3,8 +3,8 @@ local net = dofile_once("mods/quant.ew/files/core/net.lua") local rpc = net.new_rpc_namespace() function player_color(player_entity) - local cape = nil - local player_arm = nil + local cape + local player_arm local player_child_entities = EntityGetAllChildren( player_entity ) if ( player_child_entities ~= nil ) then diff --git a/quant.ew/files/system/player/unmodified_base.xml b/quant.ew/files/system/player/unmodified_base.xml index 26edd9cf..78c74e8e 100644 --- a/quant.ew/files/system/player/unmodified_base.xml +++ b/quant.ew/files/system/player/unmodified_base.xml @@ -1,7 +1,7 @@ - - + - + - - + - - - - - - - @@ -165,59 +165,59 @@ suck_health="1" > - - - - - - @@ -229,19 +229,19 @@ - + > - + @@ -324,12 +324,12 @@ - + - - + - + - + - + - + - + - - - - + - + - + - + - + - + - - - - - - - - - - - - - - + - + -