Compare commits
11 Commits
20200603-1
...
master
Author | SHA1 | Date |
---|---|---|
Luke aka SwissalpS | 528d8b7a58 | |
Niklp | 0f0f74a3e5 | |
Niklp | 0cc8f9e7a4 | |
Niklp | 4732886317 | |
Vanessa Dannenberg | 2bf2651cee | |
Buckaroo Banzai | aafa748f92 | |
Vanessa Dannenberg | 39f571f788 | |
Sys Quatre | 108f0dad1a | |
Vanessa Dannenberg | 63de1f5ab5 | |
Vanessa Dannenberg | 642aec419a | |
OgelGames | caf6e24d04 |
|
@ -0,0 +1,10 @@
|
|||
name: luacheck
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: Roang-zero1/factorio-mod-luacheck@master
|
||||
with:
|
||||
luacheckrc_url: ""
|
|
@ -0,0 +1,11 @@
|
|||
unused_args = false
|
||||
|
||||
read_globals = {
|
||||
table = {fields = {"copy"}},
|
||||
"minetest",
|
||||
"digilines"
|
||||
}
|
||||
|
||||
globals = {
|
||||
"led_marquee"
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
default
|
||||
digilines
|
||||
mesecons_luacontroller
|
||||
mesecons_microcontroller?
|
||||
mesecons_lamp?
|
|
@ -1 +0,0 @@
|
|||
This mod provides a simple LED marquee that accepts single characters, strings, and special control words via digilines.
|
50
init.lua
50
init.lua
|
@ -4,18 +4,15 @@
|
|||
led_marquee = {}
|
||||
led_marquee.scheduled_messages = {}
|
||||
|
||||
-- settings
|
||||
led_marquee.message_minimum_time = tonumber(minetest.settings:get("led_marquee_message_minimum_time")) or 0.5
|
||||
|
||||
led_marquee.message_schedule_dtime = tonumber(minetest.settings:get("led_marquee_message_schedule_dtime")) or 0.2
|
||||
led_marquee.message_schedule_size = tonumber(minetest.settings:get("led_marquee_message_schedule_size")) or 10
|
||||
|
||||
led_marquee.relay_timer = 0
|
||||
|
||||
local S
|
||||
if minetest.get_modpath("intllib") then
|
||||
S = intllib.make_gettext_pair()
|
||||
else
|
||||
S = function(s) return s end
|
||||
end
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
local FS = function(...) return minetest.formspec_escape(S(...)) end
|
||||
|
||||
local color_to_char = {
|
||||
"0",
|
||||
|
@ -103,24 +100,15 @@ local char_to_color = {
|
|||
-- the following functions based on the so-named ones in Jeija's digilines mod
|
||||
|
||||
local reset_meta = function(pos)
|
||||
minetest.get_meta(pos):set_string("formspec", "field[channel;Channel;${channel}]")
|
||||
end
|
||||
|
||||
local on_digiline_receive_std = function(pos, node, channel, msg)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local setchan = meta:get_string("channel")
|
||||
if setchan ~= channel then return end
|
||||
local num = tonumber(msg)
|
||||
if msg == "colon" or msg == "period" or msg == "off" or (num and (num >= 0 and num <= 9)) then
|
||||
minetest.swap_node(pos, { name = "led_marquee:marquee_"..msg, param2 = node.param2})
|
||||
end
|
||||
minetest.get_meta(pos):set_string("formspec",
|
||||
"formspec_version[4]"..
|
||||
"size[8,4]"..
|
||||
"button_exit[3,2.5;2,0.5;proceed;"..FS("Proceed").."]"..
|
||||
"field[1.75,1.5;4.5,0.5;channel;"..FS("Channel")..";${channel}]"
|
||||
)
|
||||
end
|
||||
|
||||
-- convert Lua's idea of a UTF-8 char to ISO-8859-1
|
||||
|
||||
-- first char is non-break space, 0xA0
|
||||
local iso_chars=" ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"
|
||||
|
||||
local get_iso = function(c)
|
||||
local hb = string.byte(c,1) or 0
|
||||
local lb = string.byte(c,2) or 0
|
||||
|
@ -360,17 +348,18 @@ local on_digiline_receive_string = function(pos, node, channel, msg)
|
|||
led_marquee.set_timer(pos, 0)
|
||||
return
|
||||
elseif string.sub(msg, 1, 12) == "scroll_speed" then
|
||||
local timeout = tonumber(string.sub(msg, 13))
|
||||
local timeout = tonumber(string.sub(msg, 13)) or 0
|
||||
led_marquee.set_timer(pos, math.max(timeout, led_marquee.message_minimum_time))
|
||||
elseif string.sub(msg, 1, 11) == "scroll_step" then
|
||||
local skip = tonumber(string.sub(msg, 12))
|
||||
led_marquee.scroll_text(pos, nil, skip)
|
||||
elseif msg == "get" then -- get the master panel's displayed char as ASCII numerical value
|
||||
digilines.receptor_send(pos, digiline.rules.default, channel, tonumber(string.match(minetest.get_node(pos).name,"led_marquee:char_(.+)"))) -- wonderfully horrible string manipulaiton
|
||||
digilines.receptor_send(pos, digilines.rules.default, channel,
|
||||
tonumber(string.match(minetest.get_node(pos).name,"led_marquee:char_(.+)")))
|
||||
elseif msg == "getstr" then -- get the last stored message
|
||||
digilines.receptor_send(pos, digiline.rules.default, channel, meta:get_string("last_msg"))
|
||||
digilines.receptor_send(pos, digilines.rules.default, channel, meta:get_string("last_msg"))
|
||||
elseif msg == "getindex" then -- get the scroll index
|
||||
digilines.receptor_send(pos, digiline.rules.default, channel, meta:get_int("index"))
|
||||
digilines.receptor_send(pos, digilines.rules.default, channel, meta:get_int("index"))
|
||||
else
|
||||
msg = string.gsub(msg, "//", string.char(30))
|
||||
led_marquee.set_timer(pos, 0)
|
||||
|
@ -383,7 +372,7 @@ local on_digiline_receive_string = function(pos, node, channel, msg)
|
|||
end
|
||||
else
|
||||
local asc = string.byte(msg)
|
||||
if asc > 29 and asc < 256 then
|
||||
if asc > 30 and asc < 256 then
|
||||
minetest.swap_node(pos, { name = "led_marquee:char_"..asc, param2 = fdir + (last_color*8)})
|
||||
meta:set_string("last_msg", tostring(msg))
|
||||
meta:set_int("index", 1)
|
||||
|
@ -400,8 +389,8 @@ end
|
|||
|
||||
for i = 31, 255 do
|
||||
local groups = { cracky = 2, not_in_creative_inventory = 1}
|
||||
local light = LIGHT_MAX-2
|
||||
local description = S("LED marquee panel ("..i..")")
|
||||
local light = minetest.LIGHT_MAX-2
|
||||
local description = S("LED marquee panel (@1)", i)
|
||||
local leds = "led_marquee_char_"..i..".png^[mask:led_marquee_leds_on.png"
|
||||
|
||||
if i == 31 then
|
||||
|
@ -430,9 +419,10 @@ for i = 31, 255 do
|
|||
},
|
||||
overlay_tiles = { "", leds },
|
||||
inventory_image = wimage,
|
||||
is_ground_content = false,
|
||||
wield_image = wimage,
|
||||
palette="led_marquee_palette.png",
|
||||
use_texture_alpha = true,
|
||||
use_texture_alpha = "blend",
|
||||
groups = groups,
|
||||
paramtype = "light",
|
||||
paramtype2 = "colorwallmounted",
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# textdomain: led_marquee
|
||||
LED marquee panel (@1)=LED-Anzeigetafel (@1)
|
||||
LED marquee panel=LED-Anzeigetafel
|
||||
Proceed=Fortsetzen
|
||||
Channel=Kanal
|
|
@ -0,0 +1,5 @@
|
|||
# textdomain: led_marquee
|
||||
LED marquee panel (@1)=
|
||||
LED marquee panel=
|
||||
Proceed=
|
||||
Channel=
|
4
mod.conf
4
mod.conf
|
@ -1,2 +1,6 @@
|
|||
name = led_marquee
|
||||
title = LED marquee
|
||||
description = This mod provides a simple LED marquee that accepts single characters, strings, and special control words via digilines.
|
||||
depends = default, digilines
|
||||
optional_depends = mesecons_luacontroller, mesecons_microcontroller, mesecons_lamp
|
||||
min_minetest_version = 5.2.0
|
||||
|
|
Before Width: | Height: | Size: 649 KiB After Width: | Height: | Size: 649 KiB |
Binary file not shown.
Before Width: | Height: | Size: 649 KiB |
|
@ -0,0 +1,8 @@
|
|||
# Minimal marquee interval
|
||||
led_marquee_message_minimum_time (Minimal marquee interval) float 0.5
|
||||
|
||||
# Marquee globalstep update interval
|
||||
led_marquee_message_schedule_dtime (Marquee globalstep update interval) float 0.2
|
||||
|
||||
# Global message queue size
|
||||
led_marquee_message_schedule_size (Global message queue size) int 10
|
Loading…
Reference in New Issue