Skip to content

Commit

Permalink
Update api calls (#1474)
Browse files Browse the repository at this point in the history
* Replace minable with minable_flag property

* Update luackeckrc
  • Loading branch information
RedRafe authored Dec 22, 2024
1 parent ce3bb9c commit 182ed8e
Show file tree
Hide file tree
Showing 20 changed files with 36 additions and 34 deletions.
2 changes: 2 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ stds.factorio_control = {
'active_mods',
'feature_flags',
'get_event_handler',
'get_event_id',
'get_event_order',
'level',
'mod_name',
Expand Down Expand Up @@ -1110,6 +1111,7 @@ stds.factorio_defines = {
'on_built_entity',
'on_cancelled_deconstruction',
'on_cancelled_upgrade',
'on_cargo_pod_finished_ascending',
'on_character_corpse_expired',
'on_chart_tag_added',
'on_chart_tag_modified',
Expand Down
4 changes: 2 additions & 2 deletions features/lazy_bastard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Command.add('lazy-bastard-bootstrap', {

for i = 1, #templates do
local entity = create_entity(templates[i])
entity.minable = false
entity.minable_flag = false
entity.destructible = false
end

Expand All @@ -139,7 +139,7 @@ Command.add('lazy-bastard-bootstrap', {
power_source.electric_buffer_size = 30000
power_source.power_production = 30000
power_source.destructible = false
power_source.minable = false
power_source.minable_flag = false

-- in 7 minutes, remove the power source
Task.set_timeout(420, clean_energy_interface, {entity = power_source})
Expand Down
8 changes: 4 additions & 4 deletions features/redmew_qol.lua
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ local function preserve_bot(event)

if logistic_network == nil or not logistic_network.valid then
-- prevents an orphan bot from being unremovable
entity.minable = true
entity.minable_flag = true
return
end

Expand All @@ -147,17 +147,17 @@ local function preserve_bot(event)

-- checks if construction-robot is part of a mobile logistic network
if owner.name ~= 'character' then
entity.minable = true
entity.minable_flag = true
return
end

-- checks if construction-robot is owned by the player that has selected it
if owner.player.name == player.name then
entity.minable = true
entity.minable_flag = true
return
end

entity.minable = false
entity.minable_flag = false
end

-- Event registers
Expand Down
2 changes: 1 addition & 1 deletion map_gen/maps/april_fools/modules/permanent_factory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ local function on_built_entity(event)
return
else
entity.destructible = true
entity.minable = false
entity.minable_flag = false
end
end

Expand Down
2 changes: 1 addition & 1 deletion map_gen/maps/april_fools/scenario/restart_command.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ return function(config)
local ore_products = {}
for _, ore_prototype in pairs(resource_prototypes) do
local mineable_properties = ore_prototype.mineable_properties
if mineable_properties.minable and ore_prototype.resource_category == 'basic-solid' then
if mineable_properties.minable_flag and ore_prototype.resource_category == 'basic-solid' then
for _, product in pairs(mineable_properties.products) do
ore_products[product.name] = true
end
Expand Down
6 changes: 3 additions & 3 deletions map_gen/maps/crash_site/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ artillery_cooldown_callback =
return
end

entity.minable = true
entity.minable_flag = true
end
)

Expand Down Expand Up @@ -386,7 +386,7 @@ local function do_bot_spawn(entity_name, entity, event)
end
for i = 1, repeat_cycle do
if (cause.name == 'artillery-turret') then
cause.minable = false
cause.minable_flag = false
set_timeout_in_ticks(300, artillery_cooldown_callback, cause)
spawn_entity.name = 'defender'
create_entity(spawn_entity)
Expand All @@ -397,7 +397,7 @@ local function do_bot_spawn(entity_name, entity, event)
create_entity(spawn_entity)

elseif (cause.name == 'artillery-wagon') then
cause.minable = false
cause.minable_flag = false
set_timeout_in_ticks(300, artillery_cooldown_callback, cause)
spawn_entity.name = 'defender'
create_entity(spawn_entity)
Expand Down
6 changes: 3 additions & 3 deletions map_gen/maps/crash_site/outpost_builder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,7 @@ Public.magic_item_crafting_callback =
local outpost_id = data.outpost_id
local callback_data = data.callback_data

entity.minable = false
entity.minable_flag = false
entity.destructible = false
entity.operable = false

Expand Down Expand Up @@ -1551,7 +1551,7 @@ Public.magic_item_crafting_callback_weighted =
local outpost_id = data.outpost_id
local callback_data = data.callback_data

entity.minable = false
entity.minable_flag = false
entity.destructible = false
entity.operable = false

Expand Down Expand Up @@ -1658,7 +1658,7 @@ Public.scenario_chest_callback = Token.register(function(chest)
end

chest.destructible = false
chest.minable = false
chest.minable_flag = false
end)

local function turret_died(event)
Expand Down
2 changes: 1 addition & 1 deletion map_gen/maps/danger_ores/modules/expanse.lua
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ return function(config)
if is_container_position_valid(position) then
local e = surface.create_entity({ name = 'requester-chest', position = position, force = 'neutral' })
e.destructible = false
e.minable = false
e.minable_flag = false
table.insert(chests, e)
end
end
Expand Down
2 changes: 1 addition & 1 deletion map_gen/maps/danger_ores/modules/restart_command.lua
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ return function(config)
local ore_products = {}
for _, ore_prototype in pairs(resource_prototypes) do
local mineable_properties = ore_prototype.mineable_properties
if mineable_properties.minable and ore_prototype.resource_category == 'basic-solid' then
if mineable_properties.minable_flag and ore_prototype.resource_category == 'basic-solid' then
for _, product in pairs(mineable_properties.products) do
ore_products[product.name] = true
end
Expand Down
2 changes: 1 addition & 1 deletion map_gen/maps/dimensions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ storage.chest_selected = false
local function linkchests()
if game.player and game.player.admin and game.player.selected and (game.player.selected.type == 'logistic-container' or game.player.selected.type == 'container') then
game.player.selected.destructible = false
game.player.selected.minable = false
game.player.selected.minable_flag = false
if storage.chest_selected then
storage.magic_chests[#storage.magic_chests].target = game.player.selected
game.print('Link established.')
Expand Down
2 changes: 1 addition & 1 deletion map_gen/maps/frontier/modules/market.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function Market.spawn_exchange_market(position)
create_build_effect_smoke = true,
move_stuck_players = true,
}
market.minable = false
market.minable_flag = false
market.destructible = false

local offers_count = 10 + math_random(10)
Expand Down
2 changes: 1 addition & 1 deletion map_gen/maps/frontier/modules/restart.lua
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ function Restart.print_endgame_statistics()
local ore_products = {}
for _, ore_prototype in pairs(resource_prototypes) do
local mineable_properties = ore_prototype.mineable_properties
if mineable_properties.minable and ore_prototype.resource_category == 'basic-solid' then
if mineable_properties.minable_flag and ore_prototype.resource_category == 'basic-solid' then
for _, product in pairs(mineable_properties.products) do
ore_products[product.name] = true
end
Expand Down
2 changes: 1 addition & 1 deletion map_gen/maps/frontier/modules/rocket_silo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function RocketSilo.move_silo(position)

if new_silo and new_silo.valid then
new_silo.destructible = false
new_silo.minable = false
new_silo.minable_flag = false
new_silo.active = true
new_silo.get_output_inventory().clear()
this.rocket_silo = new_silo
Expand Down
2 changes: 1 addition & 1 deletion map_gen/maps/frontier/modules/spawn_shop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function SpawnShop.on_game_started()
move_stuck_players = true,
raise_built = false,
}
shop.minable = false
shop.minable_flag = false
Public.get().spawn_shop = shop
Task.set_timeout(1, SpawnShop.add_render_token)
SpawnShop.refresh_all_prices(false)
Expand Down
2 changes: 1 addition & 1 deletion map_gen/maps/mobius_strip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ local function effect(_, _, world, tile)

local e = world.surface.create_entity({name = 'rocket-silo', position = {0, 0}, force = 'player'})
e.destructible = false
e.minable = false
e.minable_flag = false
end

--[[
Expand Down
6 changes: 3 additions & 3 deletions map_gen/maps/quadrants/item_to_chest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ local function create_chest(player, position, radius, bounding_box)

if pos ~= nil then
local chest = surface.create_entity {name = 'steel-chest', position = pos, force = player.force}
chest.minable = false
chest.minable_flag = false
return chest
end

Expand Down Expand Up @@ -61,7 +61,7 @@ local function on_gui_closed(event)
if entity == nil or not entity.valid then
return
end
if entity.name == 'steel-chest' and entity.minable == false and not entity.has_items_inside() then
if entity.name == 'steel-chest' and entity.minable_flag == false and not entity.has_items_inside() then
entity.destroy()
end
end
Expand All @@ -71,7 +71,7 @@ local function ctrl_empty(event)
if entity == nil or not entity.valid then
return
end
if entity.name == 'steel-chest' and not entity.minable then
if entity.name == 'steel-chest' and not entity.minable_flag then
event.entity = entity
on_gui_closed(event)
end
Expand Down
2 changes: 1 addition & 1 deletion map_gen/maps/quadrants/scenario.lua
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ local function rail_create(data)
direction = direction
}
if rail and rail.valid then
rail.minable = false
rail.minable_flag = false
rail.destructible = false
end
end
Expand Down
2 changes: 1 addition & 1 deletion map_gen/maps/space_race/map_gen/uranium_island.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ if Game_mode_config.king_of_the_hill then

local function lock_entity(e)
e.destructible = false
e.minable = false
e.minable_flag = false
e.operable = false
e.rotatable = false
end
Expand Down
12 changes: 6 additions & 6 deletions map_gen/maps/space_race/scenario.lua
Original file line number Diff line number Diff line change
Expand Up @@ -248,27 +248,27 @@ local function generate_structures()

local silo
silo = surface.create_entity {name = 'rocket-silo', position = {x = 388.5, y = -0.5}, force = force_USSR}
silo.minable = false
silo.minable_flag = false

silo = surface.create_entity {name = 'rocket-silo', position = {x = -388.5, y = 0.5}, force = force_USA}
silo.minable = false
silo.minable_flag = false

local wall
wall = surface.create_entity {name = 'stone-wall', position = {x = 384.5, y = 18.5}, always_place = true, force = 'neutral'}
wall.destructible = false
wall.minable = false
wall.minable_flag = false

wall = surface.create_entity {name = 'stone-wall', position = {x = 384.5, y = -17.5}, always_place = true, force = 'neutral'}
wall.destructible = false
wall.minable = false
wall.minable_flag = false

wall = surface.create_entity {name = 'stone-wall', position = {x = -384.5, y = 18.5}, always_place = true, force = 'neutral'}
wall.destructible = false
wall.minable = false
wall.minable_flag = false

wall = surface.create_entity {name = 'stone-wall', position = {x = -384.5, y = -17.5}, always_place = true, force = 'neutral'}
wall.destructible = false
wall.minable = false
wall.minable_flag = false

local gun_turret
gun_turret = surface.create_entity {name = 'gun-turret', position = {x = 383, y = 0}, force = force_USSR}
Expand Down
2 changes: 1 addition & 1 deletion map_gen/maps/tetris/scenario.lua
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ local function collect_full_row_resources(tetri)
local x = position.x + active_qchunks[1].x * 16 - 9
local y = tetri_y + active_qchunks[1].y * 16 - 9
local chest = InfinityChest.create_chest(tetri.surface, {x, y}, storage)
chest.minable = false
chest.minable_flag = false
chest.destructible = false

primitives.points = primitives.points + points * 100
Expand Down

0 comments on commit 182ed8e

Please sign in to comment.