mirror of
https://github.com/minetest-mods/warps.git
synced 2024-11-13 13:50:19 +01:00
Warpstones.
This commit is contained in:
parent
ab19dcd381
commit
ba6ade74b3
6
README
6
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 <sofar@foo-projects.org>
|
||||
|
|
55
init.lua
55
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()
|
||||
|
||||
|
|
70
models/warps_warpstone.obj
Normal file
70
models/warps_warpstone.obj
Normal file
|
@ -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
|
BIN
textures/warps_warpstone.png
Normal file
BIN
textures/warps_warpstone.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
textures/warps_warpstone_guide.png
Normal file
BIN
textures/warps_warpstone_guide.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 348 B |
Loading…
Reference in New Issue
Block a user