1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-18 03:21:47 +02:00

Minor changes based on feedback

This commit is contained in:
SimonFlapse 2018-11-25 12:53:05 +01:00
parent 37c7b29221
commit b240b278f6
2 changed files with 7 additions and 7 deletions

View File

@ -212,7 +212,7 @@ end
---@return number the experience being removed
---@see ForceControl.remove_experience
function ForceControl.remove_experience_percentage(lua_force_or_name, percentage, min_experience)
local min_experience = min_experience ~= nil and min_experience or 0
min_experience = min_experience ~= nil and min_experience or 0
local force = get_valid_force(lua_force_or_name)
if not force then
return
@ -274,7 +274,7 @@ end
---@return number the experience being added
---@see ForceControl.add_experience
function ForceControl.add_experience_percentage(lua_force_or_name, percentage, min_experience)
local min_experience = min_experience ~= nil and min_experience or 0
min_experience = min_experience ~= nil and min_experience or 0
local force = get_valid_force(lua_force_or_name)
if not force then
return

View File

@ -147,9 +147,9 @@ local function on_player_mined_entity(event)
local level = ForceControl.get_force_data(force).current_level
local exp
if entity.name == 'sand-rock-big' then
exp = sand_rock_xp + (floor(level / 5))
exp = sand_rock_xp + floor(level / 5)
elseif entity.name == 'rock-huge' then
exp = rock_huge_xp + (floor(level / 5))
exp = rock_huge_xp + floor(level / 5)
else
return
end
@ -200,7 +200,7 @@ end
---@param event LuaEvent
local function on_rocket_launched(event)
local force = event.rocket.force
local exp = ForceControl.add_experience_percentage(force, config.XP['rocket_launch'], 5000)
local exp = ForceControl.add_experience_percentage(force, config.XP['rocket_launch'])
local text = string_format('Rocket launched! +%d XP', exp)
for _, p in pairs(game.connected_players) do
local player_index = p.index
@ -222,9 +222,9 @@ local function on_entity_died (event)
if force and force.name == 'player' then
local level = ForceControl.get_force_data(force).current_level
if entity.name == 'sand-rock-big' then
exp = floor((sand_rock_xp + (floor(level / 5))) / 2)
exp = floor((sand_rock_xp + (level / 5)) / 2)
elseif entity.name == 'rock-huge' then
exp = floor((rock_huge_xp + (floor(level / 5))) / 2)
exp = floor((rock_huge_xp + (level / 5)) / 2)
else
return
end