Skip to content

Commit

Permalink
Improved sights and sounds for the bitumen seeps.
Browse files Browse the repository at this point in the history
  • Loading branch information
notnotmelon committed Nov 17, 2024
1 parent 3adc7c6 commit e9dc860
Show file tree
Hide file tree
Showing 7 changed files with 215 additions and 37 deletions.
7 changes: 5 additions & 2 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ Date: ?
Changes:
- Fixed bitumen extractors invisible in 2.0. Resolves https://github.com/pyanodon/pybugreports/issues/714
- Fixed natural gas derrick/etc can input drilling fluid into wrong port. Resolves https://github.com/pyanodon/pybugreports/issues/718
- Fixed floating pipe connection graphics for unpopped tae extractors.
- Bitumen extractors can now be connected to the circuit network even before it is popped.
- Fixed "floating" pipe connection graphics for unruptured bitumen extractors.
- Bitumen extractors can now be connected to the circuit network even before it is ruptured.
- Re-organized fluid inputs for bitumen extractors.
- Sulfur mines no longer requires gas canisters can consume fuel directly.
- Greatly increased the fuel consumption of the sulfur mine from 500kW to 30MW.
- Increased the number of module slots in the sulfur mine 1 -> 3.
- Added light flicker effects to the sulfur mine.
- Diluted the effects of green modules on the sulfur mine by a factor of 9x.
- The oil explosion from ruptured oil derricks now lightly damages nearby buildings.
- Added a chat message notification for ruptured bitumen seeps.
- The health of bitumen seep extractors now scales with MK level.
---------------------------------------------------------------------------------------------------
Version: 3.0.6
Date: 2024-11-14
Expand Down
1 change: 1 addition & 0 deletions locale/en/locale.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ drilling-fluid-0=It's just thick mud
[entity-name]
oil-sand=Oil sand
tar-patch=Tar pit
oil-explosion=Oil explosion
oil-mk01=Small oil patch
oil-mk02=Medium oil patch
oil-mk03=Big oil patch
Expand Down
2 changes: 2 additions & 0 deletions locale/en/tips.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
bitumen-seep-alert=[img=entity/__1__] [font=default-semibold][color=248, 175, 38] A bitumen seep has ruptured! Found [font=default-bold]__2__[/font] × [fluid=__3__] at [gps=__4__,__5__,__6__].[/color][/font]

[pywiki-sections]
petroleumhandling=Petroleum handling
bitumen-seep=[item=tar-extractor-mk01] Bitumen seeps
Expand Down
8 changes: 4 additions & 4 deletions prototypes/buildings/oil-derrick.lua
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,10 @@ local pipe_connections_per_tier = {
{flow_direction = "output", position = {-2.0, 0}, direction = defines.direction.west},
},
{
{flow_direction = "input-output", position = {0, -3.0}, direction = defines.direction.north},
{flow_direction = "input-output", position = {3.0, 0}, direction = defines.direction.east},
{flow_direction = "input-output", position = {0, 3.0}, direction = defines.direction.south},
{flow_direction = "input-output", position = {-3.0, 0}, direction = defines.direction.west},
{flow_direction = "output", position = {0, -3.0}, direction = defines.direction.north},
{flow_direction = "output", position = {3.0, 0}, direction = defines.direction.east},
{flow_direction = "output", position = {0, 3.0}, direction = defines.direction.south},
{flow_direction = "output", position = {-3.0, 0}, direction = defines.direction.west},
},
{
{flow_direction = "output", position = {0, -4.0}, direction = defines.direction.north},
Expand Down
152 changes: 147 additions & 5 deletions prototypes/buildings/tar-extractor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ RECIPE {
enabled = false,
ingredients = {
{type = "item", name = "tar-extractor-mk01", amount = 1},
{type = "item", name = "advanced-circuit", amount = 5},
{type = "item", name = "small-parts-02", amount = 15},
{type = "item", name = "engine-unit", amount = 10},
{type = "item", name = "niobium-plate", amount = 10},
{type = "item", name = "advanced-circuit", amount = 5},
{type = "item", name = "small-parts-02", amount = 15},
{type = "item", name = "engine-unit", amount = 10},
{type = "item", name = "niobium-plate", amount = 10},
},
results = {
{type = "item", name = "tar-extractor-mk02", amount = 1}
Expand Down Expand Up @@ -300,4 +300,146 @@ for i = 1, 4 do
localised_name = {"entity-name." .. name},
localised_description = {"entity-description." .. name}
}
end
end

local oil_explosion = {
animations = {
{
animation_speed = 0.5,
draw_as_glow = true,
filename = "__pypetroleumhandlinggraphics__/graphics/entity/oil-explosion/oil-explosion-1.png",
frame_count = 36,
height = 416,
shift = {
0,
-1.5
},
stripes = {
{
filename = "__pypetroleumhandlinggraphics__/graphics/entity/oil-explosion/oil-explosion-1.png",
height_in_frames = 3,
width_in_frames = 6
},
{
filename = "__pypetroleumhandlinggraphics__/graphics/entity/oil-explosion/oil-explosion-2.png",
height_in_frames = 3,
width_in_frames = 6
}
},
width = 324
}
},
created_effect = {
action_delivery = {
target_effects = {
{
initial_height = 0.5,
initial_vertical_speed = 0.08,
initial_vertical_speed_deviation = 0.15,
offset_deviation = {
{
-0.8984,
-0.5
},
{
0.8984,
0.5
}
},
particle_name = "explosion-stone-particle-medium",
repeat_count = 20,
speed_from_center = 0.1,
speed_from_center_deviation = 0.15,
type = "create-particle"
},
{
initial_height = 1,
initial_height_deviation = 0.5,
initial_vertical_speed = 0.1,
initial_vertical_speed_deviation = 0.05,
offset_deviation = {
{
-0.8984,
-0.5
},
{
0.8984,
0.5
}
},
particle_name = "explosion-stone-particle-small",
repeat_count = 25,
speed_from_center = 0.05,
speed_from_center_deviation = 0.05,
type = "create-particle"
},
{
initial_height = 1,
initial_height_deviation = 0.5,
initial_vertical_speed = 0.1,
initial_vertical_speed_deviation = 0.05,
offset_deviation = {
{
-0.8984,
-0.5
},
{
0.8984,
0.5
}
},
particle_name = "explosion-stone-particle-tiny",
repeat_count = 50,
speed_from_center = 0.05,
speed_from_center_deviation = 0.05,
type = "create-particle"
}
},
type = "instant"
},
type = "direct"
},
flags = {
"not-on-map",
},
hidden = true,
icon = "__base__/graphics/item-group/effects.png",
icon_size = 64,
name = "oil-explosion",
icons = {
{icon = "__base__/graphics/icons/explosion.png", tint = {0, 0, 0}},
},
flags = {"not-on-map"},
hidden = true,
sound = {
aggregation = {
max_count = 1,
remove = true
},
audible_distance_modifier = 95000,
game_controller_vibration_data = {
duration = 160,
low_frequency_vibration_intensity = 0.9,
play_for = "everything"
},
switch_vibration_data = {
filename = "__base__/sound/fight/large-explosion.bnvib",
gain = 0.6,
play_for = "everything"
},
variations = {
{
filename = "__base__/sound/fight/large-explosion-1.ogg",
volume = 0.8
},
{
filename = "__base__/sound/fight/large-explosion-2.ogg",
volume = 0.8
}
}
},
subgroup = "explosions",
type = "explosion"
}

data:extend{oil_explosion}
5 changes: 1 addition & 4 deletions prototypes/ores/natural-gas.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,4 @@ nat_gas4.autoplace = nil
nat_gas1.map_color = {r = 0.2, g = 0.1, b = 0.2}
nat_gas4.category = "natural-gas"

data.raw.resource["natural-gas-mk01"] = nat_gas1
data.raw.resource["natural-gas-mk02"] = nat_gas2
data.raw.resource["natural-gas-mk03"] = nat_gas3
data.raw.resource["natural-gas-mk04"] = nat_gas4
data:extend{nat_gas1, nat_gas2, nat_gas3, nat_gas4}
77 changes: 55 additions & 22 deletions scripts/bitumen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ local derrick_types = {}
for i = 1, 4 do
derrick_types["oil-derrick-mk0" .. i] = {
base = "oil-derrick-mk0" .. i .. "-base",
resource = "oil-mk0" .. i
resource = "oil-mk0" .. i,
fluid = "crude-oil",
}
derrick_types["tar-extractor-mk0" .. i] = {
base = "tar-extractor-mk0" .. i .. "-base",
resource = "tar-patch"
resource = "tar-patch",
fluid = "tar",
}
derrick_types["natural-gas-derrick-mk0" .. i] = {
base = "natural-gas-derrick-mk0" .. i .. "-base",
resource = "natural-gas-mk01"
resource = "natural-gas-mk0" .. i,
fluid = "raw-gas",
}
end

Expand Down Expand Up @@ -201,6 +204,11 @@ script.on_event(defines.events.on_chunk_generated, function(event)
end
end)

local function add_commas_to_number(number)
local formatted = tostring(number):reverse():gsub("(%d%d%d)", "%1,"):reverse()
return formatted:match("^,") and formatted:sub(2) or formatted
end

script.on_event(defines.events.on_resource_depleted, function(event)
local resource = event.entity
if resource.name ~= "bitumen-seep" then
Expand All @@ -214,27 +222,52 @@ script.on_event(defines.events.on_resource_depleted, function(event)

for _, drill in pairs(active_drills) do
local drill_data = derrick_types[drill.name]
if drill_data then
local drill_fluid = storage.oil_derricks[drill.unit_number].drilling_fluid
local fluid_tier = ((drill_fluid:match("%d$") + 1) * 4)
local drill_tier = (drill.name:match("%d$") * 4)
local random_factor = math.random(4, 16)
local new_patch_size = 40000 * random_factor * drill_tier * fluid_tier

local base = storage.oil_derricks[drill.unit_number].base
if base and base.valid then base.destroy() end
storage.oil_derricks[drill.unit_number] = nil

resource.surface.create_entity {
name = drill_data.resource,
amount = new_patch_size,
position = resource.position,
quality = resource.quality.name
}
if not drill_data then goto continue end

local drill_fluid = storage.oil_derricks[drill.unit_number].drilling_fluid
local fluid_tier = ((drill_fluid:match("%d$") + 1) * 4)
local drill_tier = (drill.name:match("%d$") * 4)
local random_factor = math.random(4, 16)
local new_patch_size = 40000 * random_factor * drill_tier * fluid_tier

local base = storage.oil_derricks[drill.unit_number].base
if base and base.valid then base.destroy() end
storage.oil_derricks[drill.unit_number] = nil

resource.surface.create_entity {
name = drill_data.resource,
amount = new_patch_size,
position = resource.position,
quality = resource.quality.name
}

drill.update_connections()
drill.update_connections()

--force.print {"turd.font", {"turd.selected-alert", {"technology-name." .. master_tech_name}, {"technology-name." .. sub_tech_name}, player.name, player.color.r, player.color.g, player.color.b}}
local fluid = drill_data.fluid
drill.force.print {
"bitumen-seep-alert",
drill.name,
add_commas_to_number(new_patch_size * 100),
fluid,
drill.position.x,
drill.position.y,
drill.surface.name
}

local oil_explosion = drill.surface.create_entity{
name = "oil-explosion",
position = drill.position,
force = drill.force_index
}

-- slightly damage all entities in 20 tile radius
for _, entity in pairs(drill.surface.find_entities_filtered {position = drill.position, radius = 20, collision_mask = "object"}) do
if entity.is_entity_with_health then
local damage_amount = math.min(math.random(184, 222), entity.max_health * math.random(27, 33) / 100)
entity.damage(damage_amount, "enemy", "explosion", oil_explosion, drill)
end
end

::continue::
end
end)

0 comments on commit e9dc860

Please sign in to comment.