dont use bad spells

This commit is contained in:
bgkillas 2024-08-26 18:10:50 -04:00
parent 297281c609
commit 05487b881b
2 changed files with 20 additions and 8 deletions

View file

@ -51,6 +51,11 @@ local good_mats = {"magic_liquid_movement_faster",
local water_mats = {"water", "swamp", "water_swamp", "water_salt", "blood"}
local ignore_spell = {"ANTIHEAL", "BLACK_HOLE", "BLACK_HOLE_DEATH_TRIGGER", "POWERDIGGER", "DIGGER", "PIPE_BOMB", "PIPE_BOMB_DEATH_TRIGGER", "GRENADE_LARGE", "CRUMBLING_EARTH", "HEAL_BULLET", "FISH",
"TELEPORT_PROJECTILE_CLOSER", "TELEPORT_PROJECTILE_STATIC", "SWAPPER_PROJECTILE", "TELEPORT_PROJECTILE", "TELEPORT_PROJECTILE_SHORT", "WHITE_HOLE", "CESSATION", "ADD_TRIGGER",
"ADD_TIMER", "ADD_DEATH_TRIGGER", "DIVIDE_2", "DIVIDE_3", "DIVIDE_4", "DIVIDE_10", "GAMMA", "MU", "ALPHA", "OMEGA", "PHI", "SIGMA", "TAU", "SUMMON_PORTAL", "DUPLICATE",
"IF_PROJECTILE", "IF_HP", "IF_ENEMY", "IF_HALF", "IF_ELSE", "IF_END", "ALL_SPELLS"}
local function get_potions_of_type(type)
local potions = {}
local children = EntityGetAllChildren(ctx.my_player.entity)
@ -145,15 +150,24 @@ local function find_new_wand()
for _, sprite in pairs(sprites) do
local image = ComponentGetValue2(sprite, "image_file")
if image == "data/ui_gfx/inventory/item_bg_projectile.png"
or image == "data/ui_gfx/inventory/item_bg_material.png"
or image == "data/ui_gfx/inventory/item_bg_static_projectile.png"
--or image == "data/ui_gfx/inventory/item_bg_material.png"
--or image == "data/ui_gfx/inventory/item_bg_static_projectile.png"
or image == "data/ui_gfx/inventory/item_bg_other.png" then
is_proj = true
break
end
end
local spell = EntityGetFirstComponentIncludingDisabled(child, "ItemActionComponent")
local spell_name = ComponentGetValue2(spell, "action_id")
local dont_use = false
for _, name in ipairs(ignore_spell) do
if name == spell_name then
dont_use = true
break
end
end
local item = EntityGetFirstComponentIncludingDisabled(child, "ItemComponent")
if ComponentGetValue2(item, "uses_remaining") ~= 0 and is_proj then
if ComponentGetValue2(item, "uses_remaining") ~= 0 and is_proj and not dont_use then
is_any_not_empty = true
break
end

View file

@ -81,7 +81,7 @@ local function set_camera_pos()
local i = 0
for peer_id, potential_target in pairs(ctx.players) do
i = i + 1
if i == camera_player or (camera_player == -1 and peer_id == ctx.my_id) then
if i == camera_player then
cam_target = potential_target.entity
camera_player = i
re_cam = false
@ -104,9 +104,6 @@ end
local function update_i()
local i = 0
if camera_player_id == -1 then
camera_player_id = ctx.my_id
end
for peer_id, _ in pairs(ctx.players) do
i = i + 1
if peer_id == camera_player_id then
@ -115,7 +112,8 @@ local function update_i()
return
end
end
camera_player = -1
camera_player = get_me()
camera_player_id = ctx.my_id
end
local function number_of_players()