Compare commits

...

5 Commits

Author SHA1 Message Date
Juraj Vajda 2035a416d3 cleanup and compress images 2018-02-10 16:50:43 -05:00
Juraj Vajda 2005611d5c disable node placement on rightclick beacon 2018-02-10 16:25:54 -05:00
Juraj Vajda 477bdd574f added key position in the description and better form protection 2018-01-25 20:59:37 -05:00
Juraj Vajda bca466a3c4 readme updates 2018-01-24 00:26:31 -05:00
Juraj Vajda ea478aa37c readme update 2018-01-23 23:17:37 -05:00
13 changed files with 64 additions and 82 deletions

View File

@ -1,9 +1,11 @@
Telemosaic [telemosaic]
Telemosaic by SaKeL [telemosaic]
=======================
A Minetest mod for user-generated teleportation pads.
Version: 0.5.0
Fork from: https://github.com/bendeutsch/minetest-telemosaic
Rewritten from scratch by SaKeL
License:
Code: LGPL 2.1 (see included LICENSE file)
@ -11,85 +13,61 @@ License:
Report bugs or request help on the forum topic.
![screenshot](screenshot.png)
Description
-----------
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.
This is a mod for MineTest. It provides teleportation pads, called"beacons". The menus and GUIs are included, you set the destination with a simple "key" item. There is GUI for the destination but you can also use signs.
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".
Another difference is the limited default range of the beacons. By default the beacons have no range. To increase the range, you need to place "extenders" around the beacon. The extenders come in different tiers, allowing the extenders to form a pretty pattern; hence the name "telemosaic".
Current behavior
----------------
Beacons are created with 2 diamonds, 3 obsidian blocks, and a wooden
door: first row diamond, door, diamond; second row the obsidian blocks.
Beacons are created with 2 diamonds, 3 obsidian blocks, and a wooden door: first row diamond, door, diamond; second row the obsidian blocks.
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 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 first beacon to the second beacon. To set up a return path, right-click the second beacon with the fragment, and the first beacon with the resulting key again.
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.
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 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.
Beacons will check that their destination is sane: the destinations 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.
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.
If the beacon destination is too far away, the beacon will let you know in chat message how many nodes you are passed from the departure power/range. To extend the range for a beacon, place "extenders" next to it, within a 7x7 horizontal square centered on the beacon. The extenders have to have air/empty space above them otherwise they will not function.
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.
Extenders come in three tiers: tier 1 extends all affected beacons by 10 nodes, tier 2 by 30 nodes, and tier 3 by 90 nodes. Placing or digging extenders will update affected beacons.
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.
Tier 1 extenders are crafted by placing an obsidian block, a wooden door, and another obsidian block in a horizontal row with a diamond above the door in first 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 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.
Protected beacons cannot be configured nor teleported from. You have to protect your beacons and extenders, by default they are not protected.
- beacons have no power by default - you need to use extenders to get some range
- destination beacon can be without the power (if it's destination) - to teleport somewhere you need power / extenders
- no dye coloring but new Minetest like textures (with light in dark based on the tier)
- protected beacons cannot be configured nor teleport from
- GUI, formspecs and info tooltips included due to complexity of the travel net - very helpful
- telemosaic key will not turn in to mese shard when destination too far - instead it will let you know how many blocks you are too far, you can move it closer and use the telemosaic key again
- recipe for extender tier 1 needs diamond
- extenders ranges are 10, 30 90 (tier 1, 2, 3) - there are no settings for changing this atm
- when teleport in progress you can't move for 5 seconds else teleport will be cancelled (idea from warps)
- extenders need to have a free block of space / air above them else they will not work
- you can add names and/or rename destinations
- after adding new name or removing beacons all destinations are updated respectively
- adding or removing extenders will updated all beacons in range respectively
Future plans
------------
* Particle and sound effects
* Protected beacons (will not teleport if protected)
* When beacon have maximum power/range add field for item with which other players can pay to use the teleporter
* Implement shared protection from protector redo mod (or other mods)
Dependencies
------------
* default
* doors
* dye (optional)
Installation
------------
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
see: http://wiki.minetest.com/wiki/Installing_Mods

Binary file not shown.

56
api.lua
View File

@ -34,9 +34,9 @@ local enable_particles = minetest.settings:get_bool("enable_particles")
telemosaic = {}
-- @field extender_ranges
telemosaic.extender_ranges = {
["telemosaic:extender_one"] = 5,
["telemosaic:extender_two"] = 20,
["telemosaic:extender_three"] = 80
["telemosaic:extender_one"] = 10,
["telemosaic:extender_two"] = 30,
["telemosaic:extender_three"] = 90
}
-- @field strengths
telemosaic.strengths = { "one", "two", "three" }
@ -73,7 +73,7 @@ function telemosaic.effect_arrival(pos)
max_hear_distance = 8,
gain = 1
})
if not enable_particles then return end
minetest.add_particlespawner({
@ -132,7 +132,7 @@ function telemosaic.from_queue()
end
local time = minetest.get_us_time()
for k, v in pairs(telemosaic.teleport_queue) do
if v.player:getpos() then
if vector.equals(v.player:getpos(), v.ppos) then
@ -151,7 +151,7 @@ function telemosaic.from_queue()
end
end
end
if telemosaic.get_table_length(telemosaic.teleport_queue) == 0 then
return
end
@ -175,7 +175,7 @@ function telemosaic.get_formspec(pos, table)
if not bname or bname == "" then
bname = "beacon at: "..minetest.pos_to_string(pos)
end
local textlist = ""
for ipos, ival in pairs(arrivals_tbl) do
textlist = textlist..minetest.formspec_escape(ipos)..": "..minetest.formspec_escape(ival)..","
@ -197,7 +197,7 @@ function telemosaic.get_formspec(pos, table)
default.gui_bg_img..
default.gui_slots..
"label[0,0.5;beacon position: "..minetest.pos_to_string(pos).."]"..
"label[0,1;destinaton: "..pos2_colorize.."]"..
"label[0,1;destination: "..pos2_colorize.."]"..
"label[0,1.5;range: "..range.." blocks]"..
"field[0.34,2.7;4,1;bname;beacon name:;"..bname.."]"..
button_teleport..
@ -214,13 +214,19 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
local mod_pos_pos2 = formname:split(":")
if mod_pos_pos2[1] == "telemosaic" then
local pos = minetest.string_to_pos(mod_pos_pos2[2])
if minetest.is_protected(pos, player:get_player_name()) then
minetest.chat_send_player(player:get_player_name(), "You cannot use protected beacon!")
return
end
-- beacon name change
if fields.bname then
local bname = fields.bname
local pos = minetest.string_to_pos(mod_pos_pos2[2])
local meta = minetest.get_meta(pos)
local pos2 = minetest.string_to_pos(mod_pos_pos2[3])
meta:set_string("bname", bname)
if pos2 then
@ -241,11 +247,6 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
local range = meta:get_int("range")
local pos2 = minetest.string_to_pos(mod_pos_pos2[3])
if minetest.is_protected(pos, player:get_player_name()) then
minetest.chat_send_player(player:get_player_name(), "You cannot teleport from protected beacon!")
return
end
if pos2 then
if math.floor(vector.distance(pos, pos2)) <= range then
for i = 1, 2 do
@ -264,9 +265,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
end)
--
--
-- extenders
--
--
--- Minetest "after_place_node" function
-- @see https://github.com/minetest/minetest/blob/master/doc/lua_api.txt
@ -336,9 +337,9 @@ function telemosaic.extender_on_destruct(pos)
end
end
--
--
-- beacons
--
--
--- Finds extenders in the area under air, counts the range based on the found extenders power/strength
-- @param {table} be_pos - beacon position as a center point from where extenders will be searched
@ -379,7 +380,7 @@ function telemosaic.set_status(pos)
state ~= "err" then
minetest.swap_node(pos, { name = "telemosaic:beacon_err" })
meta:set_string("state", "err")
-- configured beacon (off)
elseif range > 0 and
pos2 == "not configured" and
@ -417,7 +418,7 @@ function telemosaic.beacon_after_place(pos, placer, itemstack, pointed_thing)
meta:set_string("dest_pos", "not configured")
meta:set_string("arrivals_tbl", "{}")
meta:set_string("infotext", description.."\nowner: "..playername.."\nrange: "..range.." blocks\nright-click for more info")
telemosaic.set_status(pos)
end
@ -438,10 +439,12 @@ function telemosaic.beacon_rightclick(pos, node, clicker, itemstack, pointed_thi
-- departure
if stackname == "default:mese_crystal_fragment" and itemstack:get_count() == 1 then
itemstack:replace("telemosaic:key")
local item_description = minetest.registered_items[itemstack:get_name()]["description"]
-- remember departure position in the item meta
meta_stack:set_string("dep_pos", minetest.pos_to_string(pos))
meta_stack:set_string("description", item_description.."\nsaved position: "..minetest.pos_to_string(pos))
meta:set_string("infotext", description.."\nowner: "..ownername.."\nrange: "..range.." blocks\nright-click for more info")
@ -450,6 +453,7 @@ function telemosaic.beacon_rightclick(pos, node, clicker, itemstack, pointed_thi
-- get deprature position from item meta
local pos_stack = meta_stack:get_string("dep_pos")
pos_stack = minetest.string_to_pos(pos_stack)
if not pos_stack then return end
local meta2 = minetest.get_meta(pos_stack)
local range2 = meta2:get_int("range")
@ -507,8 +511,8 @@ function telemosaic.beacon_rightclick(pos, node, clicker, itemstack, pointed_thi
telemosaic.set_status(pos_stack)
-- default place_node callback
elseif itemstack:get_definition().type == "node" then
itemstack = minetest.item_place_node(itemstack, clicker, pointed_thing)
-- elseif itemstack:get_definition().type == "node" then
-- itemstack = minetest.item_place_node(itemstack, clicker, pointed_thing)
else
-- mod : pos : pos2
-- - pos2 is from itemstack so not always set, else "not configured"
@ -539,13 +543,13 @@ function telemosaic.beacon_on_destruct(pos)
local arrivals_tbl2 = meta2:get_string("arrivals_tbl")
arrivals_tbl2 = minetest.deserialize(arrivals_tbl2)
if not arrivals_tbl2 then arrivals_tbl2 = {} end
if arrivals_tbl2[minetest.pos_to_string(pos)] then
arrivals_tbl2[minetest.pos_to_string(pos)] = nil
arrivals_tbl2 = minetest.serialize(arrivals_tbl2)
meta2:set_string("arrivals_tbl", arrivals_tbl2)
end
meta2:set_string("dest_pos", "not configured")
telemosaic.set_status(pos2)
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 404 KiB

After

Width:  |  Height:  |  Size: 327 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 460 B

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 596 B

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 B

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 B

After

Width:  |  Height:  |  Size: 350 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 365 B

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 376 B

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 373 B

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 322 B

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 B

After

Width:  |  Height:  |  Size: 124 B