initial upload

master
NathanSalapat 2015-08-12 15:21:14 -05:00
commit 825c692428
1398 changed files with 52705 additions and 0 deletions

21
LICENSE.md Normal file
View File

@ -0,0 +1,21 @@
License of source code
----------------------
For the default mods:
© 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
See README.txt in each mod directory for information about other authors.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

17
README.md Normal file
View File

@ -0,0 +1,17 @@
Survive!
==========================================================
~ ~
~ You find yourself suddenly thrown into ~
~ a strange cubic world, and you must rely ~
~ on your wits and what resources you can ~
~ find and harvest. Eating and drinking are ~
~ important, without food or water you will ~
~ find yourself losing health and won't last ~
~ very long. Be Careful, not all foods are ~
~ safe to eat, some can cause sickness or ~
~ even death. Make yourself a weapon, find ~
~ shelter and prepare to survive. ~
~ ~
==========================================================
Please Note, this game is heavily under development and has many bugs and unfinished parts of code. Play at your own risk. Also there could be some game breaking changes in the future, though I'll try and use ABMs to change things so if you keep up to date and update regularly problems should take care of themselves.

14
changelog.txt Normal file
View File

@ -0,0 +1,14 @@
2015-08-12:
Well bottoms are now placable on any nodes that belong to the soil group, code also got a huge cleanup from that change.
Smokers are still very hacky, use at your own risk, they don't smoke anything yet, so there really is no point to use them.
2015-08-10:
Put code on github.
2015-08-01:
Added inventory image for smoker.
Created active smoker node, started working on coding.
2015-07-31:
Fixed bug in trail code, it now functions properly for grasses and soils.
Added mesh and texture for the smoker, no coding yet.

1
game.conf Normal file
View File

@ -0,0 +1 @@
name = Survive!

BIN
menu/header.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
menu/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

18
mods/beds/Changelog.txt Normal file
View File

@ -0,0 +1,18 @@
1.0.1 beta
----------
- Add backwards compatibility with PilzAdam's beds mod
- Fix placement
- Fix small bugs
- Prevent possible crash
1.1
---
- Add fancy bed model (based on jp's model)
- Add API to register beds
- Allow players always to detach from bed (by donat-b)
- If more than 50% of players want sleep they can skip the night
- Don't show sleep dialog in singleplayer
1.1.1
-----
- Prevent possbile crash by trying to reposition leaving players

29
mods/beds/README.txt Normal file
View File

@ -0,0 +1,29 @@
Minetest mod "Beds"
===================
by BlockMen (c) 2014-2015
Version: 1.1.1
About
~~~~~
This mod adds a bed to Minetest which allows to skip the night. To sleep rightclick the bed, if playing
in singleplayer mode the night gets skipped imideatly. If playing on server you get shown how many other
players are in bed too. If all players are sleeping the night gets skipped aswell. Also the night skip can be forced
if more than 50% of the players are lying in bed and use this option.
Another feature is a controled respawning. If you have slept in bed (not just lying in it) your respawn point
is set to the beds location and you will respawn there after death.
You can disable the respawn at beds by setting "enable_bed_respawn = false" in minetest.conf
License of source code, textures: WTFPL
---------------------------------------
(c) Copyright BlockMen (2014-2015)
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details.

111
mods/beds/api.lua Normal file
View File

@ -0,0 +1,111 @@
function beds.register_bed(name, def)
minetest.register_node(name .. "_bottom", {
description = def.description,
inventory_image = def.inventory_image,
wield_image = def.wield_image,
drawtype = "nodebox",
tiles = def.tiles.bottom,
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
stack_max = 1,
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1},
sounds = default.node_sound_wood_defaults(),
node_box = {
type = "fixed",
fixed = def.nodebox.bottom,
},
selection_box = {
type = "fixed",
fixed = def.selectionbox,
},
after_place_node = function(pos, placer, itemstack)
local n = minetest.get_node_or_nil(pos)
if not n or not n.param2 then
minetest.remove_node(pos)
return true
end
local dir = minetest.facedir_to_dir(n.param2)
local p = vector.add(pos, dir)
local n2 = minetest.get_node_or_nil(p)
local def = n2 and minetest.registered_items[n2.name]
if not def or not def.buildable_to then
minetest.remove_node(pos)
return true
end
minetest.set_node(p, {name = n.name:gsub("%_bottom", "_top"), param2 = n.param2})
return false
end,
on_destruct = function(pos)
local n = minetest.get_node_or_nil(pos)
if not n then return end
local dir = minetest.facedir_to_dir(n.param2)
local p = vector.add(pos, dir)
local n2 = minetest.get_node(p)
if minetest.get_item_group(n2.name, "bed") == 2 and n.param2 == n2.param2 then
minetest.remove_node(p)
end
end,
on_rightclick = function(pos, node, clicker)
beds.on_rightclick(pos, clicker)
end,
on_rotate = function(pos, node, user, mode, new_param2)
local dir = minetest.facedir_to_dir(node.param2)
local p = vector.add(pos, dir)
local node2 = minetest.get_node_or_nil(p)
if not node2 or not minetest.get_item_group(node2.name, "bed") == 2 or
not node.param2 == node2.param2 then
return false
end
if minetest.is_protected(p, user:get_player_name()) then
minetest.record_protection_violation(p, user:get_player_name())
return false
end
if mode ~= screwdriver.ROTATE_FACE then
return false
end
local newp = vector.add(pos, minetest.facedir_to_dir(new_param2))
local node3 = minetest.get_node_or_nil(newp)
local def = node3 and minetest.registered_nodes[node3.name]
if not def or not def.buildable_to then
return false
end
if minetest.is_protected(newp, user:get_player_name()) then
minetest.record_protection_violation(newp, user:get_player_name())
return false
end
node.param2 = new_param2
minetest.swap_node(pos, node)
minetest.remove_node(p)
minetest.set_node(newp, {name = node.name:gsub("%_bottom", "_top"), param2 = new_param2})
return true
end,
})
minetest.register_node(name .. "_top", {
drawtype = "nodebox",
tiles = def.tiles.top,
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2},
sounds = default.node_sound_wood_defaults(),
node_box = {
type = "fixed",
fixed = def.nodebox.top,
},
selection_box = {
type = "fixed",
fixed = {0, 0, 0, 0, 0, 0},
},
})
minetest.register_alias(name, name .. "_bottom")
-- register recipe
minetest.register_craft({
output = name,
recipe = def.recipe
})
end

88
mods/beds/beds.lua Normal file
View File

@ -0,0 +1,88 @@
-- fancy shaped bed
beds.register_bed("beds:fancy_bed", {
description = "Fancy Bed",
inventory_image = "beds_bed_fancy.png",
wield_image = "beds_bed_fancy.png",
tiles = {
bottom = {
"beds_bed_top1.png",
"default_wood.png",
"beds_bed_side1.png",
"beds_bed_side1.png^[transformFX",
"default_wood.png",
"beds_bed_foot.png",
},
top = {
"beds_bed_top2.png",
"default_wood.png",
"beds_bed_side2.png",
"beds_bed_side2.png^[transformFX",
"beds_bed_head.png",
"default_wood.png",
}
},
nodebox = {
bottom = {
{-0.5, -0.5, -0.5, -0.375, -0.065, -0.4375},
{0.375, -0.5, -0.5, 0.5, -0.065, -0.4375},
{-0.5, -0.375, -0.5, 0.5, -0.125, -0.4375},
{-0.5, -0.375, -0.5, -0.4375, -0.125, 0.5},
{0.4375, -0.375, -0.5, 0.5, -0.125, 0.5},
{-0.4375, -0.3125, -0.4375, 0.4375, -0.0625, 0.5},
},
top = {
{-0.5, -0.5, 0.4375, -0.375, 0.1875, 0.5},
{0.375, -0.5, 0.4375, 0.5, 0.1875, 0.5},
{-0.5, 0, 0.4375, 0.5, 0.125, 0.5},
{-0.5, -0.375, 0.4375, 0.5, -0.125, 0.5},
{-0.5, -0.375, -0.5, -0.4375, -0.125, 0.5},
{0.4375, -0.375, -0.5, 0.5, -0.125, 0.5},
{-0.4375, -0.3125, -0.5, 0.4375, -0.0625, 0.4375},
}
},
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
recipe = {
{"", "", "group:stick"},
{"wool:red", "wool:red", "wool:white"},
{"group:wood", "group:wood", "group:wood"},
},
})
-- simple shaped bed
beds.register_bed("beds:bed", {
description = "Simple Bed",
inventory_image = "beds_bed.png",
wield_image = "beds_bed.png",
tiles = {
bottom = {
"beds_bed_top_bottom.png^[transformR90",
"default_wood.png",
"beds_bed_side_bottom_r.png",
"beds_bed_side_bottom_r.png^[transformfx",
"beds_transparent.png",
"beds_bed_side_bottom.png"
},
top = {
"beds_bed_top_top.png^[transformR90",
"default_wood.png",
"beds_bed_side_top_r.png",
"beds_bed_side_top_r.png^[transformfx",
"beds_bed_side_top.png",
"beds_transparent.png",
}
},
nodebox = {
bottom = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
top = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
},
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
recipe = {
{"wool:red", "wool:red", "wool:white"},
{"group:wood", "group:wood", "group:wood"}
},
})
-- aliases for PA's beds mod
minetest.register_alias("beds:bed_bottom_red", "beds:bed_bottom")
minetest.register_alias("beds:bed_top_red", "beds:bed_top")

2
mods/beds/depends.txt Normal file
View File

@ -0,0 +1,2 @@
default
wool

213
mods/beds/functions.lua Normal file
View File

@ -0,0 +1,213 @@
local player_in_bed = 0
local is_sp = minetest.is_singleplayer()
local enable_respawn = minetest.setting_getbool("enable_bed_respawn")
if enable_respawn == nil then
enable_respawn = true
end
-- helper functions
local function get_look_yaw(pos)
local n = minetest.get_node(pos)
if n.param2 == 1 then
return 7.9, n.param2
elseif n.param2 == 3 then
return 4.75, n.param2
elseif n.param2 == 0 then
return 3.15, n.param2
else
return 6.28, n.param2
end
end
local function check_in_beds(players)
local in_bed = beds.player
if not players then
players = minetest.get_connected_players()
end
for n, player in ipairs(players) do
local name = player:get_player_name()
if not in_bed[name] then
return false
end
end
return #players > 0
end
local function lay_down(player, pos, bed_pos, state, skip)
local name = player:get_player_name()
local hud_flags = player:hud_get_flags()
if not player or not name then
return
end
-- stand up
if state ~= nil and not state then
local p = beds.pos[name] or nil
if beds.player[name] ~= nil then
beds.player[name] = nil
player_in_bed = player_in_bed - 1
end
-- skip here to prevent sending player specific changes (used for leaving players)
if skip then
return
end
if p then
player:setpos(p)
end
-- physics, eye_offset, etc
player:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0})
player:set_look_yaw(math.random(1, 180)/100)
default.player_attached[name] = false
player:set_physics_override(1, 1, 1)
hud_flags.wielditem = true
default.player_set_animation(player, "stand" , 30)
-- lay down
else
beds.player[name] = 1
beds.pos[name] = pos
player_in_bed = player_in_bed + 1
-- physics, eye_offset, etc
player:set_eye_offset({x=0,y=-13,z=0}, {x=0,y=0,z=0})
local yaw, param2 = get_look_yaw(bed_pos)
player:set_look_yaw(yaw)
local dir = minetest.facedir_to_dir(param2)
local p = {x=bed_pos.x+dir.x/2,y=bed_pos.y,z=bed_pos.z+dir.z/2}
player:set_physics_override(0, 0, 0)
player:setpos(p)
default.player_attached[name] = true
hud_flags.wielditem = false
default.player_set_animation(player, "lay" , 0)
end
player:hud_set_flags(hud_flags)
end
local function update_formspecs(finished)
local ges = #minetest.get_connected_players()
local form_n = ""
local is_majority = (ges/2) < player_in_bed
if finished then
form_n = beds.formspec ..
"label[2.7,11; Good morning.]"
else
form_n = beds.formspec ..
"label[2.2,11;"..tostring(player_in_bed).." of "..tostring(ges).." players are in bed]"
if is_majority then
form_n = form_n ..
"button_exit[2,8;4,0.75;force;Force night skip]"
end
end
for name,_ in pairs(beds.player) do
minetest.show_formspec(name, "beds_form", form_n)
end
end
-- public functions
function beds.kick_players()
for name,_ in pairs(beds.player) do
local player = minetest.get_player_by_name(name)
lay_down(player, nil, nil, false)
end
end
function beds.skip_night()
minetest.set_timeofday(0.23)
beds.set_spawns()
end
function beds.on_rightclick(pos, player)
local name = player:get_player_name()
local ppos = player:getpos()
local tod = minetest.get_timeofday()
if tod > 0.2 and tod < 0.805 then
if beds.player[name] then
lay_down(player, nil, nil, false)
end
minetest.chat_send_player(name, "You can only sleep at night.")
return
end
-- move to bed
if not beds.player[name] then
lay_down(player, ppos, pos)
else
lay_down(player, nil, nil, false)
end
if not is_sp then
update_formspecs(false)
end
-- skip the night and let all players stand up
if check_in_beds() then
minetest.after(2, function()
beds.skip_night()
if not is_sp then
update_formspecs(true)
end
beds.kick_players()
end)
end
end
-- callbacks
minetest.register_on_joinplayer(function(player)
beds.read_spawns()
end)
-- respawn player at bed if enabled and valid position is found
minetest.register_on_respawnplayer(function(player)
if not enable_respawn then
return false
end
local name = player:get_player_name()
local pos = beds.spawn[name] or nil
if pos then
player:setpos(pos)
return true
end
end)
minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name()
lay_down(player, nil, nil, false, true)
beds.player[name] = nil
if check_in_beds() then
minetest.after(2, function()
beds.skip_night()
update_formspecs(true)
beds.kick_players()
end)
end
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "beds_form" then
return
end
if fields.quit or fields.leave then
lay_down(player, nil, nil, false)
update_formspecs(false)
end
if fields.force then
beds.skip_night()
update_formspecs(true)
beds.kick_players()
end
end)

16
mods/beds/init.lua Normal file
View File

@ -0,0 +1,16 @@
beds = {}
beds.player = {}
beds.pos = {}
beds.spawn = {}
beds.formspec = "size[8,15;true]"..
"bgcolor[#080808BB; true]"..
"button_exit[2,12;4,0.75;leave;Leave Bed]"
local modpath = minetest.get_modpath("beds")
-- load files
dofile(modpath.."/functions.lua")
dofile(modpath.."/api.lua")
dofile(modpath.."/beds.lua")
dofile(modpath.."/spawns.lua")

58
mods/beds/spawns.lua Normal file
View File

@ -0,0 +1,58 @@
local world_path = minetest.get_worldpath()
local org_file = world_path .. "/beds_spawns"
local file = world_path .. "/beds_spawns"
local bkwd = false
-- check for PA's beds mod spawns
local cf = io.open(world_path .. "/beds_player_spawns", "r")
if cf ~= nil then
io.close(cf)
file = world_path .. "/beds_player_spawns"
bkwd = true
end
function beds.read_spawns()
local spawns = beds.spawn
local input = io.open(file, "r")
if input and not bkwd then
repeat
local x = input:read("*n")
if x == nil then
break
end
local y = input:read("*n")
local z = input:read("*n")
local name = input:read("*l")
spawns[name:sub(2)] = {x = x, y = y, z = z}
until input:read(0) == nil
io.close(input)
elseif input and bkwd then
beds.spawn = minetest.deserialize(input:read("*all"))
input:close()
beds.save_spawns()
os.rename(file, file .. ".backup")
file = org_file
else
spawns = {}
end
end
function beds.save_spawns()
if not beds.spawn then
return
end
local output = io.open(org_file, "w")
for i, v in pairs(beds.spawn) do
output:write(v.x.." "..v.y.." "..v.z.." "..i.."\n")
end
io.close(output)
end
function beds.set_spawns()
for name,_ in pairs(beds.player) do
local player = minetest.get_player_by_name(name)
local p = player:getpos()
beds.spawn[name] = p
end
beds.save_spawns()
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 B

16
mods/boats/README.txt Normal file
View File

@ -0,0 +1,16 @@
Minetest 0.4 mod: boats
=======================
by PilzAdam, slightly modified for NeXt
License of source code:
-----------------------
WTFPL
License of media (textures and sounds):
---------------------------------------
WTFPL
Authors of media files:
-----------------------
textures: Zeg9
model: thetoon and Zeg9, modified by PavelS(SokolovPavel)

1
mods/boats/depends.txt Normal file
View File

@ -0,0 +1 @@
default

217
mods/boats/init.lua Normal file
View File

@ -0,0 +1,217 @@
--
-- Helper functions
--
local function is_water(pos)
local nn = minetest.get_node(pos).name
return minetest.get_item_group(nn, "water") ~= 0
end
local function get_sign(i)
if i == 0 then
return 0
else
return i / math.abs(i)
end
end
local function get_velocity(v, yaw, y)
local x = -math.sin(yaw) * v
local z = math.cos(yaw) * v
return {x = x, y = y, z = z}
end
local function get_v(v)
return math.sqrt(v.x ^ 2 + v.z ^ 2)
end
--
-- Boat entity
--
local boat = {
physical = true,
collisionbox = {-0.5, -0.4, -0.5, 0.5, 0.3, 0.5},
visual = "mesh",
mesh = "boat.obj",
textures = {"default_wood.png"},
driver = nil,
v = 0,
last_v = 0,
removed = false
}
function boat.on_rightclick(self, clicker)
if not clicker or not clicker:is_player() then
return
end
local name = clicker:get_player_name()
if self.driver and clicker == self.driver then
self.driver = nil
clicker:set_detach()
default.player_attached[name] = false
default.player_set_animation(clicker, "stand" , 30)
elseif not self.driver then
self.driver = clicker
clicker:set_attach(self.object, "", {x = 0, y = 11, z = -3}, {x = 0, y = 0, z = 0})
default.player_attached[name] = true
minetest.after(0.2, function()
default.player_set_animation(clicker, "sit" , 30)
end)
self.object:setyaw(clicker:get_look_yaw() - math.pi / 2)
end
end
function boat.on_activate(self, staticdata, dtime_s)
self.object:set_armor_groups({immortal = 1})
if staticdata then
self.v = tonumber(staticdata)
end
self.last_v = self.v
end
function boat.get_staticdata(self)
return tostring(self.v)
end
function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, direction)
if not puncher or not puncher:is_player() or self.removed then
return
end
if self.driver and puncher == self.driver then
self.driver = nil
puncher:set_detach()
default.player_attached[puncher:get_player_name()] = false
end
if not self.driver then
self.removed = true
-- delay remove to ensure player is detached
minetest.after(0.1, function()
self.object:remove()
end)
if not minetest.setting_getbool("creative_mode") then
puncher:get_inventory():add_item("main", "boats:boat")
end
end
end
function boat.on_step(self, dtime)
self.v = get_v(self.object:getvelocity()) * get_sign(self.v)
if self.driver then
local ctrl = self.driver:get_player_control()
local yaw = self.object:getyaw()
if ctrl.up then
self.v = self.v + 0.1
elseif ctrl.down then
self.v = self.v - 0.1
end
if ctrl.left then
if self.v < 0 then
self.object:setyaw(yaw - (1 + dtime) * 0.03)
else
self.object:setyaw(yaw + (1 + dtime) * 0.03)
end
elseif ctrl.right then
if self.v < 0 then
self.object:setyaw(yaw + (1 + dtime) * 0.03)
else
self.object:setyaw(yaw - (1 + dtime) * 0.03)
end
end
end
local velo = self.object:getvelocity()
if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then
self.object:setpos(self.object:getpos())
return
end
local s = get_sign(self.v)
self.v = self.v - 0.02 * s
if s ~= get_sign(self.v) then
self.object:setvelocity({x = 0, y = 0, z = 0})
self.v = 0
return
end
if math.abs(self.v) > 4.5 then
self.v = 4.5 * get_sign(self.v)
end
local p = self.object:getpos()
p.y = p.y - 0.5
local new_velo = {x = 0, y = 0, z = 0}
local new_acce = {x = 0, y = 0, z = 0}
if not is_water(p) then
local nodedef = minetest.registered_nodes[minetest.get_node(p).name]
if (not nodedef) or nodedef.walkable then
self.v = 0
new_acce = {x = 0, y = 1, z = 0}
else
new_acce = {x = 0, y = -9.8, z = 0}
end
new_velo = get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y)
self.object:setpos(self.object:getpos())
else
p.y = p.y + 1
if is_water(p) then
local y = self.object:getvelocity().y
if y >= 4.5 then
y = 4.5
elseif y < 0 then
new_acce = {x = 0, y = 20, z = 0}
else
new_acce = {x = 0, y = 5, z = 0}
end
new_velo = get_velocity(self.v, self.object:getyaw(), y)
self.object:setpos(self.object:getpos())
else
new_acce = {x = 0, y = 0, z = 0}
if math.abs(self.object:getvelocity().y) < 1 then
local pos = self.object:getpos()
pos.y = math.floor(pos.y) + 0.5
self.object:setpos(pos)
new_velo = get_velocity(self.v, self.object:getyaw(), 0)
else
new_velo = get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y)
self.object:setpos(self.object:getpos())
end
end
end
self.object:setvelocity(new_velo)
self.object:setacceleration(new_acce)
end
minetest.register_entity("boats:boat", boat)
minetest.register_craftitem("boats:boat", {
description = "Boat",
inventory_image = "boat_inventory.png",
wield_image = "boat_wield.png",
wield_scale = {x = 2, y = 2, z = 1},
liquids_pointable = true,
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return
end
if not is_water(pointed_thing.under) then
return
end
pointed_thing.under.y = pointed_thing.under.y + 0.5
minetest.add_entity(pointed_thing.under, "boats:boat")
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end,
})
minetest.register_craft({
output = "boats:boat",
recipe = {
{"", "", "" },
{"group:wood", "", "group:wood"},
{"group:wood", "group:wood", "group:wood"},
},
})

3111
mods/boats/models/boat.obj Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 851 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B

17
mods/bones/README.txt Normal file
View File

@ -0,0 +1,17 @@
Minetest 0.4 mod: bones
=======================
License of source code:
-----------------------
Copyright (C) 2012 PilzAdam
WTFPL
License of media (textures and sounds)
--------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
Authors of media files
----------------------
Bad_Command_

1
mods/bones/depends.txt Normal file
View File

@ -0,0 +1 @@
default

219
mods/bones/init.lua Normal file
View File

@ -0,0 +1,219 @@
-- Minetest 0.4 mod: bones
-- See README.txt for licensing and other information.
bones = {}
local function is_owner(pos, name)
local owner = minetest.get_meta(pos):get_string("owner")
if owner == "" or owner == name then
return true
end
return false
end
bones.bones_formspec =
"size[8,9]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_name;main;0,0.3;8,4;]"..
"list[current_player;main;0,4.85;8,1;]"..
"list[current_player;main;0,6.08;8,3;8]"..
default.get_hotbar_bg(0,4.85)
local share_bones_time = tonumber(minetest.setting_get("share_bones_time") or 1200)
local share_bones_time_early = tonumber(minetest.setting_get("share_bones_time_early") or (share_bones_time/4))
minetest.register_node("bones:bones", {
description = "Bones",
tiles = {
"bones_top.png",
"bones_bottom.png",
"bones_side.png",
"bones_side.png",
"bones_rear.png",
"bones_front.png"
},
paramtype2 = "facedir",
groups = {dig_immediate=2},
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_gravel_footstep", gain=0.5},
dug = {name="default_gravel_footstep", gain=1.0},
}),
can_dig = function(pos, player)
local inv = minetest.get_meta(pos):get_inventory()
return is_owner(pos, player:get_player_name()) and inv:is_empty("main")
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
if is_owner(pos, player:get_player_name()) then
return count
end
return 0
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
return 0
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if is_owner(pos, player:get_player_name()) then
return stack:get_count()
end
return 0
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if meta:get_inventory():is_empty("main") then
minetest.remove_node(pos)
end
end,
on_punch = function(pos, node, player)
if(not is_owner(pos, player:get_player_name())) then
return
end
local inv = minetest.get_meta(pos):get_inventory()
local player_inv = player:get_inventory()
local has_space = true
for i=1,inv:get_size("main") do
local stk = inv:get_stack("main", i)
if player_inv:room_for_item("main", stk) then
inv:set_stack("main", i, nil)
player_inv:add_item("main", stk)
else
has_space = false
break
end
end
-- remove bones if player emptied them
if has_space then
minetest.remove_node(pos)
end
end,
on_timer = function(pos, elapsed)
local meta = minetest.get_meta(pos)
local time = meta:get_int("time") + elapsed
if time >= share_bones_time then
meta:set_string("infotext", meta:get_string("owner").."'s old bones")
meta:set_string("owner", "")
else
meta:set_int("time", time)
return true
end
end,
})
local function may_replace(pos, player)
local node_name = minetest.get_node(pos).name
local node_definition = minetest.registered_nodes[node_name]
-- if the node is unknown, we let the protection mod decide
-- this is consistent with when a player could dig or not dig it
-- unknown decoration would often be removed
-- while unknown building materials in use would usually be left
if not node_definition then
-- only replace nodes that are not protected
return not minetest.is_protected(pos, player:get_player_name())
end
-- allow replacing air and liquids
if node_name == "air" or node_definition.liquidtype ~= "none" then
return true
end
-- don't replace filled chests and other nodes that don't allow it
local can_dig_func = node_definition.can_dig
if can_dig_func and not can_dig_func(pos, player) then
return false
end
-- default to each nodes buildable_to; if a placed block would replace it, why shouldn't bones?
-- flowers being squished by bones are more realistical than a squished stone, too
-- exception are of course any protected buildable_to
return node_definition.buildable_to and not minetest.is_protected(pos, player:get_player_name())
end
minetest.register_on_dieplayer(function(player)
if minetest.setting_getbool("creative_mode") then
return
end
local player_inv = player:get_inventory()
if player_inv:is_empty("main") and
player_inv:is_empty("craft") then
return
end
local pos = player:getpos()
pos.x = math.floor(pos.x+0.5)
pos.y = math.floor(pos.y+0.5)
pos.z = math.floor(pos.z+0.5)
local param2 = minetest.dir_to_facedir(player:get_look_dir())
local player_name = player:get_player_name()
local player_inv = player:get_inventory()
if (not may_replace(pos, player)) then
if (may_replace({x=pos.x, y=pos.y+1, z=pos.z}, player)) then
-- drop one node above if there's space
-- this should solve most cases of protection related deaths in which players dig straight down
-- yet keeps the bones reachable
pos.y = pos.y+1
else
-- drop items instead of delete
for i=1,player_inv:get_size("main") do
minetest.add_item(pos, player_inv:get_stack("main", i))
end
for i=1,player_inv:get_size("craft") do
minetest.add_item(pos, player_inv:get_stack("craft", i))
end
-- empty lists main and craft
player_inv:set_list("main", {})
player_inv:set_list("craft", {})
return
end
end
minetest.set_node(pos, {name="bones:bones", param2=param2})
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
inv:set_list("main", player_inv:get_list("main"))
for i=1,player_inv:get_size("craft") do
local stack = player_inv:get_stack("craft", i)
if inv:room_for_item("main", stack) then
inv:add_item("main", stack)
else
--drop if no space left
minetest.add_item(pos, stack)
end
end
player_inv:set_list("main", {})
player_inv:set_list("craft", {})
meta:set_string("formspec", bones.bones_formspec)
meta:set_string("owner", player_name)
if share_bones_time ~= 0 then
meta:set_string("infotext", player_name.."'s fresh bones")
if share_bones_time_early == 0 or not minetest.is_protected(pos, player_name) then
meta:set_int("time", 0)
else
meta:set_int("time", (share_bones_time - share_bones_time_early))
end
minetest.get_node_timer(pos):start(10)
else
meta:set_string("infotext", player_name.."'s bones")
end
end)

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

26
mods/bucket/README.txt Normal file
View File

@ -0,0 +1,26 @@
Minetest 0.4 mod: bucket
=========================
License of source code:
-----------------------
Copyright (C) 2011-2012 Kahrl <kahrl@gmx.net>
Copyright (C) 2011-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
http://www.gnu.org/licenses/lgpl-2.1.html
License of media (textures and sounds)
--------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
Authors of media files
-----------------------
Everything not listed in here:
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>

2
mods/bucket/depends.txt Normal file
View File

@ -0,0 +1,2 @@
default

192
mods/bucket/init.lua Normal file
View File

@ -0,0 +1,192 @@
-- Minetest 0.4 mod: bucket
-- See README.txt for licensing and other information.
minetest.register_alias("bucket", "bucket:bucket_empty")
minetest.register_alias("bucket_water", "bucket:bucket_water")
minetest.register_alias("bucket_lava", "bucket:bucket_lava")
minetest.register_craft({
output = 'bucket:bucket_empty 1',
recipe = {
{'default:steel_ingot', '', 'default:steel_ingot'},
{'', 'default:steel_ingot', ''},
}
})
bucket = {}
bucket.liquids = {}
local function check_protection(pos, name, text)
if minetest.is_protected(pos, name) then
minetest.log("action", (name ~= "" and name or "A mod")
.. " tried to " .. text
.. " at protected position "
.. minetest.pos_to_string(pos)
.. " with a bucket")
minetest.record_protection_violation(pos, name)
return true
end
return false
end
-- Register a new liquid
-- source = name of the source node
-- flowing = name of the flowing node
-- itemname = name of the new bucket item (or nil if liquid is not takeable)
-- inventory_image = texture of the new bucket item (ignored if itemname == nil)
-- name = text description of the bucket item
-- groups = (optional) groups of the bucket item, for example {water_bucket = 1}
-- This function can be called from any mod (that depends on bucket).
function bucket.register_liquid(source, flowing, itemname, inventory_image, name, groups)
bucket.liquids[source] = {
source = source,
flowing = flowing,
itemname = itemname,
}
bucket.liquids[flowing] = bucket.liquids[source]
if itemname ~= nil then
minetest.register_craftitem(itemname, {
description = name,
inventory_image = inventory_image,
stack_max = 1,
liquids_pointable = true,
groups = groups,
on_place = function(itemstack, user, pointed_thing)
-- Must be pointing to node
if pointed_thing.type ~= "node" then
return
end
local node = minetest.get_node_or_nil(pointed_thing.under)
local ndef
if node then
ndef = minetest.registered_nodes[node.name]
end
-- Call on_rightclick if the pointed node defines it
if ndef and ndef.on_rightclick and
user and not user:get_player_control().sneak then
return ndef.on_rightclick(
pointed_thing.under,
node, user,
itemstack) or itemstack
end
local place_liquid = function(pos, node, source, flowing)
if check_protection(pos,
user and user:get_player_name() or "",
"place "..source) then
return
end
minetest.add_node(pos, {name=source})
end
-- Check if pointing to a buildable node
if ndef and ndef.buildable_to then
-- buildable; replace the node
place_liquid(pointed_thing.under, node,
source, flowing)
else
-- not buildable to; place the liquid above
-- check if the node above can be replaced
local node = minetest.get_node_or_nil(pointed_thing.above)
if node and minetest.registered_nodes[node.name].buildable_to then
place_liquid(pointed_thing.above,
node, source,
flowing)
else
-- do not remove the bucket with the liquid
return
end
end
return {name="bucket:bucket_empty"}
end
})
end
end
minetest.register_craftitem("bucket:bucket_empty", {
description = "Empty Bucket",
inventory_image = "bucket.png",
stack_max = 99,
liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing)
-- Must be pointing to node
if pointed_thing.type ~= "node" then
return
end
-- Check if pointing to a liquid source
local node = minetest.get_node(pointed_thing.under)
local liquiddef = bucket.liquids[node.name]
local item_count = user:get_wielded_item():get_count()
if liquiddef ~= nil
and liquiddef.itemname ~= nil
and node.name == liquiddef.source then
if check_protection(pointed_thing.under,
user:get_player_name(),
"take ".. node.name) then
return
end
-- default set to return filled bucket
local giving_back = liquiddef.itemname
-- check if holding more than 1 empty bucket
if item_count > 1 then
-- if space in inventory add filled bucked, otherwise drop as item
local inv = user:get_inventory()
if inv:room_for_item("main", {name=liquiddef.itemname}) then
inv:add_item("main", liquiddef.itemname)
else
local pos = user:getpos()
pos.y = math.floor(pos.y + 0.5)
core.add_item(pos, liquiddef.itemname)
end
-- set to return empty buckets minus 1
giving_back = "bucket:bucket_empty "..tostring(item_count-1)
end
minetest.add_node(pointed_thing.under, {name="air"})
return ItemStack(giving_back)
end
end,
})
bucket.register_liquid(
"default:water_source",
"default:water_flowing",
"bucket:bucket_water",
"bucket_water.png",
"Water Bucket",
{water_bucket = 1}
)
bucket.register_liquid(
"default:river_water_source",
"default:river_water_flowing",
"bucket:bucket_river_water",
"bucket_river_water.png",
"River Water Bucket",
{water_bucket = 1}
)
bucket.register_liquid(
"default:lava_source",
"default:lava_flowing",
"bucket:bucket_lava",
"bucket_lava.png",
"Lava Bucket"
)
minetest.register_craft({
type = "fuel",
recipe = "bucket:bucket_lava",
burntime = 60,
replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}},
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

158
mods/compassgps/README.md Normal file
View File

@ -0,0 +1,158 @@
This mod creates a customizable compass with user settable bookmarks and shared and admin bookmarks in multiplayer.
**Compass GPS version 2.6**
Echo created a compass mod back in 2012: [https://forum.minetest.net/viewtopic.php?id=3785](https://forum.minetest.net/viewtopic.php?id=3785)<p>
PilzAdams made a modification of it, which I can not find the source to, I don't know how much of PilzAdams changes made it into the later versions of Echo's mod.<p>
Then in 2013 TeTpaAka made a fork of the compass mod that he called compass+ [https://forum.minetest.net/viewtopic.php?id=8117](https://forum.minetest.net/viewtopic.php?id=8117)<p>
This fork added the ability to "bookmark" specific places, and a gui so you could choose what point the compass should point to.
This is my fork of TeTpaAka's fork of Echo's mod. :)
The compass mod as it was is REALLY cool I love the way Echo managed to make the compass in your inventory actually change it's image to point in the direction of it's target
![alt text](http://i59.tinypic.com/a15ls0.png "image")
And TeTpaAka's gui, file io, and coding for multiplayer games was simply amazing. But as I was learning from their awesome code, I saw some changes I'd like to make using these new ideas, as well as some things I learned while looking at other mods. So, with complete and total respect for the original awesome mods, and hopefully in the same spirit as theirs, I present my own fork of the fork. CompassGPS
The crafting recipe for a compass is unchanged:<p>
```
, steel ,
steel, mese fragment, steel
, steel ,
```
![alt text](http://i59.tinypic.com/14ad2qw.png "image")
Compass GPS introduces several other changes though. First of all, this mod adds a heads up display that indicates your current position, and the name of the bookmark the compass is pointing at, that bookmarks pos, as well as the distance to that bookmark.
![alt text](http://i60.tinypic.com/facwea.png "image")
The hud updates constantly as long as the compass is in one of your active inventory slots, so you can always know where you are in relation to the target node, and how far away it is.
There is a GUI that pops up whenever you wield the compass and left click. I never played with a GUI in minetest before, so this was a new experience for me, I learned a lot and made quite a few changes:
![alt text](http://i61.tinypic.com/29zzgy1.png "image")
To create a new bookmark, type the name into the "bookmark:" field and click "Create Bookmark" (or just hit enter). To remove a bookmark, select it from the list and click "Remove Bookmark." A confirmation dialog will appear and the bookmark will only be removed if you click "YES".
The bookmark list has been expanded from a dropdown into a textlist to improve visibility. Select any bookmark in the list by clicking on it, and then click "Find Selected Bookmark" to make the compass (and hud) point at that location. "default" is always at the top of the list and will point to (0,0,0) or your bed from PilzAdams bed-mod, or home location as defined in the sethome-mod. (Setting default to your bed or sethome is old code, I modified it to make it work with my new version, but I cant take credit for the idea or basic structure.) The rest of the list are bookmarked locations that you have set and named
Just click in the "Sort by" box to change whether the bookmarks are sorted by name, or by distance from your current location. ("default" will still always be the first item in the list no matter which way you sort it)
Click in the "Dist" box to change whether the distance is calculated in 3d (including your distance in the vertical direction) or in 2d (x and z coords only, ignore vertical distance)
Down at the lower right of the screen, I'm certain you noticed the "Teleport to bookmark" button. *That button appears if, and ONLY IF the player has teleport privileges.* If they do, then they can select any bookmark out of the list, click on teleport, and be instantly transported to the location of that bookmark. Since the user already had teleport privileges, this just saved them some typing, it's not adding any new abilities.
If you click the "Settings" button in the upper right hand corner it brings up a screen where you can customize the appearance of your compass gps:
![alt text](http://i59.tinypic.com/aahqa8.png "image")<p>
(The two awesome new compass images are by Bas080 and Spootonium)
I figured the position of the hud text was likely to be something that people would want to customize, so here in the settings gui are the x and y coords for the hud text. Just enter the new coords where you want the hud text to appear and click "Change Hud"<p>
The cords must be between 0 and 1 and represent a percentage of the screen, so x=0 would put the text at the far left of the screen, and y=0.98 would put the text almost at the bottom of the screen. The default is x=0.4 and y=0.01, and that is displayed right over the input boxes so the user can easily set them back to the default if they are having trouble placing the hud. If you change either the x or y coord to a number that is out of range (less than 0 or greater than 1) then the hud will not be displayed. That makes it easy to turn the hud off if you wish.<p>
You can also change the color of the hud text by changing the value in the "Color" field here. Again, click "Change Hud" to make the update appear.
AND, there are three buttons here that allow you to select from 3 different styles of compass images. The basic compass image by Echo. A nice wooden compass image by Bas080. And a high resolution compass image by spootonium.
In Multiplayer, there are now shared and admin bookmarks!<p>
![alt text](http://i61.tinypic.com/a5b7li.png "image")<p>
If a player has the new "shared_bookmarks" privilege, then they will get the "Create Shared Bookmark" button and be able to create bookmarks that all players on the server can see and use. Shared bookmarks are preceded by *shared* and the name of the player that created them. There is a variable near the top of the init.lua called max_shared. This controls the maximum number of shared bookmarks that an individual player can create. It is set to 10 by default, but the server admin can change it to whatever they want. A player can delete their own shared bookmarks, but they can not delete anyone else's (unless they are an admin, then they can delete anyone's shared bookmarks)
If a player has the "privs" privilege, then they will get the "Create Admin Bookmark" button. Admin bookmarks are intended to allow the admins to mark important places in their world that they want everyone to be able to find. There are no limits on how many admin bookmarks can be created. Only Admins can delete admin bookmarks.
In a multiplayer game, all players get the "Show: Private, Shared, Admin" checkboxes. You can use these checkboxes to toggle which type of bookmarks show in your list. If you uncheck all three the system will automatically recheck "Private" for you.
The bookmark list is saved any time a user changes it. All of your other settings, the currently selected bookmark, sort order, distance function, and hud position and color, and compass type, are saved whenever a user leaves the game, and on game shutdown. So if you move the hud down to the lower right hand corner of the screen, and then quit, the hud will still be in the place you put it when you restart the game later.
The Chat Commands from the orignal compass mod still work, but only on private bookmarks. Chat commands available are:<p>
list_bookmarks<p>
set_bookmark <bookmark name><p>
find_bookmark <bookmark name><p>
remove_bookmark <bookmark name>
I also fixed a few bugs while I was working on this. There was a problem in the mod that caused compass to jump around in inventory if there were empty slots above it, that is fixed now. And there was also a problem with the bookmark list not being saved after you removed a bookmark if you didn't add a new bookmark afterwards. Now the bookmark list is saved whenever you change it, either adding or removing.
I tried to follow Echo and TeTpaAka's examples of how to properly code for multiplayer games, and all of the new settings should work just fine in a multiplayer game.
----** MAPS! **----
Thanks to a great idea and initial code from TeTpaAka CompassGPS now includes MAPS!<p>
Maps allow you to store a bookmark that you can then give to another player and they can use the map to put that bookmark into their own list. They also enhance role playing/story possibilities since you can hide maps for players to find that will give them bookmarks they need to find their next goal.
Craft a blank map by putting 5 papers in an X pattern:<p>
```
paper, ,paper
,paper,
paper, ,paper
```
![alt text](http://i57.tinypic.com/20z5wmr.png "image")
To place a bookmark into a map, just right click while wielding the map, select any bookmark from your list, and click the "write to cgpsmap" button. You can also put your current position into the map (without having to first create a bookmark in your compassGPS)
The map icon now changes to have a red X on it, so you can tell it is a marked map. This map can be given to another player. To transfer the bookmark to their own compassgps, they right click while wielding the marked map and a formspec like this pops up:<p>
![alt text](http://i61.tinypic.com/jakj9v.png "image")<p>
You can change the name of the bookmark to whatever you wish, click the "copy bookmark to your compassgps" button and the new bookmark is now available in your compassgps list.
To turn a marked map back into a blank map, just put it into the crafting grid.
Thanks to some nice code by Miner59 you can now mount a map on a wall! If you can dig on the position where the map is placed, you can take the map, otherwise you can add the bookmark saved in the map in your compassgps. This will make it possible on a multiplayer server to mount maps that everyone can use.
---------------------
The code is kinda a mess, because I was learning a lot of new things while working on it. I hope to do a clean up on it sometime in the near future, but I wanted to release it now so some people could start testing it. Please do not hesitate to offer critiques, criticism, or coding advice. I'm new to lua and minetest and could use the help.
And above all, if you run into a bug, please let me know!
**Credits:**<p>
Original mod is by Echo and TeTpaAka, and probably PilzAdam. Cactuz_pl clockmod showed me how to write the hud to the screen. My son offered a lot of advice and suggested several changes. I got an example of how to sort lists in lua from Michal Kottman on StackOverflow. Big thanks to Bas080 and spootonium for providing some very nice alternate images for the compass gps mod! Also thanks to Topywo for the shared bookmarks idea, and to my son for several ideas, corrections, and testing help.<p>
Map idea, image, and initial code by TeTpaAka. Store current position in map code contributed by Miner95<p>
intllib support by TeTpaAka<p>
Wall mounted maps by Miner59
**License:**<p>
Original code by Echo, PilzAdam, and TeTpaAka is WTFPL. My changes are CC0 (No rights reserved)<p>
textures: original compass textures: CC BY-SA by Echo<p>
compass b textures: CC BY-SA by Bas080 (slight modifications by Kilarin)<p>
compass c textures: CC BY-SA by Andre Goble mailto:spootonium@gmail.com<p>
(slight modifications by Kilarin)<p>
map texture: CC BY-SA by TeTpaAka (slight modifications by Kilarin for blank map)
**Dependencies:**<p>
default is the only requirement.<p>
PilzAdams Beds mod and the sethome-mod are supported if you have them.
**Incompatibilities:**<p>
This mod will clash with both the original compass and compass+ mods. They should not be installed and enabled at the same time as compassgps. HOWEVER, compassgps is 100% compatible with the bookmarks file from the compass+ mod. So if you were using compass+ and switch to compassgps you will NOT lose your previous bookmarks.
**github source:**<p>
[https://github.com/Kilarin/compassgps](https://github.com/Kilarin/compassgps)
**Download:**<p>
[https://github.com/Kilarin/compassgps/archive/master.zip](https://github.com/Kilarin/compassgps/archive/master.zip)
**To install:**<p>
Simply unzip the file into your mods folder, then rename the resulting folder from compassgps-master to compassgps<p>
OR, simply install it directly from minetest using the online mod repository.
**Mod Database:**<p>
If you use this mod, please consider reviewing it on the MineTest Mod Database.<p>
[https://forum.minetest.net/mmdb/mod/compassgps/](https://forum.minetest.net/mmdb/mod/compassgps/)
**Changelog:**<p>
2.6 bug fix from myoung008, type causing crashes when entering bad color.<p>
2.5 bug fix from TeTpaAka fix bug when static_spawnpoint is invalid<p>
2.4 wall mounted maps by Miner59<p>
2.3 intllib support by TeTpaTka so CompassGPS will work with different languages now!<p>
2.2 current position option in bookmark list when writing to map (Miner95 contribution)<p>
2.1 cgpsmap_marked notincreative and defaults to default on /giveme<p>
2.0 maps so you can exchange bookmarks between players (TeTpaAka initial contribution)<p>
1.9 corrected undeclared global variables to avoid warnings.<p>
1.8 changed register_craft to compassgps:0 for unified inventory compatibility<p>
1.7 fixed bug causing crash on first load of formspec in multiplayer<p>
1.6 fixed compass point_to not saving<p>
1.5 shared/admin bookmarks. confirm dialog for remove.<p>
1.4 corrected teleport button priv<p>
1.3 multiple compass types<p>
1.2 rounding of position corrected<p>
1.1 switched core to minetest<p>
1.0 Initial release<p>

157
mods/compassgps/README.txt Normal file
View File

@ -0,0 +1,157 @@
[b]Compass GPS version 2.6[/b]
This mod creates a customizable compass with user settable bookmarks and shared and admin bookmarks in multiplayer.
Echo created a compass mod back in 2012: [url]https://forum.minetest.net/viewtopic.php?id=3785[/url]
PilzAdams made a modification of it, which I can not find the source to, I don't know how much of PilzAdams changes made it into the later versions of Echo's mod.
Then in 2013 TeTpaAka made a fork of the compass mod that he called compass+ [url]https://forum.minetest.net/viewtopic.php?id=8117[/url]
This fork added the ability to "bookmark" specific places, and a gui so you could choose what point the compass should point to.
This is my fork of TeTpaAka's fork of Echo's mod. :)
The compass mod as it was is REALLY cool I love the way Echo managed to make the compass in your inventory actually change it's image to point in the direction of it's target
[img]http://i59.tinypic.com/a15ls0.png[/img]
And TeTpaAka's gui, file io, and coding for multiplayer games was simply amazing. But as I was learning from their awesome code, I saw some changes I'd like to make using these new ideas, as well as some things I learned while looking at other mods. So, with complete and total respect for the original awesome mods, and hopefully in the same spirit as theirs, I present my own fork of the fork. CompassGPS
The crafting recipe for a compass is unchanged:
[code]
, steel ,
steel, mese fragment, steel
, steel ,
[/code]
[img]http://i59.tinypic.com/14ad2qw.png[/img]
Compass GPS introduces several other changes though. First of all, this mod adds a heads up display that indicates your current position, and the name of the bookmark the compass is pointing at, that bookmarks pos, as well as the distance to that bookmark.
[img]http://i60.tinypic.com/facwea.png[/img]
The hud updates constantly as long as the compass is in one of your active inventory slots, so you can always know where you are in relation to the target node, and how far away it is.
There is a GUI that pops up whenever you wield the compass and left click. I never played with a GUI in minetest before, so this was a new experience for me, I learned a lot and made quite a few changes:
[IMG]http://i61.tinypic.com/29zzgy1.png[/IMG]
To create a new bookmark, type the name into the "bookmark:" field and click "Create Bookmark" (or just hit enter). To remove a bookmark, select it from the list and click "Remove Bookmark." A confirmation dialog will appear and the bookmark will only be removed if you click "YES".
The bookmark list has been expanded from a dropdown into a textlist to improve visibility. Select any bookmark in the list by clicking on it, and then click "Find Selected Bookmark" to make the compass (and hud) point at that location. "default" is always at the top of the list and will point to (0,0,0) or your bed from PilzAdams bed-mod, or home location as defined in the sethome-mod. (Setting default to your bed or sethome is old code, I modified it to make it work with my new version, but I cant take credit for the idea or basic structure.) The rest of the list are bookmarked locations that you have set and named
Just click in the "Sort by" box to change whether the bookmarks are sorted by name, or by distance from your current location. ("default" will still always be the first item in the list no matter which way you sort it)
Click in the "Dist" box to change whether the distance is calculated in 3d (including your distance in the vertical direction) or in 2d (x and z coords only, ignore vertical distance)
Down at the lower right of the screen, I'm certain you noticed the "Teleport to bookmark" button. [i]That button appears if, and ONLY IF the player has teleport privileges.[/i] If they do, then they can select any bookmark out of the list, click on teleport, and be instantly transported to the location of that bookmark. Since the user already had teleport privileges, this just saved them some typing, it's not adding any new abilities.
If you click the "Settings" button in the upper right hand corner it brings up a screen where you can customize the appearance of your compass gps:
[IMG]http://i59.tinypic.com/aahqa8.png[/IMG]
(The two awesome new compass images are by Bas080 and Spootonium)
I figured the position of the hud text was likely to be something that people would want to customize, so here in the settings gui are the x and y coords for the hud text. Just enter the new coords where you want the hud text to appear and click "Change Hud"
The cords must be between 0 and 1 and represent a percentage of the screen, so x=0 would put the text at the far left of the screen, and y=0.98 would put the text almost at the bottom of the screen. The default is x=0.4 and y=0.01, and that is displayed right over the input boxes so the user can easily set them back to the default if they are having trouble placing the hud. If you change either the x or y coord to a number that is out of range (less than 0 or greater than 1) then the hud will not be displayed. That makes it easy to turn the hud off if you wish.
You can also change the color of the hud text by changing the value in the "Color" field here. Again, click "Change Hud" to make the update appear.
AND, there are three buttons here that allow you to select from 3 different styles of compass images. The basic compass image by Echo. A nice wooden compass image by Bas080. And a high resolution compass image by spootonium.
In Multiplayer, there are now shared and admin bookmarks!
[IMG]http://i61.tinypic.com/a5b7li.png[/IMG]
If a player has the new "shared_bookmarks" privilege, then they will get the "Create Shared Bookmark" button and be able to create bookmarks that all players on the server can see and use. Shared bookmarks are preceded by *shared* and the name of the player that created them. There is a variable near the top of the init.lua called max_shared. This controls the maximum number of shared bookmarks that an individual player can create. It is set to 10 by default, but the server admin can change it to whatever they want. A player can delete their own shared bookmarks, but they can not delete anyone else's (unless they are an admin, then they can delete anyone's shared bookmarks)
If a player has the "privs" privilege, then they will get the "Create Admin Bookmark" button. Admin bookmarks are intended to allow the admins to mark important places in their world that they want everyone to be able to find. There are no limits on how many admin bookmarks can be created. Only Admins can delete admin bookmarks.
In a multiplayer game, all players get the "Show: Private, Shared, Admin" checkboxes. You can use these checkboxes to toggle which type of bookmarks show in your list. If you uncheck all three the system will automatically recheck "Private" for you.
The bookmark list is saved any time a user changes it. All of your other settings, the currently selected bookmark, sort order, distance function, and hud position and color, and compass type, are saved whenever a user leaves the game, and on game shutdown. So if you move the hud down to the lower right hand corner of the screen, and then quit, the hud will still be in the place you put it when you restart the game later.
The Chat Commands from the orignal compass mod still work, but only on private bookmarks. Chat commands available are:
list_bookmarks
set_bookmark <bookmark name>
find_bookmark <bookmark name>
remove_bookmark <bookmark name>
I also fixed a few bugs while I was working on this. There was a problem in the mod that caused compass to jump around in inventory if there were empty slots above it, that is fixed now. And there was also a problem with the bookmark list not being saved after you removed a bookmark if you didn't add a new bookmark afterwards. Now the bookmark list is saved whenever you change it, either adding or removing.
I tried to follow Echo and TeTpaAka's examples of how to properly code for multiplayer games, and all of the new settings should work just fine in a multiplayer game.
----[b] MAPS! [/b]----
Thanks to a great idea and initial code from TeTpaAka CompassGPS now includes MAPS!
Maps allow you to store a bookmark that you can then give to another player and they can use the map to put that bookmark into their own list. They also enhance role playing/story possibilities since you can hide maps for players to find that will give them bookmarks they need to find their next goal.
Craft a blank map by putting 5 papers in an X pattern:
[code]
paper, ,paper
,paper,
paper, ,paper
[/code]
[img]http://i57.tinypic.com/20z5wmr.png[/img]
To place a bookmark into a map, just right click while wielding the map, select any bookmark from your list, and click the "write to cgpsmap" button. You can also put your current position into the map (without having to first create a bookmark in your compassGPS)
The map icon now changes to have a red X on it, so you can tell it is a marked map. This map can be given to another player. To transfer the bookmark to their own compassgps, they right click while wielding the marked map and a formspec like this pops up:
[img]http://i61.tinypic.com/jakj9v.png[/img]
You can change the name of the bookmark to whatever you wish, click the "copy bookmark to your compassgps" button and the new bookmark is now available in your compassgps list.
To turn a marked map back into a blank map, just put it into the crafting grid.
Thanks to some nice code by Miner59 you can now mount a map on a wall! If you can dig on the position where the map is placed, you can take the map, otherwise you can add the bookmark saved in the map in your compassgps. This will make it possible on a multiplayer server to mount maps that everyone can use.
---------------------
The code is kinda a mess, because I was learning a lot of new things while working on it. I hope to do a clean up on it sometime in the near future, but I wanted to release it now so some people could start testing it. Please do not hesitate to offer critiques, criticism, or coding advice. I'm new to lua and minetest and could use the help.
And above all, if you run into a bug, please let me know!
[b]Credits:[/b]
Original mod is by Echo and TeTpaAka, and probably PilzAdam. Cactuz_pl clockmod showed me how to write the hud to the screen. My son offered a lot of advice and suggested several changes. I got an example of how to sort lists in lua from Michal Kottman on StackOverflow. Big thanks to Bas080 and spootonium for providing some very nice alternate images for the compass gps mod! Also thanks to Topywo for the shared bookmarks idea, and to my son for several ideas, corrections, and testing help.
Map idea, image, and initial code by TeTpaAka. Store current position in map code contributed by Miner95
intllib support by TeTpaAka
Wall mounted maps by Miner59
[b]License:[/b]
Original code by Echo, PilzAdam, and TeTpaAka is WTFPL. My changes are CC0 (No rights reserved)
textures: original compass textures: CC BY-SA by Echo
compass b textures: CC BY-SA by Bas080 (slight modifications by Kilarin)
compass c textures: CC BY-SA by Andre Goble mailto:spootonium@gmail.com
(slight modifications by Kilarin)
map texture: CC BY-SA by TeTpaAka (slight modifications by Kilarin for blank map)
[b]Dependencies:[/b]
default is the only requirement.
PilzAdams Beds mod and the sethome-mod are supported if you have them.
[b]Incompatibilities:[/b]
This mod will clash with both the original compass and compass+ mods. They should not be installed and enabled at the same time as compassgps. HOWEVER, compassgps is 100% compatible with the bookmarks file from the compass+ mod. So if you were using compass+ and switch to compassgps you will NOT lose your previous bookmarks.
[b]github source:[/b]
[url]https://github.com/Kilarin/compassgps[/url]
[b]Download:[/b]
[url]https://github.com/Kilarin/compassgps/archive/master.zip[/url]
[b]To install:[/b]
Simply unzip the file into your mods folder, then rename the resulting folder from compassgps-master to compassgps
OR, simply install it directly from minetest using the online mod repository.
[b]Mod Database:[/b]
If you use this mod, please consider reviewing it on the MineTest Mod Database.
[url]https://forum.minetest.net/mmdb/mod/compassgps/[/url]
[b]Changelog:[/b]
2.6 bug fix from myoung008, type causing crashes when entering bad color.
2.5 bug fix from TeTpaAka fix bug when static_spawnpoint is invalid
2.4 wall mounted maps by Miner59
2.3 intllib support by TeTpaTka so CompassGPS will work with different languages now!
2.2 current position option in bookmark list when writing to map (Miner95 contribution)
2.1 cgpsmap_marked notincreative and defaults to default on /giveme
2.0 maps so you can exchange bookmarks between players (TeTpaAka initial contribution)
1.9 corrected undeclared global variables to avoid warnings.
1.8 changed register_craft to compassgps:0 for unified inventory compatibility
1.7 fixed bug causing crash on first load of formspec in multiplayer
1.6 fixed compass point_to not saving
1.5 shared/admin bookmarks. confirm dialog for remove.
1.4 corrected teleport button priv
1.3 multiple compass types
1.2 rounding of position corrected
1.1 switched core to minetest
1.0 Initial release

350
mods/compassgps/cgpsmap.lua Normal file
View File

@ -0,0 +1,350 @@
--original code for storing bookmarks outside of the compass by TeTpaAka
--modifications by Kilarin and Miner59
--wall mounted maps by Miner59
--set growing_wall_maps to true and wall mounted maps will get bigger the further
--away the target is.
local growing_wall_maps=false
-- Boilerplate to support localized strings if intllib mod is installed.
local S
if (minetest.get_modpath("intllib")) then
dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
else
S = function ( s ) return s end
end
local selected_cgpsmap = {}
local textlist_bookmark = {}
local selected_bookmark = {}
function write_to_cgpsmap(itemstack, user)
--print("write_to_cgpsmap")
selected_cgpsmap[user:get_player_name()] = itemstack
local list,bkmrkidx=compassgps.bookmark_loop("M", user:get_player_name())
if list == "" then
return nil
end
textlist_bookmark[user:get_player_name()] = list
local formspec = "size[9,10;]"..
"button_exit[2,2;5,0.5;write;"..S("Write to cgpsmap").."]"..
"textlist[0,3.0;9,6;bookmark_list;"..list..";"..bkmrkidx.."]"
minetest.show_formspec(user:get_player_name(), "compassgps:write", formspec)
--print("write_to_cgpsmap end")
end
function read_from_cgpsmap(itemstack, user, meta)
--print("read_from_cgpsmap")
local formspec = "size[9,5]"..
"button_exit[2,3;5,0.5;read;"..S("copy bookmark to your compassgps").."]"
if itemstack~=nil then
formspec=formspec.. "button_exit[3.1,4;2.6,0.8;rename;"..S("rename bookmark").."]"
else
itemstack=ItemStack("compassgps:cgpsmap_marked 1")
if meta then
itemstack:set_metadata(minetest.serialize(meta))
end
end
if not meta then --marked map from creative or /giveme has no meta!
meta={bkmrkname="default",x=0,y=0,z=0}
itemstack:set_metadata(minetest.serialize(meta))
end
selected_cgpsmap[user:get_player_name()] = itemstack
formspec=formspec.."label[2,0.5;"..S("bookmark pos:").." ("..meta["x"]..","..meta["y"]..","..meta["z"]..")]"..
"field[2,2;5,0.5;name;"..S("bookmark name:")..";"..meta["bkmrkname"].."]"
minetest.show_formspec(user:get_player_name(), "compassgps:read", formspec)
--print("read_from_cgpsmap end")
end
minetest.register_craft({
output = 'compassgps:cgpsmap',
recipe = {
{'default:paper', '', 'default:paper'},
{'', 'default:paper', ''},
{'default:paper', '', 'default:paper'}
}
})
minetest.register_craft({
output = 'compassgps:cgpsmap',
recipe = {
{'compassgps:cgpsmap_marked'},
}
})
minetest.register_craftitem("compassgps:cgpsmap", {
description = S("CompassGPS Map (blank)"),
inventory_image = "cgpsmap-blank.png",
--groups = {book = 1},
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
write_to_cgpsmap(itemstack, user)
return
end
})
minetest.register_craftitem("compassgps:cgpsmap_marked", {
description = "CompassGPS Map (marked)",
inventory_image = "cgpsmap-marked.png",
groups = {not_in_creative_inventory = 1},
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
local meta = minetest.deserialize(itemstack:get_metadata())
read_from_cgpsmap(itemstack, user, meta)
return nil
end,
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type=="node" and pointed_thing.above then
local pos=pointed_thing.above
local ppos=placer:getpos()
local facedir=minetest.dir_to_facedir(vector.direction(ppos,pointed_thing.under))
local x=pos.x
local y=pos.y
local z=pos.z
if facedir~=nil and itemstack:get_name()=="compassgps:cgpsmap_marked"
and (not minetest.is_protected(pos,placer:get_player_name())) then
minetest.set_node(pos,{name="compassgps:cgpsmap_wall",param2=facedir})
local mapdata = itemstack:get_metadata()
local meta=minetest.get_meta(pos)
meta:set_string("mapdata",mapdata)
if mapdata~=nil then
local data=minetest.deserialize(mapdata)
if data~=nil then
meta:set_string("infotext", data["bkmrkname"])
x=data["x"]
y=data["y"]
z=data["z"]
end
end
if facedir==1 then
pos={x=pos.x+0.3,y=pos.y,z=pos.z}
elseif facedir==3 then
pos={x=pos.x-0.3,y=pos.y,z=pos.z}
elseif facedir==0 then
pos={x=pos.x,y=pos.y,z=pos.z+0.3}
elseif facedir==2 then
pos={x=pos.x,y=pos.y,z=pos.z-0.3}
end
local e = minetest.env:add_entity(pos,"compassgps:cgpsmap_item")
local yaw = math.pi*2 - facedir * math.pi/2
e:setyaw(yaw)
local dist=math.abs(pos.x-x)+math.abs(pos.y-y)+math.abs(pos.z-z)
if growing_wall_maps == false then
e:set_properties({visual_size={x=0.85,y=0.85}})
elseif dist>30000 then
e:set_properties({visual_size={x=3.45,y=3.45}})
elseif dist>15000 then
e:set_properties({visual_size={x=2.95,y=2.95}})
elseif dist>5000 then
e:set_properties({visual_size={x=2.45,y=2.45}})
elseif dist>3000 then
e:set_properties({visual_size={x=1.45,y=1.45}})
elseif dist>2000 then
e:set_properties({visual_size={x=1.2,y=1.2}})
elseif dist>1000 then
e:set_properties({visual_size={x=1,y=1}})
elseif dist>500 then
e:set_properties({visual_size={x=0.85,y=0.85}})
end--else default (0.7)
itemstack:take_item()
end
end
return itemstack
end,
})
minetest.register_node("compassgps:cgpsmap_wall",{
description = "CompassGPS Map (wallmounted)",
drawtype = "nodebox",
node_box = { type = "fixed", fixed = {-0.5, -0.5, 7/16, 0.5, 0.5, 0.5} },
selection_box = { type = "fixed", fixed = {-0.7, -0.7, 7/16, 0.7, 0.7, 0.7} },
tiles = {"compassgps_blank.png"},
inventory_image = "cgpsmap_marked.png",
wield_image = "cgpsmap_marked.png",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
groups = { choppy=2,dig_immediate=2,not_in_creative_inventory=1,not_in_craft_guide=1 },
legacy_wallmounted = true,
sounds = default.node_sound_defaults(),
on_punch = function(pos,node,puncher)
local meta = minetest.env:get_meta(pos)
local mapdata=meta:get_string("mapdata")
if minetest.is_protected(pos,puncher:get_player_name()) then
--don't take map, instead open formspec to add coordinates in compassgps
if mapdata~=nil then
read_from_cgpsmap(nil, puncher, minetest.deserialize(mapdata))
end
return
end
local inv = puncher:get_inventory()
local objs = nil
objs = minetest.env:get_objects_inside_radius(pos, .5)
if objs then
for _, obj in ipairs(objs) do
if obj and obj:get_luaentity() and obj:get_luaentity().name == "compassgps:cgpsmap_item" then
obj:remove()
end
end
end
local itemstack=ItemStack("compassgps:cgpsmap_marked 1")
itemstack:set_metadata(mapdata)
if inv:room_for_item("main",itemstack) then
inv:add_item("main",itemstack)
else
minetest.env:add_item(pos, itemstack)
end
minetest.remove_node(pos)
end,
})
minetest.register_entity("compassgps:cgpsmap_item",{
hp_max = 1,
visual="wielditem",
visual_size={x=0.7,y=0.7},
collisionbox = {0,0,0,0,0,0},
physical=false,
textures={"compassgps:cgpsmap_marked"},
})
minetest.register_abm({
nodenames = { "compassgps:cgpsmap_wall" },
interval = 600,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
if #minetest.get_objects_inside_radius(pos, 0.5) > 0 then return end
local meta=minetest.get_meta(pos)
local x=pos.x
local y=pos.y
local z=pos.z
local mapdata=meta:get_string("mapdata",mapdata)
if mapdata~=nil then
local data=minetest.deserialize(mapdata)
if data~=nil then
x=data["x"]
y=data["y"]
z=data["z"]
end
end
local facedir=node.param2
if facedir==1 then
pos={x=pos.x+0.3,y=pos.y,z=pos.z}
elseif facedir==3 then
pos={x=pos.x-0.3,y=pos.y,z=pos.z}
elseif facedir==0 then
pos={x=pos.x,y=pos.y,z=pos.z+0.3}
elseif facedir==2 then
pos={x=pos.x,y=pos.y,z=pos.z-0.3}
end
local e = minetest.env:add_entity(pos,"compassgps:cgpsmap_item")
local yaw = math.pi*2 - facedir * math.pi/2
e:setyaw(yaw)
local dist=math.abs(pos.x-x)+math.abs(pos.y-y)+math.abs(pos.z-z)
if dist>30000 then
e:set_properties({visual_size={x=3.45,y=3.45}})
elseif dist>15000 then
e:set_properties({visual_size={x=2.95,y=2.95}})
elseif dist>5000 then
e:set_properties({visual_size={x=2.45,y=2.45}})
elseif dist>3000 then
e:set_properties({visual_size={x=1.45,y=1.45}})
elseif dist>2000 then
e:set_properties({visual_size={x=1.2,y=1.2}})
elseif dist>1000 then
e:set_properties({visual_size={x=1,y=1}})
elseif dist>500 then
e:set_properties({visual_size={x=0.85,y=0.85}})
end--else default (0.7)
end
})
minetest.register_on_player_receive_fields(function(player, formname, fields)
if (formname == "compassgps:write") then
if not player then
return
end
local playername = player:get_player_name();
if (playername ~= "") then
if (selected_cgpsmap[playername] == nil) then
return
end
if fields["bookmark_list"] then
-- to get the currently selected
local id = minetest.explode_textlist_event(fields["bookmark_list"])
selected_bookmark[playername] = id.index
end
if fields["write"] then
--print("***cgpsmap fields=write***")
if selected_bookmark[playername] == nil then
return nil
end
local bkmrk=textlist_bkmrks[playername][selected_bookmark[playername]]
local write = { ["bkmrkname"] = bkmrk.bkmrkname,
x = bkmrk.x,
y = bkmrk.y,
z = bkmrk.z}
--print("dump(write)="..dump(write))
selected_cgpsmap[playername]:set_name("compassgps:cgpsmap_marked")
selected_cgpsmap[playername]:set_metadata(minetest.serialize(write))
player:set_wielded_item(selected_cgpsmap[playername])
end
end
end
if (formname == "compassgps:read") then
if not player then
return
end
if (fields["read"]) then
--print("***cgpsmap fields=read***")
local meta = minetest.deserialize(selected_cgpsmap[player:get_player_name()]:get_metadata())
--print("dump(meta)="..dump(meta))
local bkmrkname = fields["name"]
--print("bkmrkname from fields[name]="..bkmrkname)
local pos = { x = meta["x"] + 0,
y = meta["y"] + 0,
z = meta["z"] + 0 }
local playername = player:get_player_name()
--print(bkmrkname)
compassgps.set_bookmark(playername, bkmrkname, "P", pos)
end
end
if (selected_cgpsmap == nil) then
return
end
local playername = player:get_player_name()
if (playername == nil) then
return
end
if (selected_cgpsmap[playername] == nil) then
return
end
if fields["rename"] then
local bkmrkname = fields["name"]
local meta = minetest.deserialize(selected_cgpsmap[player:get_player_name()]:get_metadata())
if meta~=nil and bkmrkname~=nil then
local pos = { x = meta["x"] + 0,
y = meta["y"] + 0,
z = meta["z"] + 0 }
selected_cgpsmap[playername]:set_metadata(minetest.serialize({ ["bkmrkname"] = bkmrkname,
x = pos.x,
y = pos.y,
z = pos.z}))
player:set_wielded_item(selected_cgpsmap[playername]) --new name is saved in marked cpgsmap
end
end
end)

View File

@ -0,0 +1,2 @@
default
intllib?

1298
mods/compassgps/init.lua Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,63 @@
bkmrkidx\=nil = bkmrkidx\=nil
playername\=%s = playername\=%s
playername\=nil = playername\=nil
%s's map = Karte von %s
A bookmark with the name '%s' can't be created. = Ein weiterer Wegpunkt mit dem Namen '%s' kann nicht erstellt werden.
Admin = Administrator
Bookmark '%s' added at %s type\=%s = Wegpunkt '%s' wurde bei %s vom Typ %s erstellt.
Change hud: = Ändere HUD:
Color: = Farbe:
Dist: = Entfernung:
Compass Type: = Kompasstyp:
Give the bookmark a name. = Geben Sie dem Wegpunkt einen Namen
Lets the compassgps point to the bookmark = Lässt den Kompass auf den Wegpunkt zeigen.
No = Nein
No bookmark was specified. = Kein Wegpunkt wurde angegegeben.
Pointing at %s. = Zeige auf %s.
Pointing at default location. = Zeige auf die Standardposition.
Private = Privat
Remove bookmark: = Entferne Wegpunkt:
Removes the bookmark specified by <bookmark_name> = Entfernt den Wegpunkt der mit <bookmark_name> angegeben ist.
Settings = Einstellungen
Shared = Geteilt
Show: = Zeige:
Sort by: = Sortiere nach:
Teleporting to %s = Teleportiere zu %s
The bookmark = Der Wegpunkt
The maximum number of shared bookmarks any user can create is %d. = Jeder Nutzer kann nur %d geteilte Wegpunkte erstellen.
Yes = Ja
You already have a bookmark with that name. = Sie haben bereits einen Wegpunkt mit diesem Namen.
You have no bookmark with this name. = Sie haben keinen Wegpunkt mit diesem Namen.
bookmark = Wegpunkt
compassgps reading bookmarks = compassgps liest die Wegpunkte.
compassgps reading settings = compassgps liest die Einstellungen.
compassgps = Kompass
compassgps teleporting player %s to %s = compassgps teleportiert Spieler %s nach %s.
compassgps writing settings = compassgps schreibt die Einstellungen.
compassgps.%s invalid bkrmkidx = compassgps.%s ungültige bkmrkidx.
compassgps.%s invalid bookmark playername\=%s bkmrkid\=%s = compassgps.%s ungültiger Wegpunkt Spielername\=%s bkmrkidx\=%s.
compassgps.%s player not found = compassgps.%s Spieler nicht gefunden.
compassgps: hud color not valid hex number = compassgps: HUD Farbe ist keine zulässige Hexadezimalzahl.
compassgps: hud coords are not numeric. Change to between 0 and 1 = compassgps: HUD Koordinaten sind keine Zahlen. Ändern sie diese zu Werten zwischen 0 und 1.
compassgps: hud coords out of range, hud will not be displayed. Change to between 0 and 1 to restore = compassgps: HUD Koordinaten sind außerhalb des zulässigen Bereichs. Ändern sie diese zu Werten zwischen 0 und 1 um das HUD wiederherzustellen.
compassgps:%s invalid bookmark = compassgps.%s ungültiger Wegpunkt
create admin = Erstelle Administratorwegpunkt
create bookmark = Erstelle Wegpunkt
create shared = Erstelle geteilten Wegpunkt
current position : = Momentane Position :
distance = Entfernung
find selected bookmark = Finde den ausgewählten Wegpunkt
list_bookmarks: Lists all bookmarks of a player = list_bookmarks: Zeigt alle Wegpunkte eines Spielers.
name = Name
remove bookmark = Entferne den Wegpunkt
remove bookmark playername\=%s bkmrkidx\=%s = Entferne den Wegpunkt Spielername\=%s bkmrkidx\=%s
removed %s = %s entfernt.
set_bookmark: Sets a location bookmark for the player = set_bookmark: Setzt einen Wegpunkt für den Spieler.
teleport to bookmark = Teleportiere zu dem Wegpunkt.
you can not remove someone elses bookmark: = Sie können den Wegpunkt eines anderen Spielers nicht entfernen:
CompassGPS Map (blank) = CompassGPS Karte (leer)
CompassGPS Map (marked) = CompassGPS Karte (markiert)
Write to cgpsmap = Schreibe auf die Karte
copy bookmark to your compassgps = Kopiere den Wegpunkt in ihren Kompass.
bookmark name: = Name des Wegpunkts:
bookmark pos: = Position des Wegpunkts:

View File

@ -0,0 +1,63 @@
bkmrkidx\=nil =
playername\=%s =
playername\=nil =
%s's map =
A bookmark with the name '%s' can't be created. =
Admin =
Bookmark '%s' added at %s type\=%s =
Change hud: =
Color: =
Dist: =
Compass Type: =
Give the bookmark a name. =
Lets the compassgps point to the bookmark =
No =
No bookmark was specified. =
Pointing at %s. =
Pointing at default location. =
Private =
Remove bookmark: =
Removes the bookmark specified by <bookmark_name> =
Settings =
Shared =
Show: =
Sort by: =
Teleporting to %s =
The bookmark =
The maximum number of shared bookmarks any user can create is %d. =
Yes =
You already have a bookmark with that name. =
You have no bookmark with this name. =
bookmark =
compassgps reading bookmarks =
compassgps reading settings =
compassgps =
compassgps teleporting player %s to %s =
compassgps writing settings =
compassgps.%s invalid bkrmkidx =
compassgps.%s invalid bookmark playername\=%s bkmrkid\=%s =
compassgps.%s player not found =
compassgps: hud color not valid hex number =
compassgps: hud coords are not numeric. Change to between 0 and 1 =
compassgps: hud coords out of range, hud will not be displayed. Change to between 0 and 1 to restore =
compassgps:%s invalid bookmark =
create admin =
create bookmark =
create shared =
current position : =
distance =
find selected bookmark =
list_bookmarks: Lists all bookmarks of a player =
name =
remove bookmark =
remove bookmark playername\=%s bkmrkidx\=%s =
removed %s =
set_bookmark: Sets a location bookmark for the player =
teleport to bookmark =
you can not remove someone elses bookmark: =
CompassGPS Map (blank) =
CompassGPS Map (marked) =
Write to cgpsmap =
copy bookmark to your compassgps =
bookmark name: =
bookmark pos: =

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 B

22
mods/creative/README.txt Normal file
View File

@ -0,0 +1,22 @@
Minetest 0.4 mod: creative
==========================
Implements creative mode.
Switch on by using the "creative_mode" setting.
Registered items that
- have a description, and
- do not have the group not_in_creative_inventory
are added to the creative inventory.
License of source code and media files:
---------------------------------------
Copyright (C) 2012 Perttu Ahola (celeron55) <celeron55@gmail.com>
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details.

View File

@ -0,0 +1 @@
default

173
mods/creative/init.lua Normal file
View File

@ -0,0 +1,173 @@
-- minetest/creative/init.lua
creative_inventory = {}
creative_inventory.creative_inventory_size = 0
-- Create detached creative inventory after loading all mods
minetest.after(0, function()
local inv = minetest.create_detached_inventory("creative", {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if minetest.setting_getbool("creative_mode") then
return count
else
return 0
end
end,
allow_put = function(inv, listname, index, stack, player)
return 0
end,
allow_take = function(inv, listname, index, stack, player)
if minetest.setting_getbool("creative_mode") then
return -1
else
return 0
end
end,
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
end,
on_put = function(inv, listname, index, stack, player)
end,
on_take = function(inv, listname, index, stack, player)
--print(player:get_player_name().." takes item from creative inventory; listname="..dump(listname)..", index="..dump(index)..", stack="..dump(stack))
if stack then
minetest.log("action", player:get_player_name().." takes "..dump(stack:get_name()).." from creative inventory")
--print("stack:get_name()="..dump(stack:get_name())..", stack:get_count()="..dump(stack:get_count()))
end
end,
})
local creative_list = {}
for name,def in pairs(minetest.registered_items) do
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0)
and def.description and def.description ~= "" then
table.insert(creative_list, name)
end
end
table.sort(creative_list)
inv:set_size("main", #creative_list)
for _,itemstring in ipairs(creative_list) do
inv:add_item("main", ItemStack(itemstring))
end
creative_inventory.creative_inventory_size = #creative_list
--print("creative inventory size: "..dump(creative_inventory.creative_inventory_size))
end)
-- Create the trash field
local trash = minetest.create_detached_inventory("creative_trash", {
-- Allow the stack to be placed and remove it in on_put()
-- This allows the creative inventory to restore the stack
allow_put = function(inv, listname, index, stack, player)
if minetest.setting_getbool("creative_mode") then
return stack:get_count()
else
return 0
end
end,
on_put = function(inv, listname, index, stack, player)
inv:set_stack(listname, index, "")
end,
})
trash:set_size("main", 1)
creative_inventory.set_creative_formspec = function(player, start_i, pagenum)
pagenum = math.floor(pagenum)
local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (6*4) + 1)
player:set_inventory_formspec(
"size[13,7.5]"..
--"image[6,0.6;1,2;player.png]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_player;main;5,3.5;8,1;]"..
"list[current_player;main;5,4.75;8,3;8]"..
"list[current_player;craft;8,0;3,3;]"..
"list[current_player;craftpreview;12,1;1,1;]"..
"image[11,1;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
"list[detached:creative;main;0.3,0.5;4,6;"..tostring(start_i).."]"..
"label[2.0,6.55;"..tostring(pagenum).."/"..tostring(pagemax).."]"..
"button[0.3,6.5;1.6,1;creative_prev;<<]"..
"button[2.7,6.5;1.6,1;creative_next;>>]"..
"label[5,1.5;Trash:]"..
"list[detached:creative_trash;main;5,2;1,1;]"..
default.get_hotbar_bg(5,3.5)
)
end
minetest.register_on_joinplayer(function(player)
-- If in creative mode, modify player's inventory forms
if not minetest.setting_getbool("creative_mode") then
return
end
creative_inventory.set_creative_formspec(player, 0, 1)
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if not minetest.setting_getbool("creative_mode") then
return
end
-- Figure out current page from formspec
local current_page = 0
local formspec = player:get_inventory_formspec()
local start_i = string.match(formspec, "list%[detached:creative;main;[%d.]+,[%d.]+;[%d.]+,[%d.]+;(%d+)%]")
start_i = tonumber(start_i) or 0
if fields.creative_prev then
start_i = start_i - 4*6
end
if fields.creative_next then
start_i = start_i + 4*6
end
if start_i < 0 then
start_i = start_i + 4*6
end
if start_i >= creative_inventory.creative_inventory_size then
start_i = start_i - 4*6
end
if start_i < 0 or start_i >= creative_inventory.creative_inventory_size then
start_i = 0
end
creative_inventory.set_creative_formspec(player, start_i, start_i / (6*4) + 1)
end)
if minetest.setting_getbool("creative_mode") then
local digtime = 0.5
minetest.register_item(":", {
type = "none",
wield_image = "wieldhand.png",
wield_scale = {x=1,y=1,z=2.5},
range = 10,
tool_capabilities = {
full_punch_interval = 0.5,
max_drop_level = 3,
groupcaps = {
crumbly = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
cracky = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
snappy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
choppy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
oddly_breakable_by_hand = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
},
damage_groups = {fleshy = 10},
}
})
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
return true
end)
function minetest.handle_node_drops(pos, drops, digger)
if not digger or not digger:is_player() then
return
end
local inv = digger:get_inventory()
if inv then
for _,item in ipairs(drops) do
item = ItemStack(item):get_name()
if not inv:contains_item("main", item) then
inv:add_item("main", item)
end
end
end
end
end

204
mods/default/README.txt Normal file
View File

@ -0,0 +1,204 @@
Minetest 0.4 mod: default
==========================
License of source code:
-----------------------
Copyright (C) 2011-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
http://www.gnu.org/licenses/lgpl-2.1.html
License of media (textures and sounds)
--------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
Authors of media files
-----------------------
Everything not listed in here:
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
Cisoun's WTFPL texture pack:
default_jungletree.png
default_jungletree_top.png
default_lava.png
default_leaves.png
default_sapling.png
default_sign_wall.png
default_stone.png
default_tree.png
default_tree_top.png
default_water.png
Cisoun's conifers mod (WTFPL):
default_pine_needles.png
Originating from G4JC's Almost MC Texture Pack:
default_torch.png
default_torch_on_ceiling.png
default_torch_on_floor.png
VanessaE's animated torches (WTFPL):
default_torch_animated.png
default_torch_on_ceiling_animated.png
default_torch_on_floor_animated.png
default_torch_on_floor.png
RealBadAngel's animated water (WTFPL):
default_water_source_animated.png
default_water_flowing_animated.png
VanessaE (WTFPL):
default_nc_back.png
default_nc_front.png
default_nc_rb.png
default_nc_side.png
default_grass_*.png
default_desert_sand.png
default_desert_stone.png
default_desert_stone_brick.png
default_sand.png
Calinou (CC BY-SA):
default_brick.png
default_papyrus.png
default_mineral_copper.png
default_glass_detail.png
MirceaKitsune (WTFPL):
character.x
Jordach (CC BY-SA 3.0):
character.png
PilzAdam (WTFPL):
default_jungleleaves.png
default_junglesapling.png
default_junglewood.png
default_obsidian_glass.png
default_obsidian_shard.png
default_mineral_gold.png
default_snowball.png
jojoa1997 (WTFPL):
default_obsidian.png
InfinityProject (WTFPL):
default_mineral_diamond.png
Splizard (CC BY-SA 3.0):
default_snow.png
default_snow_side.png
default_ice.png
default_pine_sapling.png
Zeg9 (CC BY-SA 3.0):
default_coal_block.png
default_steel_block.png
default_copper_block.png
default_bronze_block.png
default_gold_block.png
paramat (CC BY-SA 3.0):
wieldhand.png, based on character.png by Jordach (CC BY-SA 3.0)
default_pinetree.png
default_pinetree_top.png
default_pinewood.png
default_sandstone_brick.png
default_obsidian_brick.png
default_river_water.png
default_river_water_source_animated.png
default_river_water_flowing_animated.png
brunob.santos (CC BY-SA 4.0):
default_desert_cobble.png
BlockMen (CC BY-SA 3.0):
default_stone_brick.png
default_wood.png
default_clay_brick.png
default_iron_ingot.png
default_gold_ingot.png
default_tool_steelsword.png
default_diamond.png
default_diamond_block.png
default_book.png
default_tool_*.png
default_lava_source_animated.png
default_lava_flowing_animated.png
default_stick.png
default_chest_front.png
default_chest_lock.png
default_chest_side.png
default_chest_top.png
default_mineral_mese.png
default_meselamp.png
bubble.png
heart.png
gui_*.png
Neuromancer (CC BY-SA 2.0):
default_cobble.png, based on texture by Brane praefect
default_mossycobble.png, based on texture by Brane praefect
Neuromancer (CC BY-SA 3.0):
default_dirt.png
default_furnace_*.png
Philipbenr (CC BY-SA 3.0):
default_grass.png
default_grass_side.png
Glass breaking sounds (CC BY 3.0):
1: http://www.freesound.org/people/cmusounddesign/sounds/71947/
2: http://www.freesound.org/people/Tomlija/sounds/97669/
3: http://www.freesound.org/people/lsprice/sounds/88808/
Mito551 (sounds) (CC BY-SA):
default_dig_choppy.ogg
default_dig_cracky.ogg
default_dig_crumbly.1.ogg
default_dig_crumbly.2.ogg
default_dig_dig_immediate.ogg
default_dig_oddly_breakable_by_hand.ogg
default_dug_node.1.ogg
default_dug_node.2.ogg
default_grass_footstep.1.ogg
default_grass_footstep.2.ogg
default_grass_footstep.3.ogg
default_gravel_footstep.1.ogg
default_gravel_footstep.2.ogg
default_gravel_footstep.3.ogg
default_gravel_footstep.4.ogg
default_grass_footstep.1.ogg
default_place_node.1.ogg
default_place_node.2.ogg
default_place_node.3.ogg
default_place_node_hard.1.ogg
default_place_node_hard.2.ogg
default_snow_footstep.1.ogg
default_snow_footstep.2.ogg
default_hard_footstep.1.ogg
default_hard_footstep.2.ogg
default_hard_footstep.3.ogg
default_sand_footstep.1.ogg
default_sand_footstep.2.ogg
default_wood_footstep.1.ogg
default_wood_footstep.2.ogg
default_dirt_footstep.1.ogg
default_dirt_footstep.2.ogg
default_glass_footstep.ogg
Gambit (WTFPL):
default_bronze_ingot.png
default_copper_ingot.png
default_copper_lump.png
default_iron_lump.png
default_gold_lump.png
default_clay_lump.png
default_coal.png
default_grass_*.png
default_paper.png

Some files were not shown because too many files have changed in this diff Show More