• 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

Revisionec428dbe06957e5a06cf0479f0ad9d26f8b0e99c (tree)
Time2019-03-05 17:35:00
AuthorEric Hopper <hopper@omni...>
CommiterEric Hopper

Log Message

Update to use new 0.17 shortcut feature.

Change Summary

Incremental Difference

diff -r 31e760a4fc46 -r ec428dbe0695 changelog.txt
--- a/changelog.txt Tue Feb 26 19:50:11 2019 -0800
+++ b/changelog.txt Tue Mar 05 00:35:00 2019 -0800
@@ -1,3 +1,9 @@
1+---------------------------------------------------------------------------------------------------
2+Version: 0.2.2
3+Date: 26. 02. 2019
4+ Major Features:
5+ - Remove mod config setting and add shortcut toggle (like the
6+ roboport toggle) to turn behavior on and off.
17 ---------------------------------------------------------------------------------------------------
28 Version: 0.2.1
39 Date: 26. 02. 2019
diff -r 31e760a4fc46 -r ec428dbe0695 control.lua
--- a/control.lua Tue Feb 26 19:50:11 2019 -0800
+++ b/control.lua Tue Mar 05 00:35:00 2019 -0800
@@ -1,20 +1,14 @@
1-local conf_enable = setmetatable({}, {
2- __index = function(self, id)
3- local v = settings.get_player_settings(game.players[id])["ld_autocircuit-enabled"].value
4- rawset(self, id, v)
5- return v
6- end
7-})
1+function OnShortCut(event)
2+ if event.prototype_name == "ld-autocircuit-shortcut" then
3+ local player = game.players[event.player_index]
4+ if player.is_shortcut_available("ld-autocircuit-shortcut") then
5+ local toggled = player.is_shortcut_toggled("ld-autocircuit-shortcut")
6+ player.set_shortcut_toggled("ld-autocircuit-shortcut", not toggled)
7+ end
8+ end
9+end
810
9-script.on_event(defines.events.on_runtime_mod_setting_changed,
10- function(event)
11- if not event or not event.setting then
12- return
13- end
14- if event.setting == "ld_autocircuit-enabled" then
15- conf_enable[event.player_index] = nil
16- end
17-end)
11+script.on_event(defines.events.on_lua_shortcut, OnShortCut)
1812
1913 local function is_long_distance_pole(entity)
2014 if entity.type ~= "electric-pole" then
@@ -41,8 +35,8 @@
4135 return (greenwires ~= nil) and (#greenwires > 0)
4236 end
4337
44-script.on_event(defines.events.on_built_entity, function(event)
45- if not conf_enable[event.player_index] then
38+function BuiltSomething(event)
39+ if not game.players[event.player_index].is_shortcut_toggled("ld-autocircuit-shortcut") then
4640 return
4741 end
4842 local entity = event.created_entity
@@ -71,4 +65,6 @@
7165 for _, newconnect in pairs(newconnects) do
7266 entity.connect_neighbour(newconnect)
7367 end
74-end)
68+end
69+
70+script.on_event(defines.events.on_built_entity, BuiltSomething)
diff -r 31e760a4fc46 -r ec428dbe0695 data-updates.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/data-updates.lua Tue Mar 05 00:35:00 2019 -0800
@@ -0,0 +1,1 @@
1+require("shortcuts")
diff -r 31e760a4fc46 -r ec428dbe0695 icons/ld-autocircuit-button.png
Binary file icons/ld-autocircuit-button.png has changed
diff -r 31e760a4fc46 -r ec428dbe0695 info.json
--- a/info.json Tue Feb 26 19:50:11 2019 -0800
+++ b/info.json Tue Mar 05 00:35:00 2019 -0800
@@ -1,11 +1,11 @@
11 {
22 "name": "LD_AutoCircuit",
3- "version": "0.2.1",
3+ "version": "0.2.2",
44 "title": "LD Auto Circuit",
55 "author": "Omnifarious",
66 "contact": "eric-factorio@omnifarious.org",
77 "homepage": "",
88 "factorio_version": "0.17",
99 "dependencies": ["base >= 0.17"],
10- "description": "This mod will automatically string red and green wire over long distance poles."
10+ "description": "This mod adds a shortcut toggle (like the roboport toggle) that will automatically string red and green wire from long distance poles that already have red and green wire to newly placed poles."
1111 }
diff -r 31e760a4fc46 -r ec428dbe0695 locale/en/all.cfg
--- a/locale/en/all.cfg Tue Feb 26 19:50:11 2019 -0800
+++ b/locale/en/all.cfg Tue Mar 05 00:35:00 2019 -0800
@@ -1,5 +1,2 @@
1-[mod-setting-name]
2-ld_autocircuit-enabled=LD Auto Circuit Enabled
3-
4-[mod-setting-description]
5-ld_autocircuit-enabled=Toggles whether or not to automatically string circuit wire from a long distance pole to another that also has circuit wire.
1+[shortcut-name]
2+ld-autocircuit-shortcut=Toggle LD AutoCircuit
diff -r 31e760a4fc46 -r ec428dbe0695 readme.md
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/readme.md Tue Mar 05 00:35:00 2019 -0800
@@ -0,0 +1,11 @@
1+## LD AutoCircuit
2+
3+--------------------------------------
4+
5+This mod adds a shortcut toggle (like the roboport toggle) that toggles
6+whether or not circuit wires are automatically strung to a newly placed
7+long-distance pole when you place the pole such that it connects to
8+another pole that already has circuit wires attached.
9+
10+This is useful for running circuit wires all along your rail network or
11+over other long distances.
diff -r 31e760a4fc46 -r ec428dbe0695 settings.lua
--- a/settings.lua Tue Feb 26 19:50:11 2019 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
1-_G.data:extend({
2- {
3- type = "bool-setting",
4- name = "ld_autocircuit-enabled",
5- setting_type = "runtime-per-user",
6- default_value = true,
7- },
8-})
diff -r 31e760a4fc46 -r ec428dbe0695 shortcuts.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/shortcuts.lua Tue Mar 05 00:35:00 2019 -0800
@@ -0,0 +1,19 @@
1+data:extend(
2+{
3+ {
4+ type = "shortcut",
5+ name = "ld-autocircuit-shortcut",
6+ order = "zzz",
7+ action = "lua",
8+ technology_to_unlock = "circuit-network",
9+ toggleable = true,
10+ icon =
11+ {
12+ filename = "__LD_AutoCircuit__/icons/ld-autocircuit-button.png",
13+ priority = "extra-high-no-scale",
14+ size = 32,
15+ scale = 1,
16+ flags = { "icon" }
17+ }
18+ }
19+})
diff -r 31e760a4fc46 -r ec428dbe0695 thumbnail.png
Binary file thumbnail.png has changed