1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-11-29 22:47:52 +02:00

Mtn v3 - more tweaks

This commit is contained in:
Gerkiz
2024-05-29 19:57:58 +02:00
parent 3cc738d22e
commit 98bbc7cabb
15 changed files with 318 additions and 103 deletions

View File

@@ -20,6 +20,8 @@ local nth_tick = Public.nth_tick
--RPG Frames
local main_frame_name = Public.main_frame_name
local spell_gui_frame_name = Public.spell_gui_frame_name
local cooldown_indicator_name = Public.cooldown_indicator_name
local round = math.round
local floor = math.floor
@@ -922,10 +924,6 @@ local function on_player_used_capsule(event)
return
end
if rpg_t.last_spawned >= game.tick then
return Public.cast_spell(player, true)
end
local mana = rpg_t.mana
local surface = player.surface
@@ -934,6 +932,13 @@ local function on_player_used_capsule(event)
return
end
if spell.enforce_cooldown then
if Public.is_cooldown_active_for_player(player) then
Public.cast_spell(player, true)
return
end
end
local position = event.position
if not position then
return
@@ -984,13 +989,6 @@ local function on_player_used_capsule(event)
force = 'player'
end
if spell.check_if_active then
if rpg_t.has_custom_spell_active then
Public.cast_spell(player, true)
return
end
end
local data = {
self = spell,
player = player,
@@ -1027,10 +1025,18 @@ local function on_player_used_capsule(event)
StatData.get_data(player):increase('spells')
if spell.enforce_cooldown then
Public.register_cooldown_for_player(player, spell)
if player.gui.screen[spell_gui_frame_name] then
local f = player.gui.screen[spell_gui_frame_name]
if f then
if f[cooldown_indicator_name] then
Public.register_cooldown_for_player_progressbar(player, spell)
end
end
else
Public.register_cooldown_for_player(player, spell)
end
end
rpg_t.last_spawned = game.tick + spell.cooldown
Public.update_mana(player)
local reward_xp = spell.mana_cost * 0.085