mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
fix player cosmetics options being broken by peers by last patch, make linter happier
This commit is contained in:
parent
ec1c006914
commit
5bc707f9b4
47 changed files with 366 additions and 425 deletions
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ fn proxy_bin_name() -> &'static str {
|
|||
}
|
||||
|
||||
fn proxy_downloader_for(download_path: PathBuf) -> Result<Downloader, ReleasesError> {
|
||||
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())
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<u8>, alt: Rgba<u8>, arm: Rgba<u8>) {
|
||||
|
@ -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])
|
||||
}
|
||||
}
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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 = {}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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()
|
||||
|
|
|
@ -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 == "<QuadChar") then
|
||||
quad_open = true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if (split == "<WordSpace>") 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
|
|
@ -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()
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Entity
|
||||
<Entity
|
||||
name="client"
|
||||
tags="mortal,human,hittable,peasant,prey,teleportable,ew_client,ew_peer,polymorphable_NOT" >
|
||||
|
||||
|
||||
<HotspotComponent
|
||||
_tags="hand"
|
||||
sprite_hotspot_name="hand"
|
||||
|
@ -18,14 +18,14 @@
|
|||
offset.x="0"
|
||||
offset.y="2"
|
||||
></HotspotComponent>
|
||||
|
||||
|
||||
<HotspotComponent
|
||||
_tags="crouch_sensor"
|
||||
offset.x="0"
|
||||
offset.y="-14"
|
||||
></HotspotComponent>
|
||||
|
||||
<PhysicsPickUpComponent
|
||||
<PhysicsPickUpComponent
|
||||
original_left_joint_pos.x="-8"
|
||||
original_left_joint_pos.y="-2"
|
||||
original_right_joint_pos.x="-2"
|
||||
|
@ -44,41 +44,41 @@
|
|||
eating_area_max.y="6"
|
||||
eating_cells_per_frame="2"
|
||||
></PlatformShooterPlayerComponent>
|
||||
|
||||
|
||||
<PathFindingGridMarkerComponent
|
||||
player_marker_radius="100.0"
|
||||
marker_offset_y="-3"
|
||||
marker_work_flag="8"
|
||||
></PathFindingGridMarkerComponent>
|
||||
|
||||
<PlayerCollisionComponent
|
||||
<PlayerCollisionComponent
|
||||
getting_crushed_threshold="6"
|
||||
moving_up_before_getting_crushed_threshold="6"
|
||||
></PlayerCollisionComponent >
|
||||
|
||||
<CharacterDataComponent
|
||||
<CharacterDataComponent
|
||||
platforming_type="2"
|
||||
check_collision_max_size_x="4"
|
||||
check_collision_max_size_y="4"
|
||||
climb_over_y="4"
|
||||
collision_aabb_min_x="-2.0"
|
||||
collision_aabb_max_x="2.0"
|
||||
collision_aabb_min_y="-4.5"
|
||||
check_collision_max_size_x="4"
|
||||
check_collision_max_size_y="4"
|
||||
climb_over_y="4"
|
||||
collision_aabb_min_x="-2.0"
|
||||
collision_aabb_max_x="2.0"
|
||||
collision_aabb_min_y="-4.5"
|
||||
collision_aabb_max_y="2.1"
|
||||
eff_hg_offset_y="1.28572"
|
||||
eff_hg_position_x="0"
|
||||
eff_hg_position_y="5"
|
||||
eff_hg_size_x="6.42857"
|
||||
eff_hg_size_y="5.14286"
|
||||
eff_hg_velocity_max_x="19.5787896514"
|
||||
eff_hg_velocity_max_y="-11.5714"
|
||||
eff_hg_velocity_min_x="-19.5714"
|
||||
eff_hg_velocity_min_y="-40"
|
||||
eff_hg_offset_y="1.28572"
|
||||
eff_hg_position_x="0"
|
||||
eff_hg_position_y="5"
|
||||
eff_hg_size_x="6.42857"
|
||||
eff_hg_size_y="5.14286"
|
||||
eff_hg_velocity_max_x="19.5787896514"
|
||||
eff_hg_velocity_max_y="-11.5714"
|
||||
eff_hg_velocity_min_x="-19.5714"
|
||||
eff_hg_velocity_min_y="-40"
|
||||
eff_hg_damage_min="10"
|
||||
eff_hg_damage_max="95"
|
||||
eff_hg_update_box2d="0"
|
||||
eff_hg_b2force_multiplier="0.0015"
|
||||
effect_hit_ground="1"
|
||||
effect_hit_ground="1"
|
||||
fly_time_max="3.0"
|
||||
fly_recharge_spd="0.4"
|
||||
fly_recharge_spd_ground="6"
|
||||
|
@ -90,17 +90,17 @@
|
|||
send_transform_update_message="1"
|
||||
></CharacterDataComponent>
|
||||
|
||||
<GenomeDataComponent
|
||||
<GenomeDataComponent
|
||||
herd_id="player"
|
||||
food_chain_rank="20"
|
||||
is_predator="1"
|
||||
berserk_dont_attack_friends="1"
|
||||
></GenomeDataComponent>
|
||||
|
||||
<CharacterPlatformingComponent
|
||||
animation_to_play=""
|
||||
jump_keydown_buffer="2"
|
||||
jump_velocity_y="-95"
|
||||
<CharacterPlatformingComponent
|
||||
animation_to_play=""
|
||||
jump_keydown_buffer="2"
|
||||
jump_velocity_y="-95"
|
||||
jump_velocity_x="56"
|
||||
fly_model_player="0"
|
||||
fly_smooth_y="0"
|
||||
|
@ -108,53 +108,53 @@
|
|||
fly_speed_max_down="85"
|
||||
fly_speed_mult="20"
|
||||
fly_speed_change_spd="0.25"
|
||||
mouse_look="1"
|
||||
mouse_look="1"
|
||||
keyboard_look="1"
|
||||
mouse_look_buffer="1"
|
||||
pixel_gravity="350"
|
||||
mouse_look_buffer="1"
|
||||
pixel_gravity="350"
|
||||
run_velocity="154"
|
||||
fly_velocity_x="52"
|
||||
accel_x="0.15"
|
||||
turning_buffer="0.5"
|
||||
velocity_min_x="-57"
|
||||
velocity_max_x="57"
|
||||
fly_velocity_x="52"
|
||||
accel_x="0.15"
|
||||
turning_buffer="0.5"
|
||||
velocity_min_x="-57"
|
||||
velocity_max_x="57"
|
||||
velocity_min_y="-200"
|
||||
velocity_max_y="350"
|
||||
></CharacterPlatformingComponent>
|
||||
|
||||
<ControlsComponent
|
||||
enabled="0"
|
||||
<ControlsComponent
|
||||
enabled="0"
|
||||
gamepad_fire_on_thumbstick_extend="0"
|
||||
gamepad_fire_on_thumbstick_extend_threshold="0.9"
|
||||
gamepad_indirect_aiming_enabled="0"
|
||||
></ControlsComponent>
|
||||
|
||||
<DamageModelComponent
|
||||
air_in_lungs="7"
|
||||
air_in_lungs_max="7"
|
||||
air_lack_of_damage="0.6"
|
||||
air_needed="1"
|
||||
falling_damage_damage_max="1.2"
|
||||
falling_damage_damage_min="0.1"
|
||||
falling_damage_height_max="250"
|
||||
falling_damage_height_min="70"
|
||||
falling_damages="0"
|
||||
fire_damage_amount="0.2"
|
||||
fire_probability_of_ignition="1"
|
||||
|
||||
<DamageModelComponent
|
||||
air_in_lungs="7"
|
||||
air_in_lungs_max="7"
|
||||
air_lack_of_damage="0.6"
|
||||
air_needed="1"
|
||||
falling_damage_damage_max="1.2"
|
||||
falling_damage_damage_min="0.1"
|
||||
falling_damage_height_max="250"
|
||||
falling_damage_height_min="70"
|
||||
falling_damages="0"
|
||||
fire_damage_amount="0.2"
|
||||
fire_probability_of_ignition="1"
|
||||
invincibility_frames="60"
|
||||
hp="-1"
|
||||
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,rock_static_cursed,magic_gas_hp_regeneration,gold_radioactive,gold_static_radioactive,rock_static_cursed_green,cursed_liquid,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"
|
||||
ragdoll_filenames_file="data/ragdolls/player/filenames.txt"
|
||||
hp="-1"
|
||||
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,rock_static_cursed,magic_gas_hp_regeneration,gold_radioactive,gold_static_radioactive,rock_static_cursed_green,cursed_liquid,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"
|
||||
ragdoll_filenames_file="data/ragdolls/player/filenames.txt"
|
||||
ragdoll_offset_y="-5"
|
||||
ragdollify_child_entity_sprites="1"
|
||||
blood_spray_material="blood"
|
||||
physics_objects_damage="0"
|
||||
critical_damage_resistance="1"
|
||||
><damage_multipliers
|
||||
explosion="0.35"
|
||||
explosion="0.35"
|
||||
holy="1.5"
|
||||
>
|
||||
</damage_multipliers>
|
||||
|
@ -165,59 +165,59 @@
|
|||
suck_health="1"
|
||||
></MaterialSuckerComponent>
|
||||
|
||||
<HitboxComponent
|
||||
aabb_max_x="3"
|
||||
aabb_max_y="4"
|
||||
aabb_min_x="-3"
|
||||
aabb_min_y="-12"
|
||||
is_enemy="0"
|
||||
is_item="0"
|
||||
<HitboxComponent
|
||||
aabb_max_x="3"
|
||||
aabb_max_y="4"
|
||||
aabb_min_x="-3"
|
||||
aabb_min_y="-12"
|
||||
is_enemy="0"
|
||||
is_item="0"
|
||||
is_player="1"
|
||||
></HitboxComponent>
|
||||
|
||||
<HitboxComponent
|
||||
|
||||
<HitboxComponent
|
||||
_tags="crouched"
|
||||
_enabled="0"
|
||||
aabb_max_x="3"
|
||||
aabb_max_y="4"
|
||||
aabb_min_x="-3"
|
||||
aabb_min_y="-8.5"
|
||||
is_enemy="0"
|
||||
is_item="0"
|
||||
_enabled="0"
|
||||
aabb_max_x="3"
|
||||
aabb_max_y="4"
|
||||
aabb_min_x="-3"
|
||||
aabb_min_y="-8.5"
|
||||
is_enemy="0"
|
||||
is_item="0"
|
||||
is_player="1"
|
||||
></HitboxComponent>
|
||||
|
||||
<Inventory2Component
|
||||
_enabled="1"
|
||||
full_inventory_slots_x="0"
|
||||
full_inventory_slots_y="0"
|
||||
mSavedActiveItemIndex="0"
|
||||
quick_inventory_slots="4"
|
||||
_enabled="1"
|
||||
full_inventory_slots_x="0"
|
||||
full_inventory_slots_y="0"
|
||||
mSavedActiveItemIndex="0"
|
||||
quick_inventory_slots="4"
|
||||
></Inventory2Component>
|
||||
|
||||
<SpriteAnimatorComponent>
|
||||
</SpriteAnimatorComponent>
|
||||
|
||||
<SpriteComponent
|
||||
_tags="character,lukki_disable"
|
||||
alpha="1"
|
||||
image_file="MARKER_MAIN_SPRITE"
|
||||
next_rect_animation=""
|
||||
offset_x="6"
|
||||
offset_y="14"
|
||||
rect_animation="walk"
|
||||
<SpriteComponent
|
||||
_tags="character,lukki_disable"
|
||||
alpha="1"
|
||||
image_file="MARKER_MAIN_SPRITE"
|
||||
next_rect_animation=""
|
||||
offset_x="6"
|
||||
offset_y="14"
|
||||
rect_animation="walk"
|
||||
z_index="0.6"
|
||||
></SpriteComponent>
|
||||
|
||||
<SpriteComponent
|
||||
|
||||
<SpriteComponent
|
||||
_tags="character,lukki_enable"
|
||||
_enabled="0"
|
||||
alpha="1"
|
||||
image_file="data/enemies_gfx/player_lukky.xml"
|
||||
next_rect_animation=""
|
||||
offset_x="6"
|
||||
offset_y="14"
|
||||
rect_animation="walk"
|
||||
alpha="1"
|
||||
image_file="data/enemies_gfx/player_lukky.xml"
|
||||
next_rect_animation=""
|
||||
offset_x="6"
|
||||
offset_y="14"
|
||||
rect_animation="walk"
|
||||
z_index="0.6"
|
||||
></SpriteComponent>
|
||||
|
||||
|
@ -229,19 +229,19 @@
|
|||
|
||||
<Entity name="arm_r" tags="player_arm_r">
|
||||
|
||||
<SpriteComponent
|
||||
_tags="with_item"
|
||||
alpha="1"
|
||||
image_file="MARKER_ARM_SPRITE"
|
||||
next_rect_animation=""
|
||||
rect_animation="default"
|
||||
<SpriteComponent
|
||||
_tags="with_item"
|
||||
alpha="1"
|
||||
image_file="MARKER_ARM_SPRITE"
|
||||
next_rect_animation=""
|
||||
rect_animation="default"
|
||||
z_index="0.59"
|
||||
></SpriteComponent>
|
||||
|
||||
<InheritTransformComponent
|
||||
parent_hotspot_tag="right_arm_root"
|
||||
only_position="1"
|
||||
></InheritTransformComponent>
|
||||
></InheritTransformComponent>
|
||||
|
||||
<HotspotComponent
|
||||
_tags="hand"
|
||||
|
@ -305,7 +305,7 @@
|
|||
event_name="player/pick_gold_sand"
|
||||
volume_autofade_speed="0.05"
|
||||
></AudioLoopComponent>
|
||||
|
||||
|
||||
<GunComponent>
|
||||
</GunComponent>
|
||||
|
||||
|
@ -324,12 +324,12 @@
|
|||
<ParticleEmitterComponent
|
||||
offset.x="-2"
|
||||
offset.y="5"
|
||||
lifetime_min="0.0"
|
||||
lifetime_min="0.0"
|
||||
></ParticleEmitterComponent>
|
||||
|
||||
|
||||
</Base>
|
||||
|
||||
<LightComponent
|
||||
<LightComponent
|
||||
r="255"
|
||||
g="255"
|
||||
b="255"
|
||||
|
@ -340,7 +340,7 @@
|
|||
<VelocityComponent
|
||||
updates_velocity="0"
|
||||
></VelocityComponent>
|
||||
|
||||
|
||||
<!-- cape -->
|
||||
|
||||
<HotspotComponent
|
||||
|
@ -348,125 +348,126 @@
|
|||
sprite_hotspot_name="cape" >
|
||||
</HotspotComponent>
|
||||
|
||||
<Entity name="cape">
|
||||
<Entity name="cape">
|
||||
<Base file="MARKER_CAPE">
|
||||
</Base>
|
||||
</Base>
|
||||
</Entity>
|
||||
|
||||
|
||||
<!-- belt -->
|
||||
|
||||
|
||||
<HotspotComponent
|
||||
_tags="belt_root"
|
||||
sprite_hotspot_name="belt"
|
||||
></HotspotComponent>
|
||||
|
||||
|
||||
<!-- ingestion -->
|
||||
|
||||
<MaterialInventoryComponent
|
||||
<MaterialInventoryComponent
|
||||
_tags="ingestion"
|
||||
drop_as_item="0"
|
||||
on_death_spill="0"
|
||||
kill_when_empty="0"
|
||||
></MaterialInventoryComponent>
|
||||
|
||||
<IngestionComponent
|
||||
|
||||
<IngestionComponent
|
||||
ingestion_capacity="7500"
|
||||
overingestion_damage="0.002"
|
||||
blood_healing_speed="0.0024"
|
||||
></IngestionComponent>
|
||||
|
||||
<!-- -->
|
||||
<!-- -->
|
||||
|
||||
<WalletComponent>
|
||||
</WalletComponent>
|
||||
|
||||
<StreamingKeepAliveComponent>
|
||||
</StreamingKeepAliveComponent>
|
||||
|
||||
|
||||
<KickComponent>
|
||||
</KickComponent>
|
||||
|
||||
|
||||
<VariableStorageComponent
|
||||
name="ocarina_song"
|
||||
value_string=""
|
||||
></VariableStorageComponent>
|
||||
|
||||
|
||||
<VariableStorageComponent
|
||||
name="kantele_song"
|
||||
value_string=""
|
||||
></VariableStorageComponent>
|
||||
|
||||
|
||||
<VariableStorageComponent
|
||||
name="ocarina_song_pos"
|
||||
value_int="0"
|
||||
></VariableStorageComponent>
|
||||
|
||||
|
||||
<VariableStorageComponent
|
||||
name="kantele_song_pos"
|
||||
value_int="0"
|
||||
></VariableStorageComponent>
|
||||
|
||||
<SpriteComponent
|
||||
_tags="character,player_amulet"
|
||||
alpha="1"
|
||||
image_file="data/enemies_gfx/player_amulet.xml"
|
||||
next_rect_animation=""
|
||||
offset_x="6"
|
||||
offset_y="14"
|
||||
rect_animation="walk"
|
||||
|
||||
<SpriteComponent
|
||||
_tags="character,player_amulet"
|
||||
alpha="1"
|
||||
MARKER_AMULET_ENABLED
|
||||
next_rect_animation=""
|
||||
offset_x="6"
|
||||
offset_y="14"
|
||||
rect_animation="walk"
|
||||
z_index="0.59"
|
||||
_enabled="MARKER_AMULET_ENABLED"
|
||||
_enable="0"
|
||||
></SpriteComponent>
|
||||
|
||||
<SpriteComponent
|
||||
_tags="character,player_amulet_gem"
|
||||
alpha="1"
|
||||
image_file="data/enemies_gfx/player_amulet_gem.xml"
|
||||
next_rect_animation=""
|
||||
offset_x="6"
|
||||
offset_y="14"
|
||||
rect_animation="walk"
|
||||
|
||||
<SpriteComponent
|
||||
_tags="character,player_amulet_gem"
|
||||
alpha="1"
|
||||
MARKER_AMULET_GEM_ENABLED
|
||||
next_rect_animation=""
|
||||
offset_x="6"
|
||||
offset_y="14"
|
||||
rect_animation="walk"
|
||||
z_index="0.58"
|
||||
_enabled="MARKER_AMULET_GEM_ENABLED"
|
||||
_enable="0"
|
||||
></SpriteComponent>
|
||||
|
||||
<SpriteComponent
|
||||
|
||||
<SpriteComponent
|
||||
_tags="character,player_hat"
|
||||
alpha="1"
|
||||
image_file="data/enemies_gfx/player_hat.xml"
|
||||
next_rect_animation=""
|
||||
offset_x="6"
|
||||
offset_y="14"
|
||||
rect_animation="walk"
|
||||
alpha="1"
|
||||
image_file="data/enemies_gfx/player_hat.xml"
|
||||
next_rect_animation=""
|
||||
offset_x="6"
|
||||
offset_y="14"
|
||||
rect_animation="walk"
|
||||
z_index="0.59"
|
||||
_enabled="0"
|
||||
></SpriteComponent>
|
||||
|
||||
<SpriteComponent
|
||||
|
||||
<SpriteComponent
|
||||
_tags="character,player_hat2"
|
||||
alpha="1"
|
||||
image_file="data/enemies_gfx/player_hat2.xml"
|
||||
next_rect_animation=""
|
||||
offset_x="6"
|
||||
offset_y="14"
|
||||
rect_animation="walk"
|
||||
alpha="1"
|
||||
image_file="data/enemies_gfx/player_hat2.xml"
|
||||
MARKER_HAT2_ENABLED
|
||||
next_rect_animation=""
|
||||
offset_x="6"
|
||||
offset_y="14"
|
||||
rect_animation="walk"
|
||||
z_index="0.58"
|
||||
_enabled="MARKER_HAT2_ENABLED"
|
||||
_enable="0"
|
||||
></SpriteComponent>
|
||||
|
||||
<SpriteComponent
|
||||
|
||||
<SpriteComponent
|
||||
_tags="character,player_hat2_shadow"
|
||||
alpha="1"
|
||||
image_file="data/enemies_gfx/player_hat2_shadow.xml"
|
||||
next_rect_animation=""
|
||||
offset_x="6"
|
||||
offset_y="14"
|
||||
rect_animation="walk"
|
||||
alpha="1"
|
||||
image_file="data/enemies_gfx/player_hat2_shadow.xml"
|
||||
next_rect_animation=""
|
||||
offset_x="6"
|
||||
offset_y="14"
|
||||
rect_animation="walk"
|
||||
z_index="0.58"
|
||||
_enabled="MARKER_HAT2_ENABLED"
|
||||
></SpriteComponent>
|
||||
|
||||
<ParticleEmitterComponent
|
||||
<ParticleEmitterComponent
|
||||
_tags="fast_movement_particles"
|
||||
emitted_material_name="spark_white"
|
||||
offset.x="0"
|
||||
|
@ -501,7 +502,7 @@
|
|||
>
|
||||
</ParticleEmitterComponent>
|
||||
|
||||
<ParticleEmitterComponent
|
||||
<ParticleEmitterComponent
|
||||
_tags="fast_movement_particles"
|
||||
emitted_material_name="spark_white"
|
||||
offset.x="-2"
|
||||
|
@ -536,7 +537,7 @@
|
|||
>
|
||||
</ParticleEmitterComponent>
|
||||
|
||||
<ParticleEmitterComponent
|
||||
<ParticleEmitterComponent
|
||||
_tags="fast_movement_particles"
|
||||
emitted_material_name="spark_white"
|
||||
offset.x="0"
|
||||
|
@ -576,21 +577,21 @@
|
|||
value_string=""
|
||||
/>
|
||||
|
||||
<Entity name="chunk_loader">
|
||||
<Entity name="chunk_loader">
|
||||
<Base file="mods/quant.ew/files/resource/entities/chunk_loader.xml">
|
||||
</Base>
|
||||
</Base>
|
||||
</Entity>
|
||||
|
||||
<Entity name="cursor">
|
||||
<SpriteComponent
|
||||
alpha="1"
|
||||
image_file="mods/quant.ew/files/resource/sprites/cursor.png"
|
||||
next_rect_animation=""
|
||||
offset_x="6.5"
|
||||
offset_y="6.5"
|
||||
<SpriteComponent
|
||||
alpha="1"
|
||||
image_file="mods/quant.ew/files/resource/sprites/cursor.png"
|
||||
next_rect_animation=""
|
||||
offset_x="6.5"
|
||||
offset_y="6.5"
|
||||
emissive="1"
|
||||
additive="1"
|
||||
rect_animation=""
|
||||
rect_animation=""
|
||||
z_index="1"
|
||||
update_transform="1"
|
||||
update_transform_rotation="0"
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
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 rpc = net.new_rpc_namespace()
|
||||
|
||||
local gui = GuiCreate()
|
||||
|
||||
|
@ -14,10 +9,10 @@ local module = {}
|
|||
local function world2gui( x, y )
|
||||
in_camera_ref = in_camera_ref or false
|
||||
|
||||
local gui = GuiCreate()
|
||||
GuiStartFrame(gui)
|
||||
local w, h = GuiGetScreenDimensions( gui )
|
||||
GuiDestroy(gui)
|
||||
local gui_n = GuiCreate()
|
||||
GuiStartFrame(gui_n)
|
||||
local w, h = GuiGetScreenDimensions(gui_n)
|
||||
GuiDestroy(gui_n)
|
||||
|
||||
local vres_scaling_factor = w/( MagicNumbersGetValue( "VIRTUAL_RESOLUTION_X" ) + MagicNumbersGetValue( "VIRTUAL_RESOLUTION_OFFSET_X" ))
|
||||
local cam_x, cam_y = GameGetCameraPos()
|
||||
|
@ -52,7 +47,7 @@ function module.on_world_update()
|
|||
-- local dist_sq = player_dir_x * player_dir_x + player_dir_y * player_dir_y
|
||||
-- player_dir_x = player_dir_x / dist
|
||||
-- player_dir_y = player_dir_y / dist
|
||||
|
||||
|
||||
local okay_to_display = false
|
||||
|
||||
-- Contain the arrow in screen rect.
|
||||
|
@ -106,4 +101,4 @@ function module.on_world_update()
|
|||
end
|
||||
end
|
||||
|
||||
return module
|
||||
return module
|
|
@ -1,8 +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()
|
||||
|
||||
|
@ -10,7 +8,7 @@ local module = {}
|
|||
|
||||
function rpc.player_update(input_data, pos_data, current_slot)
|
||||
local peer_id = ctx.rpc_peer_id
|
||||
|
||||
|
||||
if not player_fns.peer_has_player(peer_id) then
|
||||
player_fns.spawn_player_for(peer_id, pos_data.x, pos_data.y)
|
||||
end
|
||||
|
@ -35,4 +33,4 @@ function module.on_world_update()
|
|||
end
|
||||
end
|
||||
|
||||
return module
|
||||
return module
|
|
@ -1,6 +1,4 @@
|
|||
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 tether_length = ctx.proxy_opt.tether_length
|
||||
|
@ -35,4 +33,4 @@ function module.on_world_update_client()
|
|||
end
|
||||
end
|
||||
|
||||
return module
|
||||
return module
|
|
@ -1,19 +1,8 @@
|
|||
local world_ffi = require("noitapatcher.nsew.world_ffi")
|
||||
local world = require("noitapatcher.nsew.world")
|
||||
local rect = require("noitapatcher.nsew.rect")
|
||||
local ffi = require("ffi")
|
||||
|
||||
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 module = {}
|
||||
|
||||
local KEY_WORLD_FRAME = 0
|
||||
local KEY_WORLD_END = 1
|
||||
|
||||
local CHUNK_SIZE = 128
|
||||
|
||||
function module.on_world_update()
|
||||
if GameGetFrameNum() % 30 ~= 6 then
|
||||
return
|
||||
|
@ -26,4 +15,4 @@ function module.on_world_update()
|
|||
end
|
||||
end
|
||||
|
||||
return module
|
||||
return module
|
|
@ -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 module = {}
|
||||
|
@ -56,7 +54,7 @@ end)
|
|||
-- Called after entity was loaded.
|
||||
-- Might be useless in some cases, as entity was already despawned/serialized due to CameraBoundComponent.
|
||||
np.CrossCallAdd("ew_spawn_hook_post", function(ent_path, ent)
|
||||
|
||||
|
||||
end)
|
||||
|
||||
local entity_is_enemy_cache = {}
|
||||
|
@ -76,4 +74,4 @@ function module.entity_is_synced(ent_path)
|
|||
return res
|
||||
end
|
||||
|
||||
return module
|
||||
return module
|
|
@ -1,4 +1,3 @@
|
|||
local ctx = dofile_once("mods/quant.ew/files/core/ctx.lua")
|
||||
local net = dofile_once("mods/quant.ew/files/core/net.lua")
|
||||
|
||||
local rpc = net.new_rpc_namespace()
|
||||
|
@ -38,4 +37,4 @@ function rpc.apply_weather(weather_pattern)
|
|||
end
|
||||
end
|
||||
|
||||
return module
|
||||
return module
|
|
@ -49,7 +49,7 @@ function world_sync.on_world_update_host()
|
|||
local thread_impl = grid_world.mThreadImpl
|
||||
|
||||
local begin = thread_impl.updated_grid_worlds.begin
|
||||
local end_ = begin + thread_impl.chunk_update_count
|
||||
--local end_ = begin + thread_impl.chunk_update_count
|
||||
|
||||
local count = thread_impl.chunk_update_count
|
||||
-- GamePrint("w update "..count)
|
||||
|
@ -66,7 +66,7 @@ function world_sync.on_world_update_host()
|
|||
end_x = end_x + 1
|
||||
end_y = end_y + 2
|
||||
|
||||
-- if i < 9 then
|
||||
-- if i < 9 then
|
||||
-- GamePrint(start_x.." "..start_y.." "..end_x.." "..end_y)
|
||||
-- end
|
||||
local rectangle = rect.Rectangle(start_x, start_y, end_x, end_y)
|
||||
|
@ -84,9 +84,9 @@ function world_sync.on_world_update_host()
|
|||
end
|
||||
if #pending_send_wd == 0 then
|
||||
rect_optimiser:scan()
|
||||
|
||||
|
||||
for crect in rect.parts(rect_optimiser:iterate(), 256) do
|
||||
local area = nil
|
||||
local area
|
||||
-- Make sure we don't send chunks that aren't loaded yet, like holy mountains before host got there.
|
||||
if DoesWorldExistAt(crect.left, crect.top, crect.right, crect.bottom) then
|
||||
area = world.encode_area(chunk_map, crect.left, crect.top, crect.right, crect.bottom, encoded_area)
|
||||
|
@ -111,7 +111,7 @@ local PixelRun_const_ptr = ffi.typeof("struct PixelRun const*")
|
|||
|
||||
function world_sync.handle_world_data(world_data)
|
||||
local grid_world = world_ffi.get_grid_world()
|
||||
for i, datum in ipairs(world_data) do
|
||||
for _, datum in ipairs(world_data) do
|
||||
-- GamePrint("Decoding world data "..i)
|
||||
local header = ffi.cast("struct EncodedAreaHeader const*", ffi.cast('char const*', datum))
|
||||
local runs = ffi.cast(PixelRun_const_ptr, ffi.cast("const char*", datum) + ffi.sizeof(world.EncodedAreaHeader))
|
||||
|
@ -125,4 +125,4 @@ function rpc.send_world_data(world_data)
|
|||
end
|
||||
end
|
||||
|
||||
return world_sync
|
||||
return world_sync
|
|
@ -5,11 +5,10 @@ local ffi = require("ffi")
|
|||
|
||||
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 rect_optimiser = rect.Optimiser_new()
|
||||
--local rect_optimiser = rect.Optimiser_new()
|
||||
local encoded_area = world.EncodedArea()
|
||||
|
||||
local world_sync = {}
|
||||
|
@ -39,7 +38,7 @@ function world_sync.on_world_update()
|
|||
|
||||
local grid_world = world_ffi.get_grid_world()
|
||||
local chunk_map = grid_world.vtable.get_chunk_map(grid_world)
|
||||
local thread_impl = grid_world.mThreadImpl
|
||||
--local thread_impl = grid_world.mThreadImpl
|
||||
|
||||
if GameGetFrameNum() % ctx.proxy_opt.world_sync_interval == 0 then
|
||||
local player_data = ctx.my_player
|
||||
|
@ -87,4 +86,4 @@ net.net_handling.proxy[0] = function(_, value)
|
|||
world_sync.handle_world_data(value)
|
||||
end
|
||||
|
||||
return world_sync
|
||||
return world_sync
|
|
@ -18,7 +18,6 @@ util = dofile_once("mods/quant.ew/files/core/util.lua")
|
|||
inventory_helper = dofile_once("mods/quant.ew/files/core/inventory_helper.lua")
|
||||
constants = dofile_once("mods/quant.ew/files/core/constants.lua")
|
||||
|
||||
local pretty = dofile_once("mods/quant.ew/files/lib/pretty_print.lua")
|
||||
local perk_fns = dofile_once("mods/quant.ew/files/core/perk_fns.lua")
|
||||
|
||||
local version = dofile_once("mods/quant.ew/files/version.lua") or "unknown (dev build)"
|
||||
|
@ -136,7 +135,7 @@ function OnPausedChanged(paused, is_wand_pickup)
|
|||
|
||||
if (players[1]) then
|
||||
np.RegisterPlayerEntityId(players[1])
|
||||
local inventory_gui = EntityGetFirstComponentIncludingDisabled(players[1], "InventoryGuiComponent")
|
||||
--local inventory_gui = EntityGetFirstComponentIncludingDisabled(players[1], "InventoryGuiComponent")
|
||||
local controls_component = EntityGetFirstComponentIncludingDisabled(players[1], "ControlsComponent")
|
||||
if (paused) then
|
||||
--EntitySetComponentIsEnabled(players[1], inventory_gui, false)
|
||||
|
|
|
@ -28,8 +28,8 @@ function mod_setting_change_callback( mod_id, gui, in_main_menu, setting, old_va
|
|||
end
|
||||
|
||||
local mod_id = "quant.ew" -- This should match the name of your mod's folder.
|
||||
mod_settings_version = 1 -- This is a magic global that can be used to migrate settings to new mod versions. call mod_settings_get_version() before mod_settings_update() to get the old value.
|
||||
mod_settings =
|
||||
mod_settings_version = 1 -- This is a magic global that can be used to migrate settings to new mod versions. call mod_settings_get_version() before mod_settings_update() to get the old value.
|
||||
mod_settings =
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ mod_settings =
|
|||
-- - when entering the game after a restart (init_scope will be MOD_SETTING_SCOPE_RESTART)
|
||||
-- - at the end of an update when mod settings have been changed via ModSettingsSetNextValue() and the game is unpaused (init_scope will be MOD_SETTINGS_SCOPE_RUNTIME)
|
||||
function ModSettingsUpdate( init_scope )
|
||||
local old_version = mod_settings_get_version( mod_id ) -- This can be used to migrate some settings between mod versions.
|
||||
--local old_version = mod_settings_get_version( mod_id ) -- This can be used to migrate some settings between mod versions.
|
||||
mod_settings_update( mod_id, mod_settings, init_scope )
|
||||
if ModIsEnabled(mod_id) then
|
||||
print("Running early init fn")
|
||||
|
@ -61,4 +61,4 @@ end
|
|||
-- This function is called to display the settings UI for this mod. Your mod's settings wont be visible in the mod settings menu if this function isn't defined correctly.
|
||||
function ModSettingsGui( gui, in_main_menu )
|
||||
mod_settings_gui( mod_id, mod_settings, gui, in_main_menu )
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue