• R/O
  • SSH

Commit

Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Another simple mod for the game "Factorio". Automatically strings circuit wire on long distance poles.


Commit MetaInfo

Revisiónb2df8c1a26e1680bc152a66692e1ac369b559e7f (tree)
Tiempo2018-11-04 14:52:04
AutorEric Hopper <hopper@omni...>
CommiterEric Hopper

Log Message

Fix a whole host of different small stupid errors.

Cambiar Resumen

Diferencia incremental

diff -r 6d13949fa9ee -r b2df8c1a26e1 control.lua
--- a/control.lua Sat Nov 03 22:16:41 2018 -0700
+++ b/control.lua Sat Nov 03 22:52:04 2018 -0700
@@ -17,38 +17,43 @@
1717 end)
1818
1919 local function is_long_distance_pole(entity)
20- if entity.type != "electric-pole" then
21- return false
22- elseif entity.supply_area_distance > 2 then
23- return false
24- elseif entity.maximum_wire_distance < 30 then
20+ if entity.type ~= "electric-pole" then
2521 return false
2622 else
27- return true
23+ local poleproto = entity.prototype
24+ if poleproto.supply_area_distance > 2 then
25+ return false
26+ elseif poleproto.max_wire_distance < 30 then
27+ return false
28+ else
29+ return true
30+ end
2831 end
2932 end
3033
3134 local function has_red_wire(pole)
32- local redwires = pole.neighbors["red"]
35+ local redwires = pole.neighbours["red"]
3336 return (redwires ~= nil) and (#redwires > 0)
37+end
3438
3539 local function has_green_wire(pole)
36- local greenwires = pole.neighbors["green"]
37- return (redwires ~= nil) and (#redwires > 0)
40+ local greenwires = pole.neighbours["green"]
41+ return (greenwires ~= nil) and (#greenwires > 0)
42+end
3843
3944 script.on_event(defines.events.on_built_entity, function(event)
40- if not conf_enable then
45+ if not conf_enable[event.player_index] then
4146 return
4247 end
4348 local entity = event.created_entity
4449 if (not entity) or (not is_long_distance_pole(entity)) then
4550 return
4651 end
47- local copperbuddies = entity.neighbors["copper"]
52+ local copperbuddies = entity.neighbours["copper"]
4853 if not copperbuddies then
4954 return
5055 end
51- local otherpole
56+ local otherpole = nil
5257 local newconnects = {}
5358 for _, otherpole in pairs(copperbuddies) do
5459 if is_long_distance_pole(otherpole) then
@@ -64,4 +69,6 @@
6469 end
6570 local newconnect
6671 for _, newconnect in pairs(newconnects) do
67- entity.connect_neighbor(newconnect)
72+ entity.connect_neighbour(newconnect)
73+ end
74+end)
diff -r 6d13949fa9ee -r b2df8c1a26e1 settings.lua
--- a/settings.lua Sat Nov 03 22:16:41 2018 -0700
+++ b/settings.lua Sat Nov 03 22:52:04 2018 -0700
@@ -1,7 +1,7 @@
11 _G.data:extend({
22 {
33 type = "bool-setting",
4- name = "ld_autocircuit-endabled",
4+ name = "ld_autocircuit-enabled",
55 setting_type = "runtime-per-user",
66 default_value = true,
77 },