-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 8558104
Showing
7 changed files
with
146 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: luacheck | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: apt | ||
run: sudo apt-get install -y luarocks | ||
- name: luacheck install | ||
run: luarocks install --local luacheck | ||
- name: luacheck run | ||
run: $HOME/.luarocks/bin/luacheck ./ |
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,19 @@ | ||
|
||
globals = { | ||
"freetouch" | ||
} | ||
|
||
read_globals = { | ||
-- Stdlib | ||
string = {fields = {"split"}}, | ||
table = {fields = {"copy", "getn"}}, | ||
|
||
-- Minetest | ||
"vector", "ItemStack", | ||
"dump", "VoxelArea", | ||
|
||
-- deps | ||
"mesecon", | ||
"digilines", | ||
"minetest" | ||
} |
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 FORMSPEC_NAME = "freetouch_edit" | ||
|
||
minetest.register_node("freetouch:freetouch", { | ||
description = "Formspec touch node", | ||
groups = {cracky=3}, | ||
on_construct = function(pos) | ||
local meta = minetest.get_meta(pos) | ||
meta:set_string("channel", "freetouch") | ||
meta:set_string("formspec", "size[10,8]") | ||
end, | ||
drawtype = "nodebox", | ||
tiles = { | ||
"freetouch_back.png", | ||
"freetouch_back.png", | ||
"freetouch_back.png", | ||
"freetouch_back.png", | ||
"freetouch_back.png", | ||
"freetouch_front.png" | ||
}, | ||
paramtype = "light", | ||
paramtype2 = "facedir", | ||
node_box = { | ||
type = "fixed", | ||
fixed = { | ||
{ -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 } | ||
} | ||
}, | ||
on_punch = function(pos, _, player) | ||
local meta = minetest.get_meta(pos) | ||
local fs = meta:get_string("formspec") | ||
|
||
local playername = player:get_player_name() | ||
|
||
local has_freetouch_priv = minetest.check_player_privs(playername, "freetouch") | ||
if minetest.is_protected(pos, playername) or not has_freetouch_priv then | ||
return | ||
end | ||
|
||
local formspec = "size[12,10;]" .. | ||
"textarea[0.2,0;12,10;fs;Formspec;" .. minetest.formspec_escape(fs) .. "]" .. | ||
"button_exit[0,9;6,1;remove;Remove]" .. | ||
"button_exit[6,9;6,1;save;Save]" .. | ||
"" | ||
|
||
minetest.show_formspec(playername, | ||
FORMSPEC_NAME .. ";" .. minetest.pos_to_string(pos), | ||
formspec | ||
) | ||
|
||
end, | ||
on_receive_fields = function(pos, _, fields, sender) | ||
local meta = minetest.get_meta(pos) | ||
local channel = meta:get_string("channel") | ||
print(channel) | ||
digilines.receptor_send(pos, digilines.rules.default, channel, { | ||
fields = fields, | ||
pos = pos, | ||
playername = sender:get_player_name() | ||
}) | ||
end, | ||
digiline = { | ||
receptor = {} | ||
}, | ||
}) | ||
|
||
minetest.register_on_player_receive_fields(function(player, formname, fields) | ||
local parts = formname:split(";") | ||
local name = parts[1] | ||
if name ~= FORMSPEC_NAME then | ||
return | ||
end | ||
|
||
local pos = minetest.string_to_pos(parts[2]) | ||
local playername = player:get_player_name() | ||
|
||
local has_freetouch_priv = minetest.check_player_privs(playername, "freetouch") | ||
|
||
if minetest.is_protected(pos, playername) or not has_freetouch_priv then | ||
return | ||
end | ||
|
||
if fields.save then | ||
local meta = minetest.get_meta(pos) | ||
meta:set_string("formspec", fields.fs) | ||
end | ||
|
||
if fields.remove then | ||
minetest.set_node(pos, { name = "air" }) | ||
end | ||
end) | ||
|
||
minetest.register_privilege("freetouch", { | ||
description = "can edit freetouch formspecs", | ||
give_to_singleplayer = true | ||
}) |
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,2 @@ | ||
name = freetouch | ||
depends = digilines |
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,13 @@ | ||
|
||
Freely editable formspec node | ||
|
||
# License | ||
|
||
## Code | ||
|
||
MIT | ||
|
||
## Textures | ||
|
||
CC BY-SA 3.0 | ||
* `textures/*` https://cheapiesystems.com/git/digistuff |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.