Skip to content

Commit

Permalink
Updates for 0.17
Browse files Browse the repository at this point in the history
  • Loading branch information
dewiniaid committed Feb 26, 2019
1 parent 50a8126 commit 338fd63
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 16 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ KSP-like time warp for Factorio using keybindings, from 0.25x to 64x speed (if y
by [TimeTools](https://mods.factorio.com/mods/binbinhfr/TimeTools), but using keyboard shortcuts rather than the UI
display and intentionally ignoring all of the other things that mod adds.

Time warp affects all players. TimeControl only allows players with console access to change the game speed (i.e.
those who could just type `/c game.speed=2` anyways, but TimeControl won't disable achievements.)
Time warp affects all players. In multiplayer games, only admins are allowed to change time warp settings by default.
This can be changed in Mod Settings.

All players will be notified via console message when the game speed is changed, who changed it and the new speed.

## Default Keybindings

Factorio's Controls UI doesn't show various keyboard keys correctly (they'll just read as "KEY61", etc.). Here's the
actual keybindings in use by default. Like all mods, you can change these in **Options -> Controls -> Mods**
Like all mods, you can change these in **Options -> Controls -> Mods**

- `-` Halves the current game speed, with a minimum speed of 0.25x.
- `+` Doubles the current game speed, with a maximum speed of 64x.
Expand All @@ -25,6 +24,10 @@ Make minimum and maximum timewarp amounts configurable.

## Changelog

### 0.1.5 (2018-02-26)
* Update for Factorio 0.17
* Removed the old permission check for timewarp, which never actually worked. You can now choose between allowing everyone or just admins to timewarp in map settings.

### 0.1.4 (2018-10-08)
* Added German translations, courtesy of mrbesen and SuperSandro2000
* Fix a cosmetic localization bug in mod settings.
Expand Down
19 changes: 15 additions & 4 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ local function update_gui(player_index, visible)
caption = display_caption,
style = display_style,
}
top.TimeControlSpeedometer.style.visible = visible
top.TimeControlSpeedometer.visible = visible
return
end

if visible then
ctl.caption = display_caption
ctl.style = display_style
ctl.style.visible = true
ctl.visible = true
else
ctl.style.visible = false
ctl.visible = false
end
end

Expand Down Expand Up @@ -112,9 +112,20 @@ end)

local function warp_time(event, multiplier)
local player = game.players[event.player_index]
if not (player and player.permission_group and player.permission_group.allows_action(defines.server_command)) then

-- Permissions check
if not (player.admin or settings.global['TimeControl-access'] == 'everyone') then
return
end
-- -- Experimental; FIXME
-- if not (
-- player and player.permission_group
---- and player.permission_group.allows_action(defines.input_action.admin_action)
---- and player.permission_group.allows_action(defines.input_action.write_to_console)
-- and true
-- ) then
-- return
-- end

local msg = "timecontrol.speed-changed"

Expand Down
4 changes: 2 additions & 2 deletions data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ data:extend({
{
type = "custom-input",
name = "timecontrol_faster",
key_sequence = "KEY62",
key_sequence = "EQUALS",
order = 'a-a',
-- consuming = "all",
},
{
type = "custom-input",
name = "timecontrol_slower",
key_sequence = "KEY61",
key_sequence = "MINUS",
order = 'a-b',
-- consuming = "all"
},
Expand Down
6 changes: 3 additions & 3 deletions info.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "TimeControl",
"version": "0.1.4",
"version": "0.1.5",
"title": "Time Control",
"author": "Dewin",
"contact": "https://github.com/dewiniaid/TimeControl",
"homepage": "https://github.com/dewiniaid/TimeControl",
"factorio_version": "0.16",
"dependencies": ["base >= 0.16"],
"factorio_version": "0.17",
"dependencies": ["base >= 0.17"],
"description": "Adds bindings for adjusting game speed."
}
4 changes: 4 additions & 0 deletions locale/en/locale.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ timecontrol_slower=Slower

[mod-setting-name]
TimeControl-display=Show time warp status
TimeControl-access=Time warp controllable by

[string-mod-setting]
TimeControl-display-never=never
TimeControl-display-always=always
TimeControl-display-when-warping=while time warp is active

TimeControl-access-admins=Admins
TimeControl-access-everyone=Everyone
14 changes: 11 additions & 3 deletions settings.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
data:extend{
data:extend {
{
type = "string-setting",
name = "TimeControl-display",
setting_type = "runtime-per-user",
order = 100,
default_value = 'when-warping',
allowed_values = {'never', 'when-warping', 'always'},
}
allowed_values = { 'never', 'when-warping', 'always' },
},
{
type = "string-setting",
name = "TimeControl-access",
setting_type = "runtime-global",
order = 101,
default_value = 'admins',
allowed_values = { 'admins', 'everyone' },
},
}

0 comments on commit 338fd63

Please sign in to comment.