mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-07-26 18:36:23 +09:00
@@ -16,8 +16,6 @@ return {
|
||||
"modules.data.quickbar",
|
||||
"modules.data.alt-view",
|
||||
"modules.data.tag",
|
||||
-- 'modules.data.bonus',
|
||||
"modules.data.personal-logistic",
|
||||
"modules.data.language",
|
||||
--"modules.data.toolbar",
|
||||
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
|
||||
return {
|
||||
--[[
|
||||
TODO
|
||||
force bonus
|
||||
quick health regeneration
|
||||
|
||||
Base point is equal to the amount of standard value in each parameter.
|
||||
|
||||
CMMS CRS CCS CISB CHB CRDB PBR
|
||||
@@ -28,7 +24,6 @@ return {
|
||||
scale = 1,
|
||||
cost = 10,
|
||||
max_value = 4,
|
||||
initial_value = 2,
|
||||
value_step = 0.5,
|
||||
is_percentage = true,
|
||||
},
|
||||
@@ -37,7 +32,6 @@ return {
|
||||
scale = 1,
|
||||
cost = 60,
|
||||
max_value = 2,
|
||||
initial_value = 1,
|
||||
value_step = 0.25,
|
||||
is_percentage = true,
|
||||
},
|
||||
@@ -46,7 +40,6 @@ return {
|
||||
scale = 1,
|
||||
cost = 4,
|
||||
max_value = 12,
|
||||
initial_value = 6,
|
||||
value_step = 1,
|
||||
is_percentage = true,
|
||||
},
|
||||
@@ -55,7 +48,6 @@ return {
|
||||
scale = 10,
|
||||
cost = 2,
|
||||
max_value = 100,
|
||||
initial_value = 50,
|
||||
value_step = 10,
|
||||
},
|
||||
{
|
||||
@@ -63,7 +55,6 @@ return {
|
||||
scale = 50,
|
||||
cost = 4,
|
||||
max_value = 300,
|
||||
initial_value = 150,
|
||||
value_step = 50,
|
||||
},
|
||||
{
|
||||
@@ -71,7 +62,6 @@ return {
|
||||
scale = 1,
|
||||
cost = 1,
|
||||
max_value = 16,
|
||||
initial_value = 8,
|
||||
value_step = 2,
|
||||
combined_bonus = {
|
||||
"character_resource_reach_distance_bonus",
|
||||
@@ -83,101 +73,12 @@ return {
|
||||
scale = 4,
|
||||
cost = 40,
|
||||
max_value = 8,
|
||||
initial_value = 4,
|
||||
value_step = 1,
|
||||
is_special = true,
|
||||
},
|
||||
--[[
|
||||
['character_item_pickup_distance_bonus'] = {
|
||||
initial_value = 0,
|
||||
max_value = 20,
|
||||
value_step = 1,
|
||||
scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false
|
||||
},
|
||||
['character_loot_pickup_distance_bonus'] = {
|
||||
initial_value = 0,
|
||||
max_value = 20,
|
||||
value_step = 1,
|
||||
scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false
|
||||
},
|
||||
['character_item_drop_distance_bonus'] = {
|
||||
initial_value = 0,
|
||||
max_value = 20,
|
||||
value_step = 1,
|
||||
scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false
|
||||
}
|
||||
]]
|
||||
},
|
||||
force_bonus = {
|
||||
--[[
|
||||
['character_mining_speed_modifier'] = {
|
||||
initial_value = 0,
|
||||
max_value = 6,
|
||||
value_step = 0.5,
|
||||
scale = 1,
|
||||
cost = 10,
|
||||
is_percentage = true
|
||||
},
|
||||
['character_running_speed_modifier'] = {
|
||||
initial_value = 0,
|
||||
max_value = 3,
|
||||
value_step = 0.25,
|
||||
scale = 1,
|
||||
cost = 40,
|
||||
is_percentage = true
|
||||
},
|
||||
['character_crafting_speed_modifier'] = {
|
||||
initial_value = 0,
|
||||
max_value = 16,
|
||||
value_step = 1,
|
||||
scale = 1,
|
||||
cost = 4,
|
||||
is_percentage = true
|
||||
},
|
||||
['character_inventory_slots_bonus'] = {
|
||||
initial_value = 0,
|
||||
max_value = 200,
|
||||
value_step = 10,
|
||||
scale = 100,
|
||||
cost = 2,
|
||||
is_percentage = false
|
||||
},
|
||||
['character_health_bonus'] = {
|
||||
initial_value = 0,
|
||||
max_value = 400,
|
||||
value_step = 50,
|
||||
cost = 4,
|
||||
is_percentage = false
|
||||
},
|
||||
['character_reach_distance_bonus'] = {
|
||||
initial_value = 0,
|
||||
max_value = 24,
|
||||
value_step = 2,
|
||||
scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false,
|
||||
combined_bonus = {
|
||||
'character_resource_reach_distance_bonus',
|
||||
'character_build_distance_bonus'
|
||||
}
|
||||
},
|
||||
['worker_robots_speed_modifier'] = {
|
||||
initial_value = 0,
|
||||
max_value = 0,
|
||||
value_step = 0,
|
||||
scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false
|
||||
},
|
||||
]]
|
||||
["worker_robots_battery_modifier"] = {
|
||||
initial_value = 1,
|
||||
max_value = 1,
|
||||
value_step = 1,
|
||||
scale = 1,
|
||||
@@ -185,7 +86,6 @@ return {
|
||||
is_percentage = false,
|
||||
},
|
||||
["worker_robots_storage_bonus"] = {
|
||||
initial_value = 1,
|
||||
max_value = 1,
|
||||
value_step = 1,
|
||||
scale = 1,
|
||||
@@ -193,114 +93,13 @@ return {
|
||||
is_percentage = false,
|
||||
},
|
||||
["following_robots_lifetime_modifier"] = {
|
||||
initial_value = 1,
|
||||
max_value = 1,
|
||||
value_step = 1,
|
||||
scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false,
|
||||
},
|
||||
--[[
|
||||
['character_item_pickup_distance_bonus'] = {
|
||||
initial_value = 0,
|
||||
max_value = 20,
|
||||
value_step = 1,
|
||||
scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false
|
||||
},
|
||||
['character_loot_pickup_distance_bonus'] = {
|
||||
initial_value = 0,
|
||||
max_value = 20,
|
||||
value_step = 1,
|
||||
scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false
|
||||
},
|
||||
['character_item_drop_distance_bonus'] = {
|
||||
initial_value = 0,
|
||||
max_value = 20,
|
||||
value_step = 1,
|
||||
scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false
|
||||
},
|
||||
['character_trash_slot_count'] = {
|
||||
initial_value = 0,
|
||||
max_value = 0,
|
||||
value_step = 0,
|
||||
scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false
|
||||
},
|
||||
['mining_drill_productivity_bonus'] = {
|
||||
initial_value = 0,
|
||||
max_value = 0,
|
||||
value_step = 0,
|
||||
scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false
|
||||
},
|
||||
['train_braking_force_bonus'] = {
|
||||
initial_value = 0,
|
||||
max_value = 0,
|
||||
value_step = 0,
|
||||
scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false
|
||||
},
|
||||
['laboratory_speed_modifier'] = {
|
||||
initial_value = 0,
|
||||
max_value = 0,
|
||||
value_step = 0,
|
||||
scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false
|
||||
},
|
||||
['laboratory_productivity_bonus'] = {
|
||||
initial_value = 0,
|
||||
max_value = 0,
|
||||
value_step = 0,
|
||||
scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false
|
||||
},
|
||||
['inserter_stack_size_bonus'] = {
|
||||
initial_value = 0,
|
||||
max_value = 0,
|
||||
value_step = 0,
|
||||
scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false
|
||||
},
|
||||
['stack_inserter_capacity_bonus'] = {
|
||||
initial_value = 0,
|
||||
max_value = 0,
|
||||
value_step = 0,
|
||||
scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false
|
||||
},
|
||||
['artillery_range_modifier'] = {
|
||||
initial_value = 0,
|
||||
max_value = 0,
|
||||
value_step = 0,
|
||||
scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false
|
||||
}
|
||||
]]
|
||||
},
|
||||
surface_bonus = {
|
||||
--[[
|
||||
['solar_power_multiplier'] = {
|
||||
initial_value = 1,
|
||||
max_value = 1000,
|
||||
value_step = 1,
|
||||
scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false
|
||||
}
|
||||
]]
|
||||
},
|
||||
}
|
||||
|
||||
@@ -261,7 +261,6 @@ local default = Roles.new_role("Guest", "")
|
||||
"gui/research",
|
||||
"gui/autofill",
|
||||
"gui/module",
|
||||
"gui/landfill",
|
||||
"gui/production",
|
||||
-- "command/tag",
|
||||
-- "command/tag-clear",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,15 +5,13 @@ return {
|
||||
repeat_lifetime = 3600 * 20, --- @setting repeat_lifetime The length of time, in ticks, that protected removals will be remembered for
|
||||
refresh_rate = 3600 * 5, --- @setting refresh_rate How often the age of protected removals are checked against repeat_lifetime
|
||||
always_protected_names = { --- @setting always_protected_names Names of entities which are always protected
|
||||
|
||||
},
|
||||
always_protected_types = { --- @setting always_protected_types Types of entities which are always protected
|
||||
"boiler", "generator", "offshore-pump", "power-switch", "reactor", "rocket-silo",
|
||||
"boiler", "generator", "offshore-pump", "reactor", "heat-exchanger", "heat-pipe", "fusion-reactor", "fusion-generator", "power-switch", "rocket-silo",
|
||||
},
|
||||
always_trigger_repeat_names = { --- @setting always_trigger_repeat_names Names of entities which always trigger repeated removal protection
|
||||
|
||||
},
|
||||
always_trigger_repeat_types = { --- @setting always_trigger_repeat_types Types of entities which always trigger repeated removal protection
|
||||
"reactor", "rocket-silo",
|
||||
"reactor", "fusion-reactor", "rocket-silo",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -514,9 +514,6 @@ function vlayer.get_statistics()
|
||||
energy_sustained = vdp * gsm,
|
||||
energy_capacity = vlayer_data.properties.capacity * mega,
|
||||
energy_storage = vlayer_data.storage.energy,
|
||||
day_time = math.floor(vlayer_data.surface.daytime * vlayer_data.surface.ticks_per_day),
|
||||
day_length = vlayer_data.surface.ticks_per_day,
|
||||
tick = game.tick,
|
||||
}
|
||||
end
|
||||
|
||||
@@ -540,9 +537,6 @@ function vlayer.get_circuits()
|
||||
energy_sustained = "signal-S",
|
||||
energy_capacity = "signal-C",
|
||||
energy_storage = "signal-E",
|
||||
day_time = "signal-D",
|
||||
day_length = "signal-L",
|
||||
tick = "signal-T",
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
--[[-- Commands Module - Bonus
|
||||
- Adds a command that allows players to have increased stats
|
||||
@data Bonus
|
||||
]]
|
||||
|
||||
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local config = require("modules.exp_legacy.config.bonus") --- @dep config.bonuses
|
||||
local Commands = require("modules/exp_commands")
|
||||
|
||||
-- Stores the bonus for the player
|
||||
local PlayerData = require("modules.exp_legacy.expcore.player_data") --- @dep expcore.player_data
|
||||
local PlayerBonus = PlayerData.Settings:combine("Bonus")
|
||||
PlayerBonus:set_default(0)
|
||||
PlayerBonus:set_metadata{
|
||||
permission = "command/bonus",
|
||||
stringify = function(value)
|
||||
if not value or value == 0 then
|
||||
return "None set"
|
||||
end
|
||||
|
||||
return value
|
||||
end,
|
||||
}
|
||||
|
||||
--- Apply a bonus to a player
|
||||
local function apply_bonus(player, stage)
|
||||
if not player.character then
|
||||
return
|
||||
end
|
||||
|
||||
for k, v in pairs(config.player_bonus) do
|
||||
player[k] = v.value * stage / 10
|
||||
|
||||
if v.combined_bonus then
|
||||
for i = 1, #v.combined_bonus, 1 do
|
||||
player[v.combined_bonus[i]] = v.value * stage / 10
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- When store is updated apply new bonus to the player
|
||||
PlayerBonus:on_update(function(player_name, player_bonus)
|
||||
apply_bonus(game.players[player_name], player_bonus or 0)
|
||||
end)
|
||||
|
||||
--- Changes the amount of bonus you receive
|
||||
Commands.new("bonus", { "bonus.description" })
|
||||
:optional("amount", { "bonus.arg-amount" }, Commands.types.integer_range(0, 10))
|
||||
:register(function(player, amount)
|
||||
--- @cast amount number?
|
||||
if amount then
|
||||
PlayerBonus:set(player, amount)
|
||||
return Commands.status.success{ "bonus.set", amount }
|
||||
else
|
||||
return Commands.status.success{ "bonus.get", PlayerBonus:get(player) }
|
||||
end
|
||||
end)
|
||||
|
||||
--- When a player respawns re-apply bonus
|
||||
Event.add(defines.events.on_player_respawned, function(event)
|
||||
local player = game.players[event.player_index]
|
||||
apply_bonus(player, PlayerBonus:get(player))
|
||||
end)
|
||||
|
||||
--- Remove bonus if a player no longer has access to the command
|
||||
local function role_update(event)
|
||||
local player = game.players[event.player_index]
|
||||
if not Roles.player_allowed(player, "command/bonus") then
|
||||
apply_bonus(player, 0)
|
||||
end
|
||||
end
|
||||
|
||||
--- When a player dies allow them to have instant respawn
|
||||
Event.add(defines.events.on_player_died, function(event)
|
||||
local player = game.players[event.player_index]
|
||||
|
||||
if Roles.player_has_flag(player, "instant-respawn") then
|
||||
player.ticks_to_respawn = 120
|
||||
end
|
||||
end)
|
||||
|
||||
Event.add(defines.events.on_player_created, function(event)
|
||||
if event.player_index ~= 1 then
|
||||
return
|
||||
end
|
||||
|
||||
for k, v in pairs(config.force_bonus) do
|
||||
game.players[event.player_index].force[k] = v.value
|
||||
end
|
||||
|
||||
for k, v in pairs(config.surface_bonus) do
|
||||
game.players[event.player_index].surface[k] = v.value
|
||||
end
|
||||
end)
|
||||
|
||||
Event.add(Roles.events.on_role_assigned, role_update)
|
||||
Event.add(Roles.events.on_role_unassigned, role_update)
|
||||
@@ -1,89 +0,0 @@
|
||||
local Commands = require("modules/exp_commands")
|
||||
local config = require("modules.exp_legacy.config.personal_logistic") --- @dep config.personal-logistic
|
||||
|
||||
---@param target LuaEntity | LuaPlayer
|
||||
---@param amount number
|
||||
local function pl(target, amount)
|
||||
local c
|
||||
local s
|
||||
|
||||
--- @cast target any Remove cast once implemented
|
||||
error("Needs updating to use 2.0 logistics")
|
||||
|
||||
if target.object_name == "LuaPlayer" then
|
||||
c = target.clear_personal_logistic_slot
|
||||
s = target.set_personal_logistic_slot
|
||||
else
|
||||
c = target.clear_vehicle_logistic_slot
|
||||
s = target.set_vehicle_logistic_slot
|
||||
end
|
||||
|
||||
for _, v in pairs(config.request) do
|
||||
c(config.start + v.key)
|
||||
end
|
||||
|
||||
if (amount < 0) then
|
||||
return
|
||||
end
|
||||
|
||||
local stats = target.force.get_item_production_statistics(target.surface)
|
||||
|
||||
for k, v in pairs(config.request) do
|
||||
local v_min = math.ceil(v.min * amount)
|
||||
local v_max = math.ceil(v.max * amount)
|
||||
|
||||
if v.stack ~= nil and v.stack ~= 1 and v.type ~= "weapon" then
|
||||
v_min = math.floor(v_min / v.stack) * v.stack
|
||||
v_max = math.ceil(v_max / v.stack) * v.stack
|
||||
end
|
||||
|
||||
if v.upgrade_of == nil then
|
||||
if v.type ~= nil then
|
||||
if stats.get_input_count(k) < config.production_required[v.type] then
|
||||
if v_min > 0 then
|
||||
if v_min == v_max then
|
||||
v_min = math.floor((v_max * 0.5) / v.stack) * v.stack
|
||||
end
|
||||
else
|
||||
v_min = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
s(config.start + v.key, { name = k, min = v_min, max = v_max })
|
||||
else
|
||||
if v.type ~= nil then
|
||||
if stats.get_input_count(k) >= config.production_required[v.type] then
|
||||
s(config.start + v.key, { name = k, min = v_min, max = v_max })
|
||||
local vuo = v.upgrade_of
|
||||
|
||||
while (vuo ~= nil) do
|
||||
s(config.start + config.request[vuo].key, { name = vuo, min = 0, max = 0 })
|
||||
vuo = config.request[vuo].upgrade_of
|
||||
end
|
||||
else
|
||||
s(config.start + v.key, { name = k, min = 0, max = v_max })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Commands.new("personal-logistic", "Set Personal Logistic (-1 to cancel all) (Select spidertron to edit spidertron)")
|
||||
:argument("amount", "", Commands.types.integer_range(-1, 10))
|
||||
:add_aliases{ "pl" }
|
||||
:add_flags{ "disabled" } -- Remove once implemented above
|
||||
:register(function(player, amount)
|
||||
--- @cast amount number
|
||||
if player.force.technologies["logistic-robotics"].researched then
|
||||
if player.selected ~= nil then
|
||||
if player.selected.name == "spidertron" then
|
||||
pl(player.selected, amount / 10)
|
||||
end
|
||||
else
|
||||
pl(player, amount / 10)
|
||||
end
|
||||
else
|
||||
return Commands.status.error("Personal Logistic not researched")
|
||||
end
|
||||
end)
|
||||
@@ -70,7 +70,6 @@ add(require("modules/exp_scenario/control/station_auto_name"))
|
||||
--- Guis
|
||||
add(require("modules/exp_scenario/gui/autofill"))
|
||||
add(require("modules/exp_scenario/gui/elements"))
|
||||
add(require("modules/exp_scenario/gui/landfill_blueprint"))
|
||||
add(require("modules/exp_scenario/gui/module_inserter"))
|
||||
add(require("modules/exp_scenario/gui/player_bonus"))
|
||||
add(require("modules/exp_scenario/gui/player_stats"))
|
||||
|
||||
@@ -11,7 +11,7 @@ local config = require("modules/exp_legacy/config/bonus")
|
||||
local function apply_force_bonus(event)
|
||||
local force = event.force
|
||||
for k, v in pairs(config.force_bonus) do
|
||||
force[k] = v.initial_value
|
||||
force[k] = math.floor(v.max_value / 2)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,7 +19,7 @@ end
|
||||
local function apply_surface_bonus(event)
|
||||
local surface = assert(game.get_surface(event.surface_index))
|
||||
for k, v in pairs(config.surface_bonus) do
|
||||
surface[k] = v.initial_value
|
||||
surface[k] = math.floor(v.max_value / 2)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
--[[-- Gui - Landfill Blueprint
|
||||
Adds a button to the toolbar which adds landfill to the held blueprint
|
||||
]]
|
||||
|
||||
local Gui = require("modules/exp_gui")
|
||||
local Roles = require("modules/exp_legacy/expcore/roles")
|
||||
|
||||
--- @param box BoundingBox
|
||||
local function rotate_bounding_box(box)
|
||||
box.left_top.x, box.left_top.y, box.right_bottom.x, box.right_bottom.y
|
||||
= -box.right_bottom.y, box.left_top.x, -box.left_top.y, box.right_bottom.x
|
||||
end
|
||||
|
||||
local function curve_flip_lr(oc)
|
||||
local nc = table.deep_copy(oc)
|
||||
|
||||
for r = 1, 8 do
|
||||
for c = 1, 8 do
|
||||
nc[r][c] = oc[r][9 - c]
|
||||
end
|
||||
end
|
||||
|
||||
return nc
|
||||
end
|
||||
|
||||
local function curve_flip_d(oc)
|
||||
local nc = table.deep_copy(oc)
|
||||
|
||||
for r = 1, 8 do
|
||||
for c = 1, 8 do
|
||||
nc[r][c] = oc[c][r]
|
||||
end
|
||||
end
|
||||
|
||||
return nc
|
||||
end
|
||||
|
||||
local curve_masks = {} do
|
||||
local curves = { {
|
||||
{ 0, 0, 0, 0, 0, 1, 0, 0 },
|
||||
{ 0, 0, 0, 0, 1, 1, 1, 0 },
|
||||
{ 0, 0, 0, 1, 1, 1, 1, 0 },
|
||||
{ 0, 0, 0, 1, 1, 1, 0, 0 },
|
||||
{ 0, 0, 1, 1, 1, 0, 0, 0 },
|
||||
{ 0, 0, 1, 1, 1, 0, 0, 0 },
|
||||
{ 0, 0, 1, 1, 0, 0, 0, 0 },
|
||||
{ 0, 0, 1, 1, 0, 0, 0, 0 },
|
||||
} }
|
||||
|
||||
curves[6] = curve_flip_d(curves[1])
|
||||
curves[3] = curve_flip_lr(curves[6])
|
||||
curves[4] = curve_flip_d(curves[3])
|
||||
curves[5] = curve_flip_lr(curves[4])
|
||||
curves[2] = curve_flip_d(curves[5])
|
||||
curves[7] = curve_flip_lr(curves[2])
|
||||
curves[8] = curve_flip_d(curves[7])
|
||||
|
||||
for i, map in ipairs(curves) do
|
||||
local index = 0
|
||||
local mask = {}
|
||||
curve_masks[i] = mask
|
||||
|
||||
for row = 1, 8 do
|
||||
for col = 1, 8 do
|
||||
if map[row][col] == 1 then
|
||||
index = index + 1
|
||||
mask[index] = {
|
||||
x = col - 5,
|
||||
y = row - 5,
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local rolling_stocks = {}
|
||||
for name, _ in pairs(prototypes.get_entity_filtered{ { filter = "rolling-stock" } }) do
|
||||
rolling_stocks[name] = true
|
||||
end
|
||||
|
||||
--- @param blueprint LuaItemStack
|
||||
--- @return table
|
||||
local function landfill_gui_add_landfill(blueprint)
|
||||
local entities = assert(blueprint.get_blueprint_entities())
|
||||
local tile_index = 0
|
||||
local new_tiles = {}
|
||||
|
||||
for _, entity in pairs(entities) do
|
||||
if rolling_stocks[entity.name] or entity.name == "offshore-pump" then
|
||||
goto continue
|
||||
end
|
||||
|
||||
if entity.name == "curved-rail" then
|
||||
-- Curved rail
|
||||
local curve_mask = curve_masks[entity.direction or 8]
|
||||
for _, offset in ipairs(curve_mask) do
|
||||
tile_index = tile_index + 1
|
||||
new_tiles[tile_index] = {
|
||||
name = "landfill",
|
||||
position = { entity.position.x + offset.x, entity.position.y + offset.y },
|
||||
}
|
||||
end
|
||||
else
|
||||
-- Any other entity
|
||||
local proto = prototypes.entity[entity.name]
|
||||
if proto.collision_mask["ground-tile"] ~= nil then
|
||||
goto continue
|
||||
end
|
||||
|
||||
-- Rotate the collision box to be north facing
|
||||
local box = proto.collision_box or proto.selection_box
|
||||
if entity.direction then
|
||||
if entity.direction ~= defines.direction.north then
|
||||
rotate_bounding_box(box)
|
||||
if entity.direction ~= defines.direction.east then
|
||||
rotate_bounding_box(box)
|
||||
if entity.direction ~= defines.direction.south then
|
||||
rotate_bounding_box(box)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Add the landfill
|
||||
for y = math.floor(entity.position.y + box.left_top.y), math.floor(entity.position.y + box.right_bottom.y), 1 do
|
||||
for x = math.floor(entity.position.x + box.left_top.x), math.floor(entity.position.x + box.right_bottom.x), 1 do
|
||||
tile_index = tile_index + 1
|
||||
new_tiles[tile_index] = {
|
||||
name = "landfill",
|
||||
position = { x, y },
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
::continue::
|
||||
end
|
||||
|
||||
local old_tiles = blueprint.get_blueprint_tiles()
|
||||
|
||||
if old_tiles then
|
||||
for _, old_tile in pairs(old_tiles) do
|
||||
tile_index = tile_index + 1
|
||||
new_tiles[tile_index] = {
|
||||
name = "landfill",
|
||||
position = old_tile.position,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
return { tiles = new_tiles }
|
||||
end
|
||||
|
||||
--- Add the toolbar button
|
||||
Gui.toolbar.create_button{
|
||||
name = "trigger_landfill_blueprint",
|
||||
sprite = "item/landfill",
|
||||
tooltip = { "exp-gui_landfill-blueprint.tooltip-main" },
|
||||
visible = function(player, element)
|
||||
return Roles.player_allowed(player, "gui/landfill")
|
||||
end
|
||||
}:on_click(function(def, player, element)
|
||||
local stack = player.cursor_stack
|
||||
if stack and stack.valid_for_read and stack.type == "blueprint" and stack.is_blueprint_setup() then
|
||||
local modified = landfill_gui_add_landfill(stack)
|
||||
if modified and next(modified.tiles) then
|
||||
stack.set_blueprint_tiles(modified.tiles)
|
||||
end
|
||||
else
|
||||
player.print{ "exp-gui_landfill-blueprint.error-no-blueprint" }
|
||||
end
|
||||
end)
|
||||
|
||||
return {}
|
||||
@@ -16,7 +16,6 @@ local Elements = {}
|
||||
--- @field cost number
|
||||
--- @field scale number
|
||||
--- @field max_value number
|
||||
--- @field initial_value number
|
||||
--- @field is_percentage boolean
|
||||
--- @field is_special boolean
|
||||
--- @field value_step number
|
||||
@@ -229,7 +228,7 @@ Elements.bonus_slider = Gui.define("player_bonus/bonus_slider")
|
||||
local player = Gui.get_player(parent)
|
||||
local value = Elements.container.get_player_bonus(player, bonus_data.name)
|
||||
if not value then
|
||||
value = bonus_data.initial_value
|
||||
value = math.floor(bonus_data.initial_value / 2)
|
||||
elements.apply_button.enabled = true
|
||||
end
|
||||
|
||||
@@ -290,7 +289,7 @@ function Elements.bonus_slider.reset_value(slider)
|
||||
local player = Gui.get_player(slider)
|
||||
local element_data = Elements.bonus_slider.data[slider]
|
||||
local bonus_data = element_data.bonus_data
|
||||
local value = Elements.container.get_player_bonus(player, bonus_data.name) or bonus_data.initial_value
|
||||
local value = Elements.container.get_player_bonus(player, bonus_data.name) or math.floor(bonus_data.initial_value / 2)
|
||||
slider.slider_value = value
|
||||
element_data.label.caption = Elements.bonus_slider.calculate_slider_caption(bonus_data, value)
|
||||
element_data.previous_value = value
|
||||
|
||||
@@ -295,10 +295,6 @@ tooltip-amount=Amount of items to insert into the __1__ slots
|
||||
invalid=Autofill set to maximum amount: __1__ __2__ for __3__
|
||||
inserted=Inserted __1__ __2__ into __3__
|
||||
|
||||
[exp-gui_landfill-blueprint]
|
||||
tooltip-main=Landfill Blueprint
|
||||
error-no-blueprint=You need to hold the blueprint in cursor
|
||||
|
||||
[exp-gui_module-inserter]
|
||||
tooltip-main=Module Inserter
|
||||
caption-main=Modules
|
||||
|
||||
@@ -295,10 +295,6 @@ tooltip-amount=自動填入 __1__ 的數量
|
||||
invalid=自動填入最大值 __1__ __2__ 給 __3__
|
||||
inserted=自動填入 __1__ __2__ 到 __3__
|
||||
|
||||
[exp-gui_landfill-blueprint]
|
||||
tooltip-main=藍圖填海
|
||||
error-no-blueprint=您需要將藍圖保持在遊標處
|
||||
|
||||
[exp-gui_module-inserter]
|
||||
tooltip-main=模組
|
||||
caption-main=Modules
|
||||
|
||||
@@ -295,10 +295,6 @@ tooltip-amount=自動填入 __1__ 的數量
|
||||
invalid=自動填入最大值 __1__ __2__ 給 __3__
|
||||
inserted=自動填入 __1__ __2__ 到 __3__
|
||||
|
||||
[exp-gui_landfill-blueprint]
|
||||
tooltip-main=藍圖填海
|
||||
error-no-blueprint=您需要將藍圖保持在遊標處
|
||||
|
||||
[exp-gui_module-inserter]
|
||||
tooltip-main=模組
|
||||
caption-main=Modules
|
||||
|
||||
Reference in New Issue
Block a user