mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
undo chest change to prevent duping, make wands look nicer
This commit is contained in:
parent
5949035083
commit
a30cdfe2a2
2 changed files with 40 additions and 20 deletions
|
@ -43,7 +43,9 @@ function net_handling.proxy.proxy_opt(_, key, value)
|
|||
end
|
||||
|
||||
function net_handling.proxy.proxy_opt_num(_, key, value)
|
||||
if key ~= "friendly_fire_team" then
|
||||
print("Proxy opt [num]: "..key.." = "..value)
|
||||
end
|
||||
ctx.proxy_opt[key] = tonumber(value)
|
||||
end
|
||||
|
||||
|
|
|
@ -20,13 +20,15 @@ local dead_entities = {}
|
|||
|
||||
function rpc.open_chest(gid)
|
||||
local ent = item_sync.find_by_gid(gid)
|
||||
if ent ~= nil then
|
||||
local file
|
||||
for _, com in ipairs(EntityGetComponent(ent, "LuaComponent")) do
|
||||
local f = ComponentGetValue2(com, "script_item_picked_up")
|
||||
if f ~= nil then
|
||||
file = f
|
||||
break
|
||||
end
|
||||
local name = EntityGetFilename(ent)
|
||||
if name == "data/entities/items/pickup/utility_box.xml" then
|
||||
file = "data/scripts/items/utility_box.lua"
|
||||
elseif name == "data/entities/items/pickup/chest_random_super.xml" then
|
||||
file = "data/scripts/items/chest_random_super.lua"
|
||||
elseif name == "data/entities/items/pickup/chest_random.xml" then
|
||||
file = "data/scripts/items/chest_random.lua"
|
||||
end
|
||||
if file ~= nil then
|
||||
EntityAddComponent2(ent, "LuaComponent", {
|
||||
|
@ -36,6 +38,7 @@ function rpc.open_chest(gid)
|
|||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
util.add_cross_call("ew_chest_opened", function(chest_id)
|
||||
local gid = item_sync.get_global_item_id(chest_id)
|
||||
|
@ -218,6 +221,14 @@ function item_sync.make_item_global(item, instant, give_authority_to)
|
|||
})
|
||||
end
|
||||
|
||||
if give_authority_to ~= nil then
|
||||
local itemcom = EntityGetFirstComponentIncludingDisabled(item, "ItemComponent")
|
||||
if ComponentGetValue2(itemcom, "play_hover_animation") then
|
||||
ComponentSetValue2(itemcom, "play_hover_animation", false)
|
||||
ComponentSetValue2(itemcom, "play_spinning_animation", false)
|
||||
end
|
||||
end
|
||||
|
||||
ctx.item_prevent_localize[gid] = false
|
||||
rpc.item_globalize(item_data)
|
||||
end)
|
||||
|
@ -307,7 +318,7 @@ local function send_item_positions()
|
|||
local gid = item_sync.get_global_item_id(item)
|
||||
-- Only send info about items created by us.
|
||||
if is_my_item(gid) and is_item_on_ground(item) then
|
||||
local x, y = EntityGetTransform(item)
|
||||
local x, y, r = EntityGetTransform(item)
|
||||
local costcom = EntityGetFirstComponentIncludingDisabled(item, "ItemCostComponent")
|
||||
local cost = 0
|
||||
if costcom ~= nil then
|
||||
|
@ -319,7 +330,7 @@ local function send_item_positions()
|
|||
end
|
||||
local phys_info = util.get_phys_info(item, true)
|
||||
if phys_info ~= nil then
|
||||
position_data[gid] = {x, y, phys_info, cost}
|
||||
position_data[gid] = {x, y, r, phys_info, cost}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -484,6 +495,13 @@ function rpc.item_globalize(item_data)
|
|||
end
|
||||
end
|
||||
EntityAddComponent2(item, "LuaComponent", {_tags="ew_immortal", script_damage_about_to_be_received = "mods/quant.ew/files/resource/cbs/immortal.lua"})
|
||||
if not is_my_item(item_data.gid) then
|
||||
local itemcom = EntityGetFirstComponentIncludingDisabled(item, "ItemComponent")
|
||||
if ComponentGetValue2(itemcom, "play_hover_animation") then
|
||||
ComponentSetValue2(itemcom, "play_hover_animation", false)
|
||||
ComponentSetValue2(itemcom, "play_spinning_animation", false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
rpc.opts_reliable()
|
||||
|
@ -511,14 +529,14 @@ function rpc.update_positions(position_data)
|
|||
local LIMIT = 128 * 3
|
||||
local cx, cy = GameGetCameraPos()
|
||||
for gid, el in pairs(position_data) do
|
||||
local x, y = el[1], el[2]
|
||||
local phys_info = el[3]
|
||||
local price = el[4]
|
||||
local x, y, r = el[1], el[2], el[3]
|
||||
local phys_info = el[4]
|
||||
local price = el[5]
|
||||
if math.abs(x - cx) < LIMIT and math.abs(y - cy) < LIMIT then
|
||||
local item = item_sync.find_by_gid(gid)
|
||||
if item ~= nil then
|
||||
if not util.set_phys_info(item, phys_info) then
|
||||
EntitySetTransform(item, x, y)
|
||||
EntitySetTransform(item, x, y, r)
|
||||
end
|
||||
local costcom = EntityGetFirstComponentIncludingDisabled(item, "ItemCostComponent")
|
||||
if costcom ~= nil then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue