mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 15:13:16 +00:00
Fix physics projectile lob strength
This commit is contained in:
parent
e5e7bbb04d
commit
5013d223fb
3 changed files with 31 additions and 17 deletions
|
@ -2,6 +2,8 @@ local inventory_helper = dofile_once("mods/quant.ew/files/src/inventory_helper.l
|
|||
local ctx = dofile_once("mods/quant.ew/files/src/ctx.lua")
|
||||
local util = dofile_once("mods/quant.ew/files/src/util.lua")
|
||||
|
||||
dofile_once("data/scripts/lib/coroutines.lua")
|
||||
|
||||
local item_sync = {}
|
||||
|
||||
function item_sync.ensure_notify_component(ent)
|
||||
|
@ -65,6 +67,8 @@ function item_sync.host_localize_item(gid, peer_id)
|
|||
end
|
||||
|
||||
function item_sync.make_item_global(item)
|
||||
async(function()
|
||||
wait(1) -- Wait 1 frame so that game sets proper velocity.
|
||||
local g_id = EntityGetFirstComponentIncludingDisabled(item, "VariableStorageComponent", "ew_global_item_id")
|
||||
local id = ComponentGetValue2(g_id, "value_int")
|
||||
if g_id == nil then
|
||||
|
@ -74,10 +78,16 @@ function item_sync.make_item_global(item)
|
|||
value_int = id,
|
||||
})
|
||||
end
|
||||
local vel = EntityGetFirstComponentIncludingDisabled(item, "VelocityComponent")
|
||||
if vel then
|
||||
local vx, vy = ComponentGetValue2(vel, "mVelocity")
|
||||
GamePrint("v "..vx.." "..vy)
|
||||
end
|
||||
local item_data = inventory_helper.serialize_single_item(item)
|
||||
item_data.g_id = id
|
||||
ctx.item_prevent_localize[id] = false
|
||||
ctx.lib.net.send_make_global(item_data)
|
||||
end)
|
||||
end
|
||||
|
||||
local function get_global_ent(key)
|
||||
|
@ -124,7 +134,10 @@ function item_sync.on_world_update_client()
|
|||
end
|
||||
local thrown_item = get_global_ent("ew_thrown")
|
||||
if thrown_item ~= nil and not EntityHasTag(thrown_item, "ew_client_item") then
|
||||
async(function ()
|
||||
wait(1) -- Wait 1 frame so that game sets proper velocity.
|
||||
ctx.lib.net.send_item_upload(inventory_helper.serialize_single_item(thrown_item))
|
||||
end)
|
||||
EntityKill(thrown_item)
|
||||
end
|
||||
|
||||
|
|
|
@ -124,10 +124,7 @@ function net_handling.mod.fire(peer_id, fire_data)
|
|||
|
||||
util.set_ent_firing_blocked(entity, false)
|
||||
|
||||
-- Add player_unit tag to fix physics projectile lob strength
|
||||
EntityAddTag(entity, "player_unit")
|
||||
np.UseItem(entity, mActiveItem, true, true, true, x, y, target_x, target_y)
|
||||
EntityRemoveTag(entity, "player_unit")
|
||||
|
||||
util.set_ent_firing_blocked(entity, true)
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ local perk_fns = dofile_once("mods/quant.ew/files/src/perk_fns.lua")
|
|||
local version = dofile_once("mods/quant.ew/files/version.lua") or "unknown (dev build)"
|
||||
print("Noita EW version: "..version)
|
||||
|
||||
dofile_once("data/scripts/lib/coroutines.lua")
|
||||
|
||||
ModLuaFileAppend("data/scripts/gun/gun.lua", "mods/quant.ew/files/append/gun.lua")
|
||||
ModLuaFileAppend("data/scripts/gun/gun_actions.lua", "mods/quant.ew/files/append/action_fix.lua")
|
||||
|
||||
|
@ -224,6 +226,8 @@ local function on_world_pre_update_inner()
|
|||
end
|
||||
ctx.hook.on_world_update()
|
||||
end
|
||||
|
||||
wake_up_waiting_threads(1)
|
||||
end
|
||||
|
||||
function OnWorldPreUpdate() -- This is called every time the game is about to start updating the world
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue