Initial commit
This commit is contained in:
commit
6708414db3
5 changed files with 54 additions and 0 deletions
7
LICENSE
Normal file
7
LICENSE
Normal file
|
@ -0,0 +1,7 @@
|
|||
Copyright 2017 kauron
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
29
control.lua
Normal file
29
control.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
-- sends a train to its next station if its in automatic
|
||||
function toNextStation(t)
|
||||
local l = 0
|
||||
for _ in pairs(t.schedule.records) do l = l + 1 end
|
||||
|
||||
if not t.manual_mode and l > 1 then
|
||||
local s = t.schedule
|
||||
s.current = math.fmod(s.current, l) + 1
|
||||
t.schedule = s
|
||||
t.manual_mode = false
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
script.on_event("go-to-next-station", function(event)
|
||||
local player = game.players[event.player_index]
|
||||
-- 2 alternatives: player is mousing over train or inside a train.
|
||||
if player.selected and player.selected.train then
|
||||
if toNextStation(player.selected.train) then return end
|
||||
end
|
||||
|
||||
if player.vehicle and player.vehicle.train then
|
||||
if toNextStation(player.vehicle.train) then return end
|
||||
end
|
||||
end)
|
||||
|
||||
|
7
data.lua
Normal file
7
data.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
data:extend({
|
||||
{
|
||||
type = "custom-input",
|
||||
name = "go-to-next-station",
|
||||
key_sequence = "SHIFT + N"
|
||||
}
|
||||
})
|
9
info.json
Normal file
9
info.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"name": "next-station",
|
||||
"version": "0.1.1",
|
||||
"title": "Next Station",
|
||||
"author": "kauron",
|
||||
"description": "Adds a hotkey to send the trains to their next station. First check if the player is mousing over a train and then the train the player is riding.",
|
||||
"factorio_version": "0.15",
|
||||
"dependencies": ["base >= 0.15.32"]
|
||||
}
|
2
locale/en/next-station.cfg
Normal file
2
locale/en/next-station.cfg
Normal file
|
@ -0,0 +1,2 @@
|
|||
[controls]
|
||||
go-to-next-station=Go to the next station
|
Loading…
Reference in a new issue