mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-11 14:49:24 +02:00
misc fixes
This commit is contained in:
parent
44af53da8c
commit
f0560c1d27
@ -14,6 +14,15 @@ local ceil = math.ceil
|
||||
local zone_settings = WPT.zone_settings
|
||||
local worm_level_modifier = 0.19
|
||||
|
||||
local start_ground_tiles = {
|
||||
'sand-1',
|
||||
'dirt-1',
|
||||
'dirt-2',
|
||||
'sand-2',
|
||||
'dirt-3',
|
||||
'sand-3'
|
||||
}
|
||||
|
||||
local wagon_raffle = {
|
||||
'cargo-wagon',
|
||||
'cargo-wagon',
|
||||
@ -2624,7 +2633,7 @@ end
|
||||
local function border_chunk(p, data)
|
||||
local entities = data.entities
|
||||
local decoratives = data.decoratives
|
||||
-- local tiles = data.tiles
|
||||
local tiles = data.tiles
|
||||
|
||||
local pos = p
|
||||
|
||||
@ -2632,9 +2641,9 @@ local function border_chunk(p, data)
|
||||
entities[#entities + 1] = {name = trees[random(1, #trees)], position = pos}
|
||||
end
|
||||
|
||||
-- local noise = get_perlin('dungeons', pos, data.seed)
|
||||
-- local index = floor(noise * 32) % 4 + 1
|
||||
-- tiles[#tiles + 1] = {name = start_ground_tiles[index], position = pos}
|
||||
local noise = get_perlin('dungeons', pos, data.seed)
|
||||
local index = floor(noise * 32) % 4 + 1
|
||||
tiles[#tiles + 1] = {name = start_ground_tiles[index], position = pos}
|
||||
|
||||
local scrap_mineable_entities, scrap_mineable_entities_index = get_scrap_mineable_entities()
|
||||
|
||||
|
@ -157,7 +157,7 @@ local function create_entity_radius(surface, name, source, target)
|
||||
|
||||
local position = {source.x, source.y}
|
||||
|
||||
for i = 1, distance * 1.5, 1 do
|
||||
for _ = 1, distance * 1.5, 1 do
|
||||
if random(1, 2) ~= 1 then
|
||||
surface.create_entity(
|
||||
{
|
||||
@ -401,7 +401,7 @@ local function on_entity_died(event)
|
||||
end
|
||||
|
||||
--- Use this function to retrieve a key from the global table.
|
||||
---@param key <string>
|
||||
---@param key string
|
||||
function Public.get(key)
|
||||
if key then
|
||||
return this[key]
|
||||
@ -411,8 +411,8 @@ function Public.get(key)
|
||||
end
|
||||
|
||||
--- Using this function can set a new value to an exist key or create a new key with value
|
||||
---@param key <string>
|
||||
---@param value <string/boolean>
|
||||
---@param key string
|
||||
---@param value any
|
||||
function Public.set(key, value)
|
||||
if key and (value or value == false) then
|
||||
this[key] = value
|
||||
@ -442,8 +442,8 @@ function Public.reset_table()
|
||||
end
|
||||
|
||||
--- Use this function to add a new unit that has extra health
|
||||
---@param unit <LuaEntity>
|
||||
---@param health_multiplier <number>
|
||||
---@param unit userdata
|
||||
---@param health_multiplier number
|
||||
function Public.add_unit(unit, health_multiplier)
|
||||
if not health_multiplier then
|
||||
health_multiplier = this.biter_health_boost
|
||||
@ -460,9 +460,9 @@ function Public.add_unit(unit, health_multiplier)
|
||||
end
|
||||
|
||||
--- Use this function to add a new boss unit (with healthbar)
|
||||
---@param unit <LuaEntity>
|
||||
---@param health_multiplier <number>
|
||||
---@param health_bar_size <number>
|
||||
---@param unit userdata
|
||||
---@param health_multiplier number
|
||||
---@param health_bar_size number
|
||||
function Public.add_boss_unit(unit, health_multiplier, health_bar_size)
|
||||
if not health_multiplier then
|
||||
health_multiplier = this.biter_health_boost
|
||||
@ -483,7 +483,7 @@ end
|
||||
|
||||
--- This sets the active surface that we check and have the script active.
|
||||
--- This deletes the list of surfaces if we use multiple, so use it only before setting more of them.
|
||||
---@param string
|
||||
---@param str string
|
||||
function Public.set_active_surface(str)
|
||||
if str and type(str) == 'string' then
|
||||
this.active_surfaces = {}
|
||||
@ -493,7 +493,8 @@ function Public.set_active_surface(str)
|
||||
end
|
||||
|
||||
--- This sets if this surface is active, when we using multiple surfaces. The default active surface does not need to be added again
|
||||
---@param string, boolean
|
||||
---@param name string
|
||||
---@param value boolean
|
||||
function Public.set_surface_activity(name, value)
|
||||
if name and type(name) == 'string' and type(value) == 'boolean' then
|
||||
this.active_surfaces[name] = value
|
||||
|
@ -29,7 +29,7 @@ local function on_gui_click(event)
|
||||
if not event then
|
||||
return
|
||||
end
|
||||
local player = game.players[event.player_index]
|
||||
local player = game.get_player(event.player_index)
|
||||
if not (player and player.valid) then
|
||||
return
|
||||
end
|
||||
@ -369,6 +369,9 @@ local function regen_mana_player(players)
|
||||
local mana_per_tick = Public.get_mana_modifier(player)
|
||||
local rpg_extra = Public.get('rpg_extra')
|
||||
local rpg_t = Public.get_value_from_player(player.index)
|
||||
if not rpg_t then
|
||||
return
|
||||
end
|
||||
if mana_per_tick <= 0.1 then
|
||||
mana_per_tick = rpg_extra.mana_per_tick
|
||||
end
|
||||
@ -568,7 +571,7 @@ local function on_player_repaired_entity(event)
|
||||
return
|
||||
end
|
||||
|
||||
local player = game.players[event.player_index]
|
||||
local player = game.get_player(event.player_index)
|
||||
|
||||
if not player or not player.valid or not player.character then
|
||||
return
|
||||
@ -585,7 +588,7 @@ local function on_player_repaired_entity(event)
|
||||
end
|
||||
|
||||
local function on_player_rotated_entity(event)
|
||||
local player = game.players[event.player_index]
|
||||
local player = game.get_player(event.player_index)
|
||||
|
||||
if not player or not player.valid then
|
||||
return
|
||||
@ -603,7 +606,7 @@ local function on_player_rotated_entity(event)
|
||||
end
|
||||
|
||||
local function on_player_changed_position(event)
|
||||
local player = game.players[event.player_index]
|
||||
local player = game.get_player(event.player_index)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
@ -627,7 +630,7 @@ local building_and_mining_blacklist = {
|
||||
}
|
||||
|
||||
local function on_player_died(event)
|
||||
local player = game.players[event.player_index]
|
||||
local player = game.get_player(event.player_index)
|
||||
|
||||
if not player or not player.valid then
|
||||
return
|
||||
@ -637,7 +640,7 @@ local function on_player_died(event)
|
||||
end
|
||||
|
||||
local function on_pre_player_left_game(event)
|
||||
local player = game.players[event.player_index]
|
||||
local player = game.get_player(event.player_index)
|
||||
|
||||
if not player or not player.valid then
|
||||
return
|
||||
@ -657,7 +660,7 @@ local function on_pre_player_mined_item(event)
|
||||
if entity.force.index ~= 3 then
|
||||
return
|
||||
end
|
||||
local player = game.players[event.player_index]
|
||||
local player = game.get_player(event.player_index)
|
||||
|
||||
if not player or not player.valid then
|
||||
return
|
||||
@ -702,7 +705,7 @@ local function on_player_crafted_item(event)
|
||||
if not event.recipe.energy then
|
||||
return
|
||||
end
|
||||
local player = game.players[event.player_index]
|
||||
local player = game.get_player(event.player_index)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
@ -735,7 +738,7 @@ local function on_player_crafted_item(event)
|
||||
end
|
||||
|
||||
local function on_player_respawned(event)
|
||||
local player = game.players[event.player_index]
|
||||
local player = game.get_player(event.player_index)
|
||||
local rpg_t = Public.get_value_from_player(player.index)
|
||||
if not rpg_t then
|
||||
Public.rpg_reset_player(player)
|
||||
@ -748,7 +751,7 @@ local function on_player_respawned(event)
|
||||
end
|
||||
|
||||
local function on_player_joined_game(event)
|
||||
local player = game.players[event.player_index]
|
||||
local player = game.get_player(event.player_index)
|
||||
local rpg_t = Public.get_value_from_player(player.index)
|
||||
local rpg_extra = Public.get('rpg_extra')
|
||||
if not rpg_t then
|
||||
@ -851,7 +854,7 @@ local function on_player_used_capsule(event)
|
||||
local conjure_items = Public.all_spells
|
||||
local projectile_types = Public.get_projectiles
|
||||
|
||||
local player = game.players[event.player_index]
|
||||
local player = game.get_player(event.player_index)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
|
@ -239,10 +239,7 @@ commands.add_command(
|
||||
end
|
||||
if not this.creative_are_you_sure then
|
||||
this.creative_are_you_sure = true
|
||||
player.print(
|
||||
'[WARNING] This command will enable creative/cheat-mode for all connected players, run this command again if you really want to do this!',
|
||||
Color.yellow
|
||||
)
|
||||
player.print('[WARNING] This command will enable creative/cheat-mode for all connected players, run this command again if you really want to do this!', Color.yellow)
|
||||
return
|
||||
end
|
||||
if this.creative_enabled then
|
||||
|
Loading…
x
Reference in New Issue
Block a user