From ba6ade74b33ee092aec71a811f2b65af54af3b39 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Mon, 27 Apr 2015 22:08:26 -0700 Subject: [PATCH] Warpstones. --- README | 6 +++ init.lua | 55 ++++++++++++++++++++++- models/warps_warpstone.obj | 70 +++++++++++++++++++++++++++++ textures/warps_warpstone.png | Bin 0 -> 1808 bytes textures/warps_warpstone_guide.png | Bin 0 -> 348 bytes 5 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 models/warps_warpstone.obj create mode 100644 textures/warps_warpstone.png create mode 100644 textures/warps_warpstone_guide.png diff --git a/README b/README index edd968c..320175d 100644 --- a/README +++ b/README @@ -13,6 +13,12 @@ priv: warp_user - list, and use warps warps are stored in the world folder file "warps.txt". +A warpstone can be given or found in the creative inventory (item +id: warps:warpstone). This warpstone can be placed on the ground +and be programmed to warp players who punch it to a certain warp +location (one of the warps in /listwarps). Right-clicking the item +as a warp_admin user will allow you to program the warpstone. + ======== Copyright (C) 2015 - Auke Kok diff --git a/init.lua b/init.lua index ece4a75..a49fc12 100644 --- a/init.lua +++ b/init.lua @@ -34,7 +34,7 @@ local load = function () return end while true do - line = fh:read() + local line = fh:read() if line == nil then break end @@ -135,6 +135,59 @@ minetest.register_chatcommand("warp", { end }) +minetest.register_node("warps:warpstone", { + visual = "mesh", + mesh = "warps_warpstone.obj", + description = "A Warp Stone", + tiles = { "warps_warpstone.png" }, + drawtype = "mesh", + sunlight_propagates = true, + walkable = false, + paramtype = "light", + groups = { choppy=3 }, + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.5, 0.25} + }, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", + "field[destination;Warp Destination;]") + meta:set_string("Infotext", "Uninitialized Warp Stone") + end, + on_receive_fields = function(pos, formname, fields, sender) + if not minetest.check_player_privs(sender:get_player_name(), {warp_admin = true}) then + minetest.chat_send_player(sender:get_player_name(), "You do not have permission to modify warp stones") + return false + end + local meta = minetest.get_meta(pos) + meta:set_string("formspec", + "field[destination;Warp Destination;" .. fields.destination .. "]") + meta:set_string("warps_destination", fields.destination) + minetest.log("action", sender:get_player_name() .. " changed warp stone to \"" .. fields.destination .. "\"") + end, + on_punch = function(pos, node, puncher, pointed_thingo) + local meta = minetest.get_meta(pos) + local destination = meta:get_string("warps_destination") + if destination == "" then + return false, "Warp stone not initialized" + end + for i = 1,table.getn(warps) do + if warps[i].name == destination then + puncher:setpos({x = warps[i].x, y = warps[i].y, z = warps[i].z}) + puncher:set_look_yaw(warps[i].yaw) + puncher:set_look_pitch(warps[i].pitch) + minetest.log("action", puncher:get_player_name() .. " used a warp stone to \"" .. destination .. "\"") + minetest.chat_send_player(puncher:get_player_name(), "warped to \"" .. destination .. "\"") + return true, "Warped \"" .. puncher:get_player_name() .. "\" to \"" .. destination .. "\"" + end + end + minetest.chat_send_player(puncher:get_player_name(), "Unknown warp location for this warp stone, cannot warp!") + return false + + end, +}) + -- load existing warps load() diff --git a/models/warps_warpstone.obj b/models/warps_warpstone.obj new file mode 100644 index 0000000..5858c88 --- /dev/null +++ b/models/warps_warpstone.obj @@ -0,0 +1,70 @@ +# Blender v2.60 (sub 0) OBJ File: '' +# www.blender.org +mtllib warps_warpstone.mtl +o Plane +v 0.000345 -0.332211 0.238072 +v -0.238873 -0.332211 -0.000181 +v -0.187467 0.347788 0.000753 +v 0.003339 0.347788 0.186987 +v -0.000061 0.473738 -0.000013 +v -0.000061 -0.400212 -0.000013 +v 0.238345 -0.332211 0.000071 +v 0.187345 0.347788 -0.000779 +v -0.000467 -0.332211 -0.238097 +v -0.003461 0.347788 -0.187013 +vt 0.247005 0.000534 +vt 0.000000 0.000534 +vt 0.000000 0.499516 +vt 0.247005 0.499516 +vt 0.744000 0.749758 +vt 0.744000 0.501019 +vt 0.248498 0.501019 +vt 0.248498 0.749758 +vt 0.495503 0.000534 +vt 0.248498 0.000534 +vt 0.248498 0.499516 +vt 0.495503 0.499516 +vt 0.744000 1.000000 +vt 0.744000 0.751261 +vt 0.248498 0.751261 +vt 0.248498 1.000000 +vt 0.247005 1.000000 +vt 0.247005 0.752012 +vt 0.000746 1.000000 +vt 0.497742 0.249273 +vt 0.744000 0.001285 +vt 0.744000 0.249273 +vt 0.744000 0.251528 +vt 0.497742 0.499516 +vt 0.744000 0.499516 +vt 0.247005 0.749758 +vt 0.000746 0.749758 +vt 0.247005 0.501770 +vt 0.000000 0.751261 +vt 0.000000 0.999249 +vt 0.246259 0.751261 +vt 0.743254 0.000534 +vt 0.496995 0.248522 +vt 0.496995 0.000534 +vt 0.496995 0.250776 +vt 0.496995 0.498764 +vt 0.743254 0.250776 +vt 0.000000 0.501019 +vt 0.246259 0.501019 +vt 0.000000 0.749006 +g Plane_Plane_Material.001 +usemtl Material.001 +s off +f 2/1 1/2 4/3 3/4 +f 1/5 7/6 8/7 4/8 +f 7/9 9/10 10/11 8/12 +f 9/13 2/14 3/15 10/16 +s 1 +f 5/17 3/18 4/19 +f 1/20 2/21 6/22 +f 7/23 1/24 6/25 +f 5/26 4/27 8/28 +f 5/29 8/30 10/31 +f 9/32 7/33 6/34 +f 6/35 2/36 9/37 +f 5/38 10/39 3/40 diff --git a/textures/warps_warpstone.png b/textures/warps_warpstone.png new file mode 100644 index 0000000000000000000000000000000000000000..e172d1dc0ae3b7f6ecb3585b934805335e443e17 GIT binary patch literal 1808 zcmV+r2k-caP)~)Nhx4a* zYZh}xlnjc**62o~yQ(t%!RHT;FmZu+85t3o^oQU5vBrN=asUn3HZk;&iOC7Rg@>>x zog@^-F;OScOBAR=6PBE9E0S|2aa`%skNA^9@c%Hkck=-aQMHx+an#`y{I%y+BB& zEn11>)fuCLkEFgL7~R(rbI0QC^@dO>SY&O#qtl;#pR$9zE&> z-&V3YX$Q469VR?g&{m!W!Z26n#=wGUw$ger&WRpws>#d>0WJ8-qE{!9v+fxWHSBfhDNO zUe*p}hhvT_r&%h4J9=}_s>UkByj33I&Z=j^fZ9se21!nXYdcx{q(l2tg3=T%P6J9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