1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-10-30 23:47:41 +02:00

minor changes

This commit is contained in:
Gerkiz
2022-07-10 19:42:07 +02:00
parent b30f814d3a
commit f2baab5978
8 changed files with 14 additions and 62 deletions

View File

@@ -163,7 +163,7 @@ end
--- Gets value from player rpg_t table
---@param key string
---@param value string
---@param value string|nil
function Public.get_value_from_player(key, value)
if key and value then
if (this.rpg_t[key] and this.rpg_t[key][value]) then
@@ -182,8 +182,8 @@ end
--- Sets value to player rpg_t table
---@param key string
---@param value string
---@param setter string
---@param value string|boolean|number|nil
---@param setter string|boolean|number|nil
function Public.set_value_to_player(key, value, setter)
if key and value then
if (this.rpg_t[key] and this.rpg_t[key][value]) then

View File

@@ -536,7 +536,7 @@ local function increase_biter_damage()
end
local e = game.forces.enemy
local new = Difficulty.get().difficulty_vote_value * 0.04
local new = Difficulty.get('value') * 0.04
local melee = new
local bio = new - 0.02
local e_old_melee = e.get_ammo_damage_modifier('melee')

View File

@@ -231,7 +231,7 @@ end
---Message all players at a given location
---@param player LuaPlayer
---@param message string
---@param color string
---@param color string|nil
function Public.alert_all_players_location(player, message, color, duration)
local length = duration or 15
Public.alert_all_players_template(
@@ -264,7 +264,7 @@ end
---@param player LuaPlayer
---@param duration number
---@param message string
---@param color string
---@param color string|nil
function Public.alert_player(player, duration, message, color, sprite, volume)
Public.alert_player_template(
player,
@@ -321,7 +321,7 @@ end
---Message to all players
---@param duration number
---@param message string
---@param color string
---@param color string|nil
function Public.alert_all_players(duration, message, color, sprite, volume)
local players = game.connected_players
for i = 1, #players do

View File

@@ -975,7 +975,7 @@ end
--- Add entity type to the whitelist so it gets logged.
---@param key string
---@param value string
---@param value string|boolean
function Public.whitelist_types(key, value)
if key and value then
this.whitelist_types[key] = value
@@ -1027,7 +1027,7 @@ function Public.decon_surface_blacklist(value)
end
--- Defines what the threshold for amount of explosives in chest should be - logged or not.
---@param value string
---@param value number
function Public.explosive_threshold(value)
if value then
this.explosive_threshold = value
@@ -1037,7 +1037,7 @@ function Public.explosive_threshold(value)
end
--- Defines what the threshold for amount of times before the script should take action.
---@param value string
---@param value number
function Public.damage_entity_threshold(value)
if value then
this.damage_entity_threshold = value

View File

@@ -1,7 +1,3 @@
--luacheck: ignore
local branch_version = '1.1' -- define what game version we're using
local sub = string.sub
-- Non-applicable stages are commented out.
_STAGE = {
--settings = 1,
@@ -13,46 +9,3 @@ _STAGE = {
config_change = 7,
runtime = 8
}
function get_game_version()
local get_active_branch = sub(game.active_mods.base, 3, 4)
local is_branch_experimental = sub(branch_version, 3, 4)
if get_active_branch >= is_branch_experimental then
return true
else
return false
end
end
function is_loaded(module)
local res = _G.package.loaded[module]
if res then
return res
else
return false
end
end
function is_game_modded()
local i = 0
for k, _ in pairs(game.active_mods) do
i = i + 1
if i > 1 then
return true
end
end
return false
end
function is_mod_loaded(module)
if not module then
return false
end
local res = script.active_mods[module]
if res then
return true
else
return false
end
end

View File

@@ -128,7 +128,7 @@ Gui.on_click(
local top_panel = element.parent.parent
local data = Gui.get_data(top_panel)
if not data or not data.valid then
if not data then
return
end

View File

@@ -1,6 +1,5 @@
local Gui = require 'utils.gui'
local Global = require 'utils.global'
local Token = require 'utils.token'
local Color = require 'utils.color_presets'
local Model = require 'utils.debug.model'
@@ -92,7 +91,7 @@ Gui.on_click(
input_text_box.text = concat {'global.tokens.', token_id}
input_text_box.style.font_color = Color.black
local id = Token.get_global(token_id)
local id = Global.get_global(token_id)
local content = dump(id) or 'Could not load data.'
if content:find('function_handlers') then
content = '{}' -- desync handler

View File

@@ -950,14 +950,14 @@ local function on_player_left_game()
end
--- If the different roles should be shown in the player_list.
---@param value string
---@param value boolean
function Public.show_roles_in_list(value)
this.show_roles_in_list = value or false
return this.show_roles_in_list
end
--- Notifies player_list if RPG is enabled or not.
---@param value string
---@param value boolean
function Public.rpg_enabled(value)
this.rpg_enabled = value or false
return this.rpg_enabled