mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
give global perks to everyone
This commit is contained in:
parent
3ea359f89c
commit
b23618c8c3
3 changed files with 32 additions and 1 deletions
|
@ -20,6 +20,14 @@ local perks_to_ignore = {
|
||||||
TELEKINESIS = true,
|
TELEKINESIS = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local global_perks = {
|
||||||
|
NO_MORE_SHUFFLE = true,
|
||||||
|
UNLIMITED_SPELLS = true,
|
||||||
|
TRICK_BLOOD_MONEY = true,
|
||||||
|
GOLD_IS_FOREVER = true,
|
||||||
|
PEACE_WITH_GODS = true
|
||||||
|
}
|
||||||
|
|
||||||
function perk_fns.get_my_perks()
|
function perk_fns.get_my_perks()
|
||||||
lazyload()
|
lazyload()
|
||||||
local perks = {}
|
local perks = {}
|
||||||
|
@ -33,6 +41,19 @@ function perk_fns.get_my_perks()
|
||||||
return perks
|
return perks
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function spawn_perk(perk_info, auto_pickup_entity)
|
||||||
|
local x, y = EntityGetTransform(ctx.my_player.entity)
|
||||||
|
local perk_entity = perk_spawn(x, y - 8, perk_info.id)
|
||||||
|
if auto_pickup_entity then
|
||||||
|
perk_pickup(perk_entity, auto_pickup_entity, nil, true, false)
|
||||||
|
end
|
||||||
|
local icon = EntityCreateNew()
|
||||||
|
EntityAddTag(icon, "perk_entity")
|
||||||
|
EntityAddComponent2(icon, "UIIconComponent", {icon_sprite_file = perk_info.ui_icon, name = perk_info.ui_name, description = perk_info.ui_description})
|
||||||
|
EntityAddChild(ctx.my_player.entity, icon)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local function give_one_perk(entity_who_picked, perk_info, count)
|
local function give_one_perk(entity_who_picked, perk_info, count)
|
||||||
lazyload()
|
lazyload()
|
||||||
|
|
||||||
|
@ -78,6 +99,12 @@ local function give_one_perk(entity_who_picked, perk_info, count)
|
||||||
EntityAddChild( entity_who_picked, particle_id )
|
EntityAddChild( entity_who_picked, particle_id )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if global_perks[perk_info.id]
|
||||||
|
and perk_fns.get_my_perks()[perk_info.id] == nil then
|
||||||
|
spawn_perk(perk_info, true)
|
||||||
|
global_perks[perk_info.id] = false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function perk_fns.update_perks(perk_data, player_data)
|
function perk_fns.update_perks(perk_data, player_data)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
if not ctx.proxy_opts.randomize_perks then
|
if CrossCall ~= nil and not CrossCall("ew_randomize_perks") then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,10 @@ np.CrossCallAdd("ew_perk_ban_list", function()
|
||||||
return ctx.proxy_opt.perk_ban_list
|
return ctx.proxy_opt.perk_ban_list
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
np.CrossCallAdd("ew_randomize_perks", function()
|
||||||
|
return ctx.proxy_opt.randomize_perks
|
||||||
|
end)
|
||||||
|
|
||||||
rpc.opts_everywhere()
|
rpc.opts_everywhere()
|
||||||
function rpc.sync_perk_amount(items, genome)
|
function rpc.sync_perk_amount(items, genome)
|
||||||
GlobalsSetValue("TEMPLE_SHOP_ITEM_COUNT", tostring(items))
|
GlobalsSetValue("TEMPLE_SHOP_ITEM_COUNT", tostring(items))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue