Skip to content

Commit

Permalink
Bitumen extractors no longer show "disabled by script" and instead sh…
Browse files Browse the repository at this point in the history
…ows a custom status explaining that it requires drilling fluid.
  • Loading branch information
notnotmelon committed Jan 17, 2025
1 parent 26a49ae commit 0e081c8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Date: tba
Changes:
- Removed non hot air advanced casting recipes and allowed productivity in them instead.
- Moved hot air glassware from py science 1 unlock to hot air unlock. Resolves https://github.com/pyanodon/pybugreports/issues/811
- Bitumen extractors no longer show "disabled by script" and instead shows a custom status explaining that it requires drilling fluid.
---------------------------------------------------------------------------------------------------
Version: 3.0.10
Date: 2025-1-2
Expand Down
14 changes: 2 additions & 12 deletions locale/en/locale.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -374,18 +374,8 @@ tar-patch=Tar pit
sulfur-patch=[img=entity.sulfur-patch] Sulfur vein
bitumen-seep=[img=entity.bitumen-seep] Bitumen seep
[controls]
[mod-setting-name]
[mod-setting-description]
[tile-name]
space=Empty space
space-plate=Space platfrom section
[wiki-info]
oil=How to find oil and tar
oil_info=To get oil or tar you need to find a "Bitumen seep" patch and place an oil derrick or a tar extractor upon the resource. The drill you placed down will require both drilling fluid and power for it to start up. After some time for the drill to drill down to the resource, it will stop using the drilling fluid and will begin outputting oil or tar-based on the entity placed on it. the default amount of fluid is between 100,000 and 400,000 per patch. this amount can be increased by both the entities level and the level of drilling fluid used. Max possible increase is x64 base value.
[gui-game-finished]
[entity-status]
requires-drilling-fluid=Requires drilling fluid
16 changes: 14 additions & 2 deletions scripts/bitumen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

local update_rate = 67

local BITUMEN_DISABLED_CUSTOM_STATUS = {
diode = defines.entity_status_diode.red,
label = {"entity-status.requires-drilling-fluid"}
}

py.on_event(py.events.on_init(), function()
if storage.first_chunk == nil then storage.first_chunk = false end
storage.oil_derricks = storage.oil_derricks or {}
Expand Down Expand Up @@ -83,15 +88,17 @@ py.on_event(py.events.on_built(), function(event)
direction = drill.direction
}
assembler.set_recipe("drilling-fluids")
assembler.active = false
assembler.destructible = false
storage.oil_derricks[drill.unit_number] = {
entity = drill,
base = assembler,
drilling_fluid = "",
patch = patch
}
drill.active = false
for _, entity_to_disable in pairs{assembler, drill} do
entity_to_disable.active = false
entity_to_disable.custom_status = BITUMEN_DISABLED_CUSTOM_STATUS
end
-- Register for destruction event to handle removal via editor etc
script.register_on_object_destroyed(drill)
render_text(storage.oil_derricks[drill.unit_number], update_rate - game.tick % update_rate)
Expand Down Expand Up @@ -189,6 +196,11 @@ py.register_on_nth_tick(update_rate, "drills", "pyph", function()
end
end
drill.entity.active = drill_active
if drill_active then
drill.entity.custom_status = nil
else
drill.entity.custom_status = BITUMEN_DISABLED_CUSTOM_STATUS
end

render_text(drill, update_rate + 1)

Expand Down

0 comments on commit 0e081c8

Please sign in to comment.