Skip to content

Commit

Permalink
Merge pull request #10 from mt-mods/rewrite
Browse files Browse the repository at this point in the history
Rewrite and improvement
  • Loading branch information
OgelGames committed Jun 22, 2021
2 parents 26355f1 + 6a11ad2 commit 31f7633
Show file tree
Hide file tree
Showing 30 changed files with 804 additions and 729 deletions.
107 changes: 32 additions & 75 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,99 +4,56 @@

A Minetest mod for user-generated teleportation pads.

Version: 0.5.0
![screenshot](screenshot.png?raw=true "screenshot")

License:
Code: LGPL 2.1 (see included LICENSE file)
Textures: CC-BY-SA (see http://creativecommons.org/licenses/by-sa/4.0/)
textures/telemosaic_beacon_protected_overlay.png MIT (https://notabug.org/TenPlus1/protector)
## Description

Report bugs or request help on the forum topic.
This is a mod for Minetest. It provides teleportation pads, called "beacons". Unlike other teleportation mods, no menus or GUIs are used; you set the destination with a simple "key" item. There is no tooltip for the destination either, so signs are recommended.

Description
-----------
Another difference is the limited default range of the beacons. To increase the range, you need to place "extenders" around the beacon. The extenders come in different colors, allowing the extenders to form a pretty pattern; hence the name "telemosaic".

This is a mod for MineTest. It provides teleportation pads, called
"beacons". Unlike other teleportation mods, no menus or GUIs are used;
you set the destination with a simple "key" item. There is no
tooltip for the destination either, so signs are recommended.
## Notes

Another difference is the limited default range of the beacons.
To increase the range, you need to place "extenders" around the beacon.
The extenders come in different colors, allowing the extenders to
form a pretty pattern; hence the name "telemosaic".
This is a maintained fork of https://github.com/bendeutsch/minetest-telemosaic with various improvements and changes, optimized for multiplayer environments.

Current behavior
----------------
* Beacons no longer teleport players automatically, they must be right-clicked by a player.
* More chat messages are sent to inform and help players with non-functional telemosaics.
* Telemosaic keys can be preserved by holding shift when right-clicking a beacon.
* Beacons can be enabled and disabled by punching them with a telemosaic key.
* If the `digilines` mod is installed, beacons can be controlled by digilines.
* and other small changes...

Beacons are created with 2 diamonds, 3 obsidian blocks, and a wooden
door: first row diamond, door, diamond; second row the obsidian blocks.
## Usage

Right-clicking a beacon with a default mese crystal fragment remembers
the position in the fragment, which turns into a telemosaic key.
Right-clicking a second beacon with the key sets up a teleportation
route from the second beacon to the first beacon. To set up a return
path, right-click the second beacon with the fragment, and the first
beacon with the resulting key again.
Right-clicking a beacon with a default mese crystal fragment creates a telemosaic key with the position of the beacon.

The beacons do not need to be strictly paired this way: rings or
star-shaped networks are also possible. Each beacon has only a
single destination, but can itself be the destination of several
others.
Right-clicking a second beacon with the key sets the destination of the second beacon to the position of the first beacon. To set up a return path, right-click the second beacon with the fragment, and then first beacon with the resulting key again.

Beacons will check that their destination is sane: the destination
still needs to be a beacon, and the two nodes above it should be
clear for walking / standing in. If your Minetest version supports
it, the beacon will emerge the area prior to checking and teleporting.
Emerging is merely a convenience, though.
The beacons do not need to be strictly paired this way: rings or star-shaped networks are also possible. Each beacon has only a single destination, but can itself be the destination of several others.

Beacons have a maximum range of 20 nodes. If the destination is
too far away, the beacon will turn red and will not function.
To extend the range for a beacon, place "extenders" next to it,
within a 7x7 horizontal square centered on the beacon.
Once linked, you teleport between beacons by right-clicking them. Before teleporting, beacons will check that their destination is sane: the destination still needs to be a beacon, and the two nodes above it should be clear for walking/standing in.

Extenders come in three tiers: tier 1 extends all affected beacons
by 5 nodes, tier 2 by 20 nodes, and tier 3 by 80 nodes. Placing
or digging extenders will update affected beacons.
Beacons have a default range of 20 nodes. If the destination is too far away, the beacon will turn red and will not function. To extend the range for a beacon, place "extenders" next to it, within a 7x7 horizontal square centered on the beacon, and at the same level or one node below the beacon.

Tier 1 extenders are crafted by placing an obsidian block, a wooden
door, and another obsidian block in a horizontal row. Tier 2 extenders
are crafted with an obsidian block in the middle, surrounded by a cross
of four tier 1 extenders. Tier 3 extenders are crafted with an obsidian
block surrounded by four tier 2 extenders.
Extenders come in three tiers, with each being more powerful than the tier below. By default, tier 1, tier 2, and tier 3 extenders increase the range of nearby beacons by 5, 20, and 80 nodes, respectively.

Extenders can be colored with any of the dyes found in the dye mod.
Colored extenders work just like regular extenders, both for
teleporting and for recipes. To "uncolor" an extender, dye it grey.
Extenders can be colored with any of the dyes found in the `dye` mod. Colored extenders work just like regular extenders, both for teleporting and for recipes.

Settings
------------
## Digilines

* `telemosaic_right_click_teleport` allow teleport on rightclick
When the `digilines` mod is installed, telemosaic beacons can be controlled by sending digiline messages. By default, all beacons use the channel "telemosaic", but you can change the channel name via digilines.

Future plans
------------
For full documentaion, see [digilines.md](digilines.md).

* Particle and sound effects
* Protected beacons (will not teleport if protected)
## Dependencies

Dependencies
------------
* default
* doors
* dye (optional)
* `default`
* `doors`
* `dye` (optional)
* `digilines` (optional)

Installation
------------
## License

Unzip the archive, rename the folder to to `bewarethedark` and
place it in minetest/mods/

( Linux: If you have a linux system-wide installation place
it in ~/.minetest/mods/. )

( If you only want this to be used in a single world, place
the folder in worldmods/ in your worlddirectory. )

For further information or help see:
http://wiki.minetest.com/wiki/Installing_Mods
* Code: LGPL 2.1 (see included LICENSE file)
* Textures: CC-BY-SA (see http://creativecommons.org/licenses/by-sa/4.0/)
* textures/telemosaic_beacon_protected_overlay.png MIT (https://notabug.org/TenPlus1/protector)
26 changes: 9 additions & 17 deletions abm.lua
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
})
78 changes: 78 additions & 0 deletions beacon.lua
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"}
})
46 changes: 0 additions & 46 deletions crafts.lua

This file was deleted.

4 changes: 0 additions & 4 deletions depends.txt

This file was deleted.

80 changes: 80 additions & 0 deletions digilines.lua
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
}
}
Loading

0 comments on commit 31f7633

Please sign in to comment.