Skip to content

Commit 942d6a1

Browse files
committed
fix chest duping probably, fix some errors
1 parent 0e09558 commit 942d6a1

File tree

5 files changed

+84
-14
lines changed

5 files changed

+84
-14
lines changed

noita-proxy/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,9 @@ impl Default for DefaultSettings {
320320
health_lost_on_revive: 0,
321321
no_material_damage: false,
322322
global_hp_loss: false,
323-
perk_ban_list: "GLOBAL_GORE,GLASS_CANNON,REVENGE_RATS,PLAGUE_RATS,VOMIT_RATS,CORDYCEPS,MOLD".to_string(),
323+
perk_ban_list:
324+
"GLOBAL_GORE,GLASS_CANNON,REVENGE_RATS,PLAGUE_RATS,VOMIT_RATS,CORDYCEPS,MOLD"
325+
.to_string(),
324326
perma_death: false,
325327
physics_damage: true,
326328
share_gold: false,
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
dofile_once("data/scripts/lib/utilities.lua")
2+
3+
function death( damage_type_bit_field, damage_message, entity_thats_responsible, drop_items )
4+
local entity_id = GetUpdatedEntityID()
5+
local pos_x, pos_y = EntityGetTransform( entity_id )
6+
7+
SetRandomSeed( GameGetFrameNum(), pos_x + pos_y + entity_id )
8+
9+
local perk_flag = "PERK_PICKED_HOVER_BOOST"
10+
local pickup_count = tonumber( GlobalsGetValue( perk_flag .. "_PICKUP_COUNT", "0" ) ) + 1
11+
12+
local player_id = 0
13+
14+
local models = EntityGetComponent( entity_id, "VariableStorageComponent" )
15+
for i,v in ipairs( models or {}) do
16+
local name = ComponentGetValue2( v, "name" )
17+
if ( name == "angry_levitation" ) then
18+
player_id = ComponentGetValue2( v, "value_int" )
19+
end
20+
end
21+
22+
if ( player_id ~= nil ) and ( player_id ~= NULL_ENTITY ) then
23+
local comp = EntityGetFirstComponent( player_id, "CharacterDataComponent" )
24+
25+
if ( comp ~= nil ) then
26+
local flight = ComponentGetValue2( comp, "mFlyingTimeLeft" )
27+
local maxflight = ComponentGetValue2( comp, "fly_time_max" ) or 3.0
28+
29+
maxflight = 2 ^ pickup_count + ( 2 ^ ( pickup_count - 1 ) )
30+
31+
-- print( tostring(flight) .. ", " .. tostring(maxflight))
32+
flight = math.min( maxflight, flight + 1.2 )
33+
34+
ComponentSetValue2( comp, "mFlyingTimeLeft", flight )
35+
end
36+
end
37+
end
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
dofile_once("data/scripts/lib/utilities.lua")
2+
3+
function death( damage_type_bit_field, damage_message, entity_thats_responsible, drop_items )
4+
local entity_id = GetUpdatedEntityID()
5+
local pos_x, pos_y = EntityGetTransform( entity_id )
6+
7+
SetRandomSeed( GameGetFrameNum(), pos_x + pos_y + entity_id )
8+
9+
local player_id = 0
10+
local flag_name = "PERK_PICKED_MANA_FROM_KILLS"
11+
local pickup_count = tonumber( GlobalsGetValue( flag_name .. "_PICKUP_COUNT", "0" ) )
12+
13+
local models = EntityGetComponent( entity_id, "VariableStorageComponent" )
14+
for i,v in ipairs( models or {} ) do
15+
local name = ComponentGetValue2( v, "name" )
16+
if ( name == "mana_from_kills" ) then
17+
player_id = ComponentGetValue2( v, "value_int" )
18+
end
19+
end
20+
21+
if ( player_id ~= nil ) and ( player_id ~= NULL_ENTITY ) and ( pickup_count > 0 ) then
22+
for i=1,pickup_count do
23+
local eid = EntityLoad( "data/entities/misc/perks/mana_from_kills_effect.xml", pos_x, pos_y )
24+
EntityAddChild( player_id, eid )
25+
end
26+
end
27+
end

quant.ew/files/system/item_sync.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ local gid_last_frame_updated = {}
2424

2525
local wait_on_send = {}
2626

27+
local wait_for_gid = {}
28+
2729
function rpc.open_chest(gid)
2830
local ent = item_sync.find_by_gid(gid)
2931
if ent ~= nil then
@@ -37,6 +39,7 @@ function rpc.open_chest(gid)
3739
file = "data/scripts/items/chest_random.lua"
3840
end
3941
if file ~= nil then
42+
wait_for_gid[gid] = GameGetFrameNum() + 600
4043
EntityAddComponent2(ent, "LuaComponent", {
4144
script_source_file = file,
4245
execute_on_added = true,
@@ -206,8 +209,6 @@ function item_sync.host_localize_item(gid, peer_id)
206209
end
207210
end
208211

209-
local wait_for_gid = {}
210-
211212
local function make_global(item, give_authority_to)
212213
if not EntityGetIsAlive(item) then
213214
print("Thrown item vanished before we could send it")
@@ -599,8 +600,7 @@ function rpc.item_globalize(item_data)
599600
end
600601
local item = inventory_helper.deserialize_single_item(item_data)
601602
add_stuff_to_globalized_item(item, item_data.gid)
602-
local coms = EntityGetComponent(item, "VariableStorageComponent")
603-
for _, com in ipairs(coms) do
603+
for _, com in ipairs(EntityGetComponent(item, "VariableStorageComponent") or {}) do
604604
if ComponentGetValue2(com, "name") == "throw_time" then
605605
ComponentSetValue2(com, "value_int", GameGetFrameNum())
606606
end

quant.ew/files/system/player_tether/player_tether.lua

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,19 @@ local was_not_hm = false
184184
local was_notplayer = false
185185

186186
function rpc.give_new_length(new_range)
187-
tether_length = new_range
188-
tether_length_2 = new_range + 128
189-
tether_length_3 = math.max(tether_length_3 or 0, tether_length_2)
190-
local host_playerdata = player_fns.peer_get_player_data(ctx.host_id, true)
191-
if new_range == 0 then
192-
tether_enable(false, host_playerdata.entity)
193-
else
194-
tether_enable(true, host_playerdata.entity)
195-
set_tether_length(tether_length_3, host_playerdata.entity)
187+
if new_range ~= nil then
188+
tether_length = new_range
189+
tether_length_2 = new_range + 128
190+
tether_length_3 = math.max(tether_length_3 or 0, tether_length_2)
191+
local host_playerdata = player_fns.peer_get_player_data(ctx.host_id, true)
192+
if host_playerdata ~= nil and host_playerdata.entity ~= nil then
193+
if new_range == 0 then
194+
tether_enable(false, host_playerdata.entity)
195+
else
196+
tether_enable(true, host_playerdata.entity)
197+
set_tether_length(tether_length_3, host_playerdata.entity)
198+
end
199+
end
196200
end
197201
end
198202

0 commit comments

Comments
 (0)