Skip to content

Commit da8c5c4

Browse files
author
Will Thomas
committed
0.1.7
configurable. Power tweaked and then untweaked. Frustration there. Hopefully fixed desync issue?
1 parent 9999768 commit da8c5c4

3 files changed

Lines changed: 18 additions & 7 deletions

File tree

config.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
require 'defines'
22

3-
debug_mode = false
3+
debug_mode = false
4+
5+
refresh_rate = 2 --the rate, in times per second, that nixies update
6+

control.lua

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
require "config"
22

33
local nixie_map = {}
4-
local mod_version="0.1.6"
4+
local mod_version="0.1.7"
55
local mod_data_version="0.1.0"
66

7+
local ticksPerRefresh = math.ceil(60*refresh_rate)
8+
79
---[[
810
local function print(...)
911
return game.player.print(...)
@@ -116,6 +118,7 @@ local function deduceSignalValue(entity)
116118
return v
117119
end
118120

121+
119122
function onSave()
120123
global.nixie_tubes={nixies=nixie_map, version=mod_version, data_version=mod_data_version}
121124
end
@@ -204,9 +207,7 @@ local function onRemoveEntity(entity)
204207
end
205208

206209
local function onTick(event)
207-
--only update five times a second, rather than *every* tick.
208-
--7th of 12 picked at random.
209-
if event.tick%12 == 7 then
210+
if event.tick%ticksPerRefresh == 0 then
210211
for y,row in pairs(nixie_map) do
211212
for x,desc in pairs(row) do
212213
if desc.entity.valid then
@@ -219,7 +220,14 @@ local function onTick(event)
219220
desc.has_power=true
220221
updateSprite(desc)
221222
end
222-
if not desc.slave then
223+
local open=false
224+
for k,v in pairs(game.players) do
225+
if v.opened==desc.entity then
226+
open=true
227+
break
228+
end
229+
end
230+
if not open and not desc.slave then
223231
local v=deduceSignalValue(desc.entity)
224232
local state="off"
225233
if v and desc.has_power then

info.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nixie-tubes",
3-
"version": "0.1.6",
3+
"version": "0.1.7",
44
"title": "Nixie Tubes",
55
"author": "GopherAtl",
66
"homepage": "http://google.com",

0 commit comments

Comments
 (0)