mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2024-12-30 23:17:53 +02:00
minor fixes
removed unused function in poll fixed rpg exp gui not updating fixed rpg boss biters not giving xp fixed spam_protection activated in events it shouldn't
This commit is contained in:
parent
5676148eb0
commit
fba31809c2
@ -157,7 +157,6 @@ local function send_poll_result_to_discord(poll)
|
||||
end
|
||||
|
||||
local function redraw_poll_viewer_content(data)
|
||||
local trusted = session.get_trusted_table()
|
||||
local poll_viewer_content = data.poll_viewer_content
|
||||
local remaining_time_label = data.remaining_time_label
|
||||
local poll_index = data.poll_index
|
||||
|
@ -285,8 +285,12 @@ local function protect_entities(event)
|
||||
return
|
||||
end
|
||||
|
||||
if entity.type == 'simple-entity' and dmg >= 300 then
|
||||
entity.health = entity.health + dmg
|
||||
local check_heavy_damage = WPT.get('check_heavy_damage')
|
||||
|
||||
if check_heavy_damage then
|
||||
if entity.type == 'simple-entity' and dmg >= 500 then
|
||||
entity.health = entity.health + dmg
|
||||
end
|
||||
end
|
||||
|
||||
if entity.force.index ~= 1 then
|
||||
|
@ -347,8 +347,8 @@ local function property_boost(data)
|
||||
}
|
||||
rpg[player.index].xp_since_last_floaty_text = 0
|
||||
rpg[player.index].last_floaty_text = game.tick + visuals_delay
|
||||
if player.gui.left[rpg_main_frame] then
|
||||
local f = player.gui.left[rpg_main_frame]
|
||||
if player.gui.screen[rpg_main_frame] then
|
||||
local f = player.gui.screen[rpg_main_frame]
|
||||
local d = Gui.get_data(f)
|
||||
if d.exp_gui and d.exp_gui.valid then
|
||||
d.exp_gui.caption = floor(rpg[player.index].xp)
|
||||
|
@ -201,6 +201,7 @@ function Public.reset_table()
|
||||
highest = 10
|
||||
}
|
||||
this.market_announce = game.tick + 1200
|
||||
this.check_heavy_damage = true
|
||||
|
||||
--!reset player tables
|
||||
for _, player in pairs(this.players) do
|
||||
|
@ -648,6 +648,14 @@ function Public.gain_xp(player, amount, added_to_pool, text)
|
||||
return
|
||||
end
|
||||
|
||||
local f = player.gui.screen[main_frame_name]
|
||||
if f and f.valid then
|
||||
local d = Gui.get_data(f)
|
||||
if d.exp_gui and d.exp_gui.valid then
|
||||
d.exp_gui.caption = math.floor(rpg_t[player.index].xp)
|
||||
end
|
||||
end
|
||||
|
||||
if rpg_t[player.index].xp >= experience_levels[rpg_t[player.index].level + 1] then
|
||||
level_up(player)
|
||||
end
|
||||
|
@ -237,7 +237,7 @@ local function on_entity_died(event)
|
||||
local amount = rpg_extra.rpg_xp_yield[event.entity.name]
|
||||
amount = amount / 5
|
||||
if biter_health_boost then
|
||||
local health_pool = biter_health_boost_units and biter_health_boost_units[event.entity.unit_number]
|
||||
local health_pool = biter_health_boost_units[event.entity.unit_number]
|
||||
if health_pool then
|
||||
amount = amount * (1 / health_pool[2])
|
||||
end
|
||||
@ -274,7 +274,7 @@ local function on_entity_died(event)
|
||||
--Grant modified XP for health boosted units
|
||||
if biter_health_boost then
|
||||
if enemy_types[event.entity.type] then
|
||||
local health_pool = biter_health_boost_units and biter_health_boost_units[event.entity.unit_number]
|
||||
local health_pool = biter_health_boost_units[event.entity.unit_number]
|
||||
if health_pool then
|
||||
for _, player in pairs(players) do
|
||||
if rpg_extra.rpg_xp_yield[event.entity.name] then
|
||||
@ -629,7 +629,7 @@ local function on_entity_damaged(event)
|
||||
|
||||
--Handle the custom health pool of the biter health booster, if it is used in the map.
|
||||
if biter_health_boost then
|
||||
local health_pool = biter_health_boost_units and biter_health_boost_units[entity.unit_number]
|
||||
local health_pool = biter_health_boost_units[entity.unit_number]
|
||||
if health_pool then
|
||||
health_pool[1] = health_pool[1] + event.final_damage_amount
|
||||
health_pool[1] = health_pool[1] - damage
|
||||
|
@ -156,9 +156,11 @@ local function handler_factory(event_id)
|
||||
return
|
||||
end
|
||||
|
||||
local is_spamming = SpamProtection.is_spamming(player, nil, 'UtilsGUI Handler')
|
||||
if is_spamming and player.name ~= 'Gerkiz' then
|
||||
return
|
||||
if not event.text then
|
||||
local is_spamming = SpamProtection.is_spamming(player, nil, 'UtilsGUI Handler')
|
||||
if is_spamming then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
event.player = player
|
||||
|
@ -4,7 +4,7 @@ local Public = {}
|
||||
|
||||
local this = {
|
||||
prevent_spam = {}, -- the default table where all player indexes will be stored
|
||||
default_tick = 15, -- this defines the default tick to check weather or not a user is spamming a button.
|
||||
default_tick = 10, -- this defines the default tick to check weather or not a user is spamming a button.
|
||||
_DEBUG = false
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user