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,
|
||||
}
|
||||
|
||||
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()
|
||||
lazyload()
|
||||
local perks = {}
|
||||
|
@ -33,6 +41,19 @@ function perk_fns.get_my_perks()
|
|||
return perks
|
||||
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)
|
||||
lazyload()
|
||||
|
||||
|
@ -78,6 +99,12 @@ local function give_one_perk(entity_who_picked, perk_info, count)
|
|||
EntityAddChild( entity_who_picked, particle_id )
|
||||
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
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
|
|
|
@ -49,6 +49,10 @@ np.CrossCallAdd("ew_perk_ban_list", function()
|
|||
return ctx.proxy_opt.perk_ban_list
|
||||
end)
|
||||
|
||||
np.CrossCallAdd("ew_randomize_perks", function()
|
||||
return ctx.proxy_opt.randomize_perks
|
||||
end)
|
||||
|
||||
rpc.opts_everywhere()
|
||||
function rpc.sync_perk_amount(items, genome)
|
||||
GlobalsSetValue("TEMPLE_SHOP_ITEM_COUNT", tostring(items))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue