aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2025-04-14 17:44:04 +0200
committerPaul Oliver <contact@pauloliver.dev>2025-04-15 01:44:25 +0200
commitae50847e4831a2291da2bc023ebc664f2597fb1a (patch)
tree122936e63c020778d555c3f32967a5d8dba2790b
parent1c97c7b61f51255baa2a42c81a8cd8cb6ef9ea1b (diff)
More formatting changes on control.lua
-rw-r--r--von-newmann-2/control.lua27
1 files changed, 12 insertions, 15 deletions
diff --git a/von-newmann-2/control.lua b/von-newmann-2/control.lua
index 0283aa5..e1b5004 100644
--- a/von-newmann-2/control.lua
+++ b/von-newmann-2/control.lua
@@ -1,6 +1,6 @@
local util = require("util")
local crash_site = require("crash-site")
-local modEnabled = true
+local mod_enabled = true
local entities = {
{"substation", {y = 0.5,x = -0.5}, {}},
@@ -117,7 +117,7 @@ local function spawn_entity(entity_name, relative_position, center, surface, ext
return e
end
-function getTableSize(t)
+function get_table_size(t)
local count = 0
for _, _ in pairs(t) do
@@ -136,13 +136,10 @@ function create_power_source(entity)
raise_built = false
})
- if(true) then
- local hi = spawn_entity("clp-heat-interface",{y=-3,x=2},entity.position,entity.surface,{},entity.force)
- local hp = spawn_entity("clp-heat-pipe",{y=-4,x=2},entity.position,entity.surface,{},entity.force)
- hi.set_heat_setting{temperature = 31, mode = "at-least"}
- storage.heat_intefaces[entity.unit_number] = {hi,hp}
- end
-
+ local hi = spawn_entity("clp-heat-interface",{y=-3,x=2},entity.position,entity.surface,{},entity.force)
+ local hp = spawn_entity("clp-heat-pipe",{y=-4,x=2},entity.position,entity.surface,{},entity.force)
+ hi.set_heat_setting{temperature = 31, mode = "at-least"}
+ storage.heat_intefaces[entity.unit_number] = {hi,hp}
storage.power_interfaces[entity.unit_number] = powerInterface
end
@@ -195,7 +192,7 @@ function on_deconstruction(event)
do return end
end
- if (inventory.get_item_count("cargo-landing-pad") >= 1 and getTableSize(event.entity.surface.find_entities_filtered({name="cargo-landing-pad"})) == 0) then
+ if (inventory.get_item_count("cargo-landing-pad") >= 1 and get_table_size(event.entity.surface.find_entities_filtered({name="cargo-landing-pad"})) == 0) then
inventory.remove({name="cargo-landing-pad",count=1})
content = inventory.get_contents()
inventory.clear()
@@ -227,8 +224,8 @@ local function create_roboport(center, surface, player)
end
end
-local function updateInventory()
- if not modEnabled then
+local function update_inventory()
+ if not mod_enabled then
return
end
@@ -289,7 +286,7 @@ local function on_player_created(event)
util.remove_safe(player, crashed_debris_items)
-- player.get_main_inventory().sort_and_merge()
- updateInventory()
+ update_inventory()
local area = {{center.x + 10, center.y + 15}, {center.x - 10, center.y - 15}}
clear_area(area, surface)
create_roboport(center, surface, player)
@@ -357,7 +354,7 @@ end
script.on_init(function ()
if not remote.interfaces.freeplay then
- modEnabled = false
+ mod_enabled = false
return
end
@@ -367,5 +364,5 @@ script.on_init(function ()
script.on_event(defines.events.on_player_created, on_player_created)
script.on_event(defines.events.on_player_changed_position, on_player_changed_position)
- script.on_configuration_changed(updateInventory)
+ script.on_configuration_changed(update_inventory)
end)