This repository was archived by the owner on Apr 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b66be97
commit 1b7ac0d
Showing
6 changed files
with
106 additions
and
0 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
Empty file.
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 @@ | ||
default |
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,9 @@ | ||
|
||
tileserver = { | ||
} | ||
|
||
local MP = minetest.get_modpath("tileserver") | ||
|
||
dofile(MP.."/poi.lua") | ||
|
||
print("[OK] Tileserver") |
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,95 @@ | ||
|
||
local update_formspec = function(meta) | ||
local inv = meta:get_inventory() | ||
|
||
local active = meta:get_int("active") == 1 | ||
local state = "Inactive" | ||
|
||
if active then | ||
state = "Active" | ||
end | ||
|
||
local name = meta:get_string("name") | ||
local category = meta:get_string("category") | ||
meta:set_string("infotext", "POI: " .. name .. ", " .. category .. " (" .. state .. ")") | ||
|
||
meta:set_string("formspec", "size[8,3;]" .. | ||
-- col 1 | ||
"field[0,1;4,1;name;Name;" .. name .. "]" .. | ||
"button_exit[4,1;4,1;save;Save]" .. | ||
|
||
-- col 2 | ||
"field[0,2.5;4,1;category;Category;" .. category .. "]" .. | ||
"button_exit[4,2;4,1;toggle;Toggle]" .. | ||
"") | ||
|
||
end | ||
|
||
|
||
minetest.register_node("tileserver:poi", { | ||
description = "Tileserver POI", | ||
tiles = { | ||
"tileserver_poi.png", | ||
"tileserver_poi.png", | ||
"tileserver_poi.png", | ||
"tileserver_poi.png", | ||
"tileserver_poi.png", | ||
"tileserver_poi.png" | ||
}, | ||
groups = {cracky=3,oddly_breakable_by_hand=3}, | ||
sounds = default.node_sound_glass_defaults(), | ||
|
||
can_dig = function(pos, player) | ||
local meta = minetest.env:get_meta(pos) | ||
local owner = meta:get_string("owner") | ||
|
||
return player and player:get_player_name() == owner | ||
end, | ||
|
||
after_place_node = function(pos, placer) | ||
local meta = minetest.get_meta(pos) | ||
meta:set_string("owner", placer:get_player_name() or "") | ||
end, | ||
|
||
on_construct = function(pos) | ||
local meta = minetest.get_meta(pos) | ||
|
||
meta:set_string("name", "<unconfigured>") | ||
meta:set_string("category", "main") | ||
meta:set_int("active", 0) | ||
|
||
update_formspec(meta) | ||
end, | ||
|
||
on_receive_fields = function(pos, formname, fields, sender) | ||
local meta = minetest.get_meta(pos) | ||
local playername = sender:get_player_name() | ||
|
||
if playername == meta:get_string("owner") then | ||
-- owner | ||
if fields.save then | ||
|
||
local name = fields.name | ||
meta:set_string("name", fields.name) | ||
|
||
|
||
end | ||
|
||
if fields.toggle then | ||
if meta:get_int("active") == 1 then | ||
meta:set_int("active", 0) | ||
else | ||
meta:set_int("active", 1) | ||
end | ||
end | ||
|
||
else | ||
-- non-owner | ||
end | ||
|
||
|
||
update_formspec(meta) | ||
end | ||
|
||
|
||
}) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.