generated from fgardt/factorio-mod-template
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
other: The pressure dome atmosphere consumption now scales with quality.
- Loading branch information
1 parent
e2a91b6
commit 34fa1df
Showing
6 changed files
with
228 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
local function place_regulator(pressure_dome_data) | ||
local surface = pressure_dome_data.surface | ||
if not surface.valid then return end | ||
local position = pressure_dome_data.position | ||
local x, y = position.x, position.y | ||
local force = pressure_dome_data.force_index | ||
local quality = pressure_dome_data.quality | ||
|
||
if not quality and pressure_dome_data.regulator and pressure_dome_data.regulator.valid then | ||
quality = pressure_dome_data.regulator.quality | ||
end | ||
|
||
if not quality then | ||
game.print("ERROR: quality is nil for pressure dome at [gps=" .. x .. "," .. y .. "," .. surface.name .. "]") | ||
return | ||
end | ||
|
||
if type(quality) == "string" then | ||
quality = prototypes.quality[quality] | ||
end | ||
|
||
local regulator = pressure_dome_data.regulator | ||
if not regulator or not regulator.valid then | ||
storage.script_placing_the_regulator = true | ||
regulator = surface.create_entity { | ||
name = "service_station", | ||
position = {x, y}, | ||
quality = quality, | ||
force = force, | ||
create_build_effect_smoke = false, | ||
raise_built = true, | ||
} | ||
storage.script_placing_the_regulator = false | ||
end | ||
|
||
regulator.minable = false | ||
regulator.destructible = false | ||
regulator.operable = true | ||
|
||
pressure_dome_data.regulator = regulator | ||
|
||
local regulator_fluidbox = pressure_dome_data.regulator_fluidbox | ||
if not regulator_fluidbox or not regulator_fluidbox.valid then | ||
regulator_fluidbox = surface.create_entity { | ||
name = "maraxsis-regulator-fluidbox-" .. quality.name, | ||
position = {x, y}, | ||
force = force, | ||
create_build_effect_smoke = false, | ||
} | ||
end | ||
|
||
regulator_fluidbox.minable = false | ||
regulator_fluidbox.destructible = false | ||
regulator_fluidbox.operable = false | ||
|
||
pressure_dome_data.regulator_fluidbox = regulator_fluidbox | ||
end | ||
|
||
for _, dome_data in pairs(storage.pressure_domes or {}) do | ||
place_regulator(dome_data) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
function maraxsis.atmosphere_consumption(quality) | ||
if quality.hidden then error("hidden quality") end | ||
local quality_level = quality.level + 1 | ||
if quality.name == "legendary" then quality_level = 5 end | ||
local consumption_per_second | ||
if quality_level <= 5 then | ||
consumption_per_second = 6 - quality_level | ||
else | ||
consumption_per_second = 1 / (quality_level - 4) | ||
end | ||
return consumption_per_second, tostring(consumption_per_second * 100) .. "kW" | ||
end | ||
|
||
for _, quality in pairs(data.raw.quality) do | ||
if quality.hidden then goto continue end | ||
|
||
local _, energy_consumption = maraxsis.atmosphere_consumption(quality) | ||
|
||
if mods["assembler-pipe-passthrough"] then | ||
appmod.blacklist["maraxsis-regulator-fluidbox-" .. quality.name] = true | ||
end | ||
|
||
data:extend {{ | ||
type = "assembling-machine", | ||
name = "maraxsis-regulator-fluidbox-" .. quality.name, | ||
icon = "__maraxsis__/graphics/icons/regulator.png", | ||
icon_size = 64, | ||
flags = {"placeable-neutral", "player-creation", "not-on-map"}, | ||
minable = nil, | ||
localised_name = {"entity-name.service_station"}, | ||
hidden = true, | ||
quality_indicator_scale = 0, | ||
max_health = 99999, | ||
collision_mask = {layers = {}}, | ||
factoriopedia_alternative = "service_station", | ||
collision_box = {{-1.9, -1.9}, {1.9, 1.9}}, | ||
selection_box = {{-2, -2}, {2, 2}}, | ||
selectable_in_game = false, | ||
crafting_categories = {"maraxsis-regulator"}, | ||
crafting_speed = 1, | ||
energy_usage = energy_consumption, | ||
icon_draw_specification = {scale = 0, scale_for_many = 0}, | ||
fixed_recipe = "maraxsis-regulator", | ||
working_sound = { | ||
sound = { | ||
filename = "__maraxsis__/sounds/regulator.ogg", | ||
volume = 0.4 | ||
}, | ||
max_sounds_per_type = 3, | ||
audible_distance_modifier = 0.5, | ||
fade_in_ticks = 4, | ||
fade_out_ticks = 20 | ||
}, | ||
energy_source = { | ||
type = "fluid", | ||
burns_fluid = false, | ||
scale_fluid_usage = false, | ||
destroy_non_fuel_fluid = false, | ||
maximum_temperature = 0, | ||
fluid_box = { | ||
production_type = "input", | ||
pipe_picture = require("__space-age__.prototypes.entity.electromagnetic-plant-pictures").pipe_pictures, | ||
pipe_picture_frozen = require("__space-age__.prototypes.entity.electromagnetic-plant-pictures").pipe_pictures_frozen, | ||
pipe_covers = pipecoverspictures(), | ||
volume = 100, | ||
pipe_connections = { | ||
{position = {0.5, -1.5}, direction = defines.direction.north, flow_direction = "input-output"}, | ||
{position = {-0.5, 1.5}, direction = defines.direction.south, flow_direction = "input-output"}, | ||
{position = {1.5, 0.5}, direction = defines.direction.east, flow_direction = "input-output"}, | ||
{position = {-1.5, -0.5}, direction = defines.direction.west, flow_direction = "input-output"}, | ||
}, | ||
filter = "maraxsis-atmosphere", | ||
secondary_draw_orders = {north = -1}, | ||
}, | ||
smoke = { | ||
{ | ||
name = "maraxsis-swimming-bubbles", | ||
frequency = 100, | ||
position = {-0.9, -2.7}, | ||
starting_vertical_speed = 0.03 | ||
} | ||
} | ||
}, | ||
effect_receiver = { | ||
uses_module_effects = false, | ||
uses_beacon_effects = false, | ||
uses_surface_effects = false, | ||
}, | ||
graphics_set = { | ||
animation = { | ||
layers = { | ||
{ | ||
filename = "__maraxsis__/graphics/entity/regulator/regulator.png", | ||
priority = "high", | ||
width = 1680 / 8, | ||
height = 2320 / 8, | ||
shift = {0, -0.5}, | ||
frame_count = 60, | ||
line_length = 8, | ||
animation_speed = 1.5, | ||
scale = 0.5 * 4 / 3, | ||
flags = {"no-scale"} | ||
}, | ||
{ | ||
filename = "__maraxsis__/graphics/entity/regulator/sh.png", | ||
priority = "high", | ||
width = 400, | ||
height = 350, | ||
shift = util.by_pixel(0, -16), | ||
frame_count = 1, | ||
line_length = 1, | ||
repeat_count = 60, | ||
animation_speed = 1.5, | ||
scale = 0.5 * 4 / 3, | ||
draw_as_shadow = true, | ||
} | ||
} | ||
} | ||
} | ||
}} | ||
|
||
::continue:: | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters