Skip to content

Commit

Permalink
feat: Added circuit connectivity to pressure domes
Browse files Browse the repository at this point in the history
  • Loading branch information
notnotmelon committed Sep 3, 2024
1 parent 0b1689d commit 87b370e
Show file tree
Hide file tree
Showing 6 changed files with 300 additions and 9 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ These new worlds are compelling, but one question still lingers: where do we go

---

### DISCLAIMER

This mod is currently non-functional. I am just claiming the name! Please wait until the release of Space Age to play this mod.

---

### Welcome to Maraxsis

Let me introduce this pristine, submerged world. Far away from the sun, this planet paradoxically maintains a comfortable temperature through a runaway greenhouse effect. Preliminary surface scans show an average temperature of 101°F. It's not too hot and not too cold, the perfect Goldilocks zone for liquid water. Maybe even too perfect...
Expand Down Expand Up @@ -84,6 +90,18 @@ These specialized structures are designed to withstand the immense pressures of

---

### Pressure domes circuit connectivity

Have you ever wanted to build a giant underwater disco dome in Factorio? No? Well I coded it anyway

![](https://files.catbox.moe/ivqc9z.mp4)

You can also connect the dome to a wire to read the entities inside.

![](https://files.catbox.moe/gv0fmf.png)

---

### Progression

Maraxsis is available at the same time as Aquilo. The mod does not change any vanilla recipes meaning the mod can be seamlessly added to any existing Space Age save, even if the save is completed. The tech tree on Maraxsis is designed to be small, focused, and efficient. The mod leans heavily into the puzzle genera requiring creative setups to solve difficult challenges. Do you have what it takes to craft the hydraulic science pack?
Expand Down
7 changes: 7 additions & 0 deletions data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,10 @@ require 'prototypes.hydraulic-science-pack'
require 'prototypes.autoplace'
require 'prototypes.tile.lava'
require 'prototypes.tips-and-tricks.tips-and-tricks'

data:extend{{
type = 'custom-input',
name = 'open-gui',
key_sequence = '',
linked_game_control = 'open-gui'
}}
2 changes: 2 additions & 0 deletions locale/en/locale.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
not-operable=

[mod-name]
title=Maraxsis

Expand Down
136 changes: 130 additions & 6 deletions prototypes/pressure-dome.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ data:extend {{
category = 'crafting',
}}

local size = 16
local function collision_box() return {{-16, -16}, {16, 16}} end

data:extend {{
type = 'simple-entity-with-owner',
Expand All @@ -72,16 +72,15 @@ data:extend {{
icon_size = 64,
flags = {'placeable-player', 'player-creation', 'not-on-map', 'not-blueprintable'},
max_health = 3000,
collision_box = {{-size, -size}, {size, size}},
collision_box = collision_box(),
minable = {mining_time = 1, result = 'h2o-pressure-dome'},
selection_box = {{-size, -size}, {size, size}},
drawing_box = {{-size, -size}, {size, size}},
selection_box = collision_box(),
drawing_box = collision_box(),
collision_mask = {},
render_layer = 'higher-object-under',
selectable_in_game = false,
selection_priority = 40,
picture = {
layers = {shadow, dome, light, light_2},
layers = {shadow, dome},
},
build_sound = {
filename = '__core__/sound/build-ghost-tile.ogg',
Expand All @@ -93,6 +92,131 @@ data:extend {{
}
}}

data:extend {h2o.merge(data.raw['lamp']['small-lamp'], {
type = 'lamp',
name = 'h2o-pressure-dome-lamp',
localised_name = {'entity-name.h2o-pressure-dome'},
localised_description = {'entity-description.h2o-pressure-dome'},
remove_decoratives = 'false',
icon = '__maraxsis__/graphics/icons/pressure-dome.png',
icon_size = 64,
flags = {'placeable-player', 'player-creation', 'not-on-map', 'not-blueprintable'},
max_health = 3000,
collision_box = collision_box(),
selection_box = {{-0.01, -0.01}, {0.01, 0.01}},
selection_priority = 0,
drawing_box = collision_box(),
collision_mask = {},
selectable_in_game = true,
picture_on = light,
picture_off = h2o.empty_image(),
circuit_wire_max_distance = 16,
energy_usage_per_tick = '2MW',
glow_size = 65,
light = {
size = 65,
color = {
b = 0.75,
g = 1,
r = 1
},
intensity = 0.9,
},
light_when_colored = {
color = {
b = 0.75,
g = 1,
r = 1
},
intensity = 0,
size = 65,
},
})}

data:extend{h2o.merge(data.raw['constant-combinator']['constant-combinator'], {
type = 'constant-combinator',
name = 'h2o-pressure-dome-combinator',
localised_name = {'entity-name.h2o-pressure-dome'},
localised_description = {'entity-description.h2o-pressure-dome'},
remove_decoratives = 'false',
icon = '__maraxsis__/graphics/icons/pressure-dome.png',
icon_size = 64,
flags = {'placeable-player', 'player-creation', 'not-on-map', 'not-blueprintable', 'hidden'},
max_health = 3000,
selectable_in_game = false,
item_slot_count = 500,
activity_led_light_offsets = {
{0, 0},
{0, 0},
{0, 0},
{0, 0}
},
circuit_wire_connection_points = {
{
shadow = {red = {0, 0}, green = {0, 0}},
wire = {red = {0, 0}, green = {0, 0}}
},
{
shadow = {red = {0, 0}, green = {0, 0}},
wire = {red = {0, 0}, green = {0, 0}}
},
{
shadow = {red = {0, 0}, green = {0, 0}},
wire = {red = {0, 0}, green = {0, 0}}
},
{
shadow = {red = {0, 0}, green = {0, 0}},
wire = {red = {0, 0}, green = {0, 0}}
}
},
draw_copper_wires = false,
draw_circuit_wires = false,
sprites = 'nil',
activity_led_sprites = 'nil',
activity_led_light = 'nil',
collision_mask = {},
})}

local function shift_the_circuit_connection_point(entity, x, y)
local connection = entity.circuit_wire_connection_point or {
wire = {copper = {x = 0, y = 0}, green = {x = 0, y = 0}, red = {x = 0, y = 0}},
shadow = {copper = {x = 0, y = 0}, green = {x = 0, y = 0}, red = {x = 0, y = 0}},
}

local function adjust_shift(vector)
if not vector then return end
vector.x = (vector[1] or vector.x or 0) + x
vector.y = (vector[2] or vector.y or 0) + y
end

for _, connection in pairs(connection) do
for _, color in pairs(connection) do
adjust_shift(color)
end
end

for _, sprite in pairs(entity.circuit_connector_sprites) do
adjust_shift(sprite.shift or {})
if sprite.hr_version then
adjust_shift(sprite.hr_version.shift or {})
end
for _, layer in pairs(sprite.layers or {}) do
adjust_shift(layer.shift or {})
if layer.hr_version then
adjust_shift(layer.hr_version.shift or {})
end
end
if sprite.picture then
adjust_shift(sprite.picture.shift or {})
if sprite.picture.hr_version then
adjust_shift(sprite.picture.hr_version.shift or {})
end
end
end
end

shift_the_circuit_connection_point(data.raw['lamp']['h2o-pressure-dome-lamp'], 4, 17)

data:extend {{
type = 'trivial-smoke',
name = 'h2o-invisible-smoke',
Expand Down
2 changes: 1 addition & 1 deletion scripts/composite-entity.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ h2o.on_event('on_built', on_built)

local function on_destroyed(event)
local entity = event.entity
if not composite_entity_creation[entity.name] then return end
if not entity.valid or not composite_entity_creation[entity.name] then return end
local sub_entities = global.composite_entities[entity.unit_number]
if not sub_entities then return end
for _, sub_entity in pairs(sub_entities) do
Expand Down
Loading

0 comments on commit 87b370e

Please sign in to comment.