mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-01-30 04:30:58 +02:00
Minor changes based on feedback
This commit is contained in:
parent
37c7b29221
commit
b240b278f6
@ -212,7 +212,7 @@ end
|
|||||||
---@return number the experience being removed
|
---@return number the experience being removed
|
||||||
---@see ForceControl.remove_experience
|
---@see ForceControl.remove_experience
|
||||||
function ForceControl.remove_experience_percentage(lua_force_or_name, percentage, min_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)
|
local force = get_valid_force(lua_force_or_name)
|
||||||
if not force then
|
if not force then
|
||||||
return
|
return
|
||||||
@ -274,7 +274,7 @@ end
|
|||||||
---@return number the experience being added
|
---@return number the experience being added
|
||||||
---@see ForceControl.add_experience
|
---@see ForceControl.add_experience
|
||||||
function ForceControl.add_experience_percentage(lua_force_or_name, percentage, min_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)
|
local force = get_valid_force(lua_force_or_name)
|
||||||
if not force then
|
if not force then
|
||||||
return
|
return
|
||||||
|
@ -147,9 +147,9 @@ local function on_player_mined_entity(event)
|
|||||||
local level = ForceControl.get_force_data(force).current_level
|
local level = ForceControl.get_force_data(force).current_level
|
||||||
local exp
|
local exp
|
||||||
if entity.name == 'sand-rock-big' then
|
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
|
elseif entity.name == 'rock-huge' then
|
||||||
exp = rock_huge_xp + (floor(level / 5))
|
exp = rock_huge_xp + floor(level / 5)
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -200,7 +200,7 @@ end
|
|||||||
---@param event LuaEvent
|
---@param event LuaEvent
|
||||||
local function on_rocket_launched(event)
|
local function on_rocket_launched(event)
|
||||||
local force = event.rocket.force
|
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)
|
local text = string_format('Rocket launched! +%d XP', exp)
|
||||||
for _, p in pairs(game.connected_players) do
|
for _, p in pairs(game.connected_players) do
|
||||||
local player_index = p.index
|
local player_index = p.index
|
||||||
@ -222,9 +222,9 @@ local function on_entity_died (event)
|
|||||||
if force and force.name == 'player' then
|
if force and force.name == 'player' then
|
||||||
local level = ForceControl.get_force_data(force).current_level
|
local level = ForceControl.get_force_data(force).current_level
|
||||||
if entity.name == 'sand-rock-big' then
|
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
|
elseif entity.name == 'rock-huge' then
|
||||||
exp = floor((rock_huge_xp + (floor(level / 5))) / 2)
|
exp = floor((rock_huge_xp + (level / 5)) / 2)
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user