forked from tacotexmex/telemosaic
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from mt-mods/rewrite
Rewrite and improvement
- Loading branch information
Showing
30 changed files
with
804 additions
and
729 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,22 @@ | ||
|
||
minetest.register_abm({ | ||
label = "Telemosaic beacon effect", | ||
nodenames = {"telemosaic:beacon"}, | ||
interval = 2.0, | ||
chance = 2, | ||
catch_up = false, | ||
action = function(pos, node, active_object_count, active_object_count_wider) | ||
minetest.add_particlespawner({ | ||
label = "Telemosaic beacon effect", | ||
nodenames = {"group:telemosaic_active"}, | ||
interval = 2.0, | ||
chance = 2, | ||
catch_up = false, | ||
action = function(pos) | ||
minetest.add_particlespawner({ | ||
amount = 4, | ||
time = 2, | ||
minpos = vector.add(pos, {x=-0.2, y=0, z=-0.2}), | ||
maxpos = vector.add(pos, {x=0.2, y=0, z=0.2}), | ||
minvel = {x=0, y=1, z=0}, | ||
maxvel = {x=0, y=2, z=0}, | ||
minacc = {x=0, y=0, z=0}, | ||
maxacc = {x=0, y=0, z=0}, | ||
minexptime = 1, | ||
maxexptime = 2, | ||
minsize = 1, | ||
maxsize = 1.7, | ||
collisiondetection = false, | ||
collision_removal = false, | ||
object_collision = false, | ||
vertical = false, | ||
texture = "telemosaic_particle_arrival.png", | ||
glow = 9 | ||
glow = 9 | ||
}) | ||
end | ||
end | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
|
||
for _,protected in pairs({true, false}) do | ||
|
||
local node_name_suffix = protected and "_protected" or "" | ||
local texture_overlay = protected and "^telemosaic_beacon_protected_overlay.png" or "" | ||
local description_prefix = protected and "Protected " or "" | ||
|
||
minetest.register_node("telemosaic:beacon_off"..node_name_suffix, { | ||
description = description_prefix.."Telemosaic Beacon", | ||
tiles = { | ||
"telemosaic_beacon_off.png"..texture_overlay, | ||
"telemosaic_beacon_side.png", | ||
}, | ||
paramtype = "light", | ||
groups = {cracky = 2, telemosaic = 1, telemosaic_off = 1}, | ||
on_rightclick = telemosaic.rightclick, | ||
digilines = telemosaic.digilines, | ||
}) | ||
|
||
minetest.register_node("telemosaic:beacon"..node_name_suffix, { | ||
description = description_prefix.."Telemosaic Beacon Active (you hacker you!)", | ||
tiles = { | ||
"telemosaic_beacon_top.png"..texture_overlay, | ||
"telemosaic_beacon_side.png", | ||
}, | ||
paramtype = "light", | ||
groups = {cracky = 2, not_in_creative_inventory = 1, telemosaic = 1, telemosaic_active = 1}, | ||
drop = "telemosaic:beacon_off"..node_name_suffix, | ||
on_rightclick = telemosaic.rightclick, | ||
digilines = telemosaic.digilines, | ||
}) | ||
|
||
minetest.register_node("telemosaic:beacon_err"..node_name_suffix, { | ||
description = description_prefix.."Telemosaic Beacon Error (you hacker you!)", | ||
tiles = { | ||
"telemosaic_beacon_err.png"..texture_overlay, | ||
"telemosaic_beacon_side.png", | ||
}, | ||
paramtype = "light", | ||
groups = {cracky = 2, not_in_creative_inventory = 1, telemosaic = 1, telemosaic_error = 1}, | ||
drop = "telemosaic:beacon_off"..node_name_suffix, | ||
on_rightclick = telemosaic.rightclick, | ||
digilines = telemosaic.digilines, | ||
}) | ||
|
||
minetest.register_node("telemosaic:beacon_disabled"..node_name_suffix, { | ||
description = description_prefix.."Telemosaic Beacon Disabled (you hacker you!)", | ||
tiles = { | ||
"telemosaic_beacon_disabled.png"..texture_overlay, | ||
"telemosaic_beacon_side.png", | ||
}, | ||
paramtype = "light", | ||
groups = {cracky = 2, not_in_creative_inventory = 1, telemosaic = 1, telemosaic_disabled = 1}, | ||
drop = "telemosaic:beacon_off"..node_name_suffix, | ||
on_rightclick = telemosaic.rightclick, | ||
digilines = telemosaic.digilines, | ||
}) | ||
end | ||
|
||
minetest.register_craft({ | ||
output = "telemosaic:beacon_off", | ||
recipe = { | ||
{"default:diamond", "doors:door_wood", "default:diamond"}, | ||
{"default:obsidian","default:obsidian","default:obsidian"} | ||
} | ||
}) | ||
|
||
minetest.register_craft({ | ||
output = "telemosaic:beacon_off_protected", | ||
type = "shapeless", | ||
recipe = {"telemosaic:beacon_off", "default:steel_ingot"} | ||
}) | ||
|
||
minetest.register_craft({ | ||
output = "telemosaic:beacon_off", | ||
type = "shapeless", | ||
recipe = {"telemosaic:beacon_off_protected"} | ||
}) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
|
||
local function digiline_receive(pos, _, channel, msg) | ||
local meta = minetest.get_meta(pos) | ||
|
||
local set_channel = meta:get("channel") or telemosaic.default_channel | ||
if channel ~= set_channel then | ||
return | ||
end | ||
|
||
if type(msg) == "string" then | ||
-- Convert string command to table | ||
if msg == "get" or msg == "GET" then | ||
msg = {command = "get"} | ||
|
||
elseif msg == "enable" or msg == "disable" then | ||
msg = {command = msg} | ||
|
||
elseif msg:match("^setchannel .+") then | ||
local c = string.split(msg, " ", true, 1) | ||
msg = {command = c[1], channel = c[2]} | ||
|
||
elseif msg:match("^setdest .+") then | ||
local c = string.split(msg, " ", true, 1) | ||
local p = string.split(c[2], ",") | ||
msg = {command = c[1], x = p[1], y = p[2], z = p[3]} | ||
end | ||
end | ||
|
||
if type(msg) ~= "table" or not msg.command then | ||
return | ||
end | ||
|
||
if msg.command == "get" then | ||
local dest = telemosaic.get_destination(pos) | ||
digilines.receptor_send(pos, digilines.rules.default, set_channel, { | ||
state = telemosaic.get_state(pos), | ||
origin = pos, | ||
target = dest, | ||
pos = pos, | ||
destination = dest, | ||
}) | ||
|
||
elseif msg.command == "setchannel" then | ||
if type(msg.channel) == "string" then | ||
meta:set_string("channel", msg.channel) | ||
end | ||
|
||
elseif msg.command == "enable" then | ||
if telemosaic.get_state(pos) == "disabled" then | ||
telemosaic.set_state(pos, "active") | ||
end | ||
|
||
elseif msg.command == "disable" then | ||
if telemosaic.get_state(pos) == "active" then | ||
telemosaic.set_state(pos, "disabled") | ||
end | ||
|
||
elseif msg.command == "setdest" then | ||
local dest = msg.pos or { | ||
x = msg.x, | ||
y = msg.y, | ||
z = msg.z | ||
} | ||
if type(dest) ~= "table" then | ||
return | ||
end | ||
dest.x = tonumber(dest.x) | ||
dest.y = tonumber(dest.y) | ||
dest.z = tonumber(dest.z) | ||
if dest.x and dest.y and dest.z then | ||
telemosaic.set_destination(pos, dest) | ||
end | ||
end | ||
end | ||
|
||
telemosaic.digilines = { | ||
effector = { | ||
action = digiline_receive | ||
} | ||
} |
Oops, something went wrong.