Uploaded 0gb.us_game to Github

This commit is contained in:
0gb.us 2013-02-23 05:58:42 -08:00
commit 7067f208b4
212 changed files with 12112 additions and 0 deletions

62
0gb.us_game/README.txt Normal file
View File

@ -0,0 +1,62 @@
### ### #### # # #### ### ### ### ### ###
# # # # # # # # # ### # # # # # # # # # #
# ## # # # # # # ### # # ## # ## # ## # ##
# # # # #### # # ### ## # # # # # # # # # # # #
## # # ## # # # # # ### # ## # ## # ## # ## #
# # # # # # ### # # # ### # # # # # # # # # #
### ### #### ### ### #### ### ### ### ### ###
--==-- What is this? --==--
If you don't know what Minetest is, a good place to find out about it would be http://minetest.net/.
--==-- License: --==--
Code: GNU Lesser General Public License
Media: Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
Anything added to this game must be compatible with those licenses.
The stuff in the minetest_game directory:
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
The stuff in the added directory:
Copyright (C) 2012-2013 0gb.us, Richard Palmer <0gb.us@0gb.us>
--==-- 0gb.us_game --==--
This is the game directory used on the 0gb.us:30000 server. It is not meant to be the perfect game. There are so many things I would love to see in Minetest, but most of them will not be implemented here. This game's goal is to provide an environment where users hold enough power that administrators and moderators are not necessary, while not deviating from minetest_game too much. Specifically, no new nodes may be defined, now alterations to the number of each node available may be modified, and any entities defined must have little effect on the game itself as well as have a built-in self-destruct mechanism, to prevent most of them from being saved to the SQLite file.
Some administrative tools ARE included. While the goal involves setting things up to not REQUIRE a staff, as staff does tend to make things better. Any administrative tools defined must not give the staff new capabilities. Rather, these tools provide a faster way to do what they could have already been able to do without said tools.
As stated above, this is the game used at 0gb.us:30000. I reserve the right to decline any changes to it for any or no reason. If you want to help add features or fix bug, your help is greatly appreciated, but I have a very specific vision for what I want this game to be. Please don't be offended if I decline a pull request, especially if it makes huge changes.
--==-- Usability fixes: --==--
Usability fixes may also be added to this game, provided they adhere to the basic rules imposed by this game's development. In addition, the following plugins from minetest_game are not included:
* wool and dye: These two shouldn't even be in minetest_game anyway, as there is no way to obtain them. New players type "/mods", see wool, and say "Wool is installed. How do I get it?". All these two do by default is cause confusion.
* vessels: This shouldn't be in minetest_game either. While vessels ARE craftable, they serve no purpose, and can't even be placed as nodes.
* creative: While it makes sense to have creative in minetest_game, there was no point in including it on my non-creative server.
--==-- Notes on Windows: --==--
While initially, I tried not to break compatibility with Windows, eventually, it proved to be too difficult. In all it's stupidity, Windows is case-insensitive. There is no non-hacky way around this. In Minetest, "Foo", "FOO" and "foo" are three different users. When each needs a file to store data in and there are an arbitrary number of users, the obvious answer, as two users cannot share a name, is to use the user's name as their file name. But Windows is pathetic, and (among other problems) mistakingly thinks that "Foo", "FOO" and "foo" are are the same file name. I came up with a hacky workaround that worked in Windows, but I ended up removing it. It was too hacky, and I don't want to have ugly code to try to maintain.
Therefore, know that this game is not Windows-compatible. Until Microsoft decides to make an operating system that actually functions correctly, I'll be focusing only on Linux (and whatever other operating systems Minetest is ported to), as it actually does things right. Any plugin that doesn't work in Windows should have an abort line at the top, disabling the plugin when used on a case-insensitive file system. If you add anything new to this game, please follow that convention. If you are a Windows user and you remove that line from your copy, know that you will likely mess up your data, and it will be your own fault, both for choosing to use the worlds most pathetic excuse for an operating system and for removing the failsafe. You have been warned. If you leave the failsafes in place, some functionality will be disabled, but you data shouldn't be corrupted by this game.
--==-- To do: --==--
* Rewrite whisper: The whisper plugin on the forum has many issues. I'm going to rewrite something similar from scratch, but make it actually function correctly.
* Build a crafting guide: Um. Yeah. This may take time. If you plan to take this on, know that any solution that generates actual stacks of items (even if they theoretically cannot be moved to the main inventory) will not be accepted. The crafting guide will be implemented as a page in the menu, not as a node with a formspec.
--==-- Not to do: --==--
* There are currently no plans for public bookmarking (unless it can be fully managed without staff intervention AND can be disabled via minetest.conf).
* There are no plans to make the number of points gotten from mining visible to the user (unless there is a way to disable it from minetest.conf (WILL be disabled at 0gb.us:30000)).
* There are no plans to add node renewability (such as papyrus/cactus/junglegrass/dry shrub growth or water + lava == stone). While I sorely want renewability, I think it belongs in the minetest_game, and I'm waiting for things to be renewable there, then I'll migrate it here.
* Shared locked chests without shared locked doors. If shared chests are to be added to this game, shared doors must also be added.
--==-- Notes on settings: --==--
Any type of configurations and settings must be made to work using minetest.conf when possible. When not possible (or not feasible), these things must at least be done from outside the 0gb.us_game directory. Including configuration files within the plugin directories themselves is not in any way acceptable. This makes world-specific configuration impossible with worlds sharing a plugin without having multiple copies of said plugin. If Lua is somehow needed in configuration files (and it almost always IS NOT), this can be done from the world directory, not the plugin directory. Not only that, there must always be some sort of fallback for when the configuration file is not present. In building a way to fall back to a default, you'll usually see it is much easier to read settings from minetet.conf than to write a configuration Lua script with a way to fall back if it is missing.

1
0gb.us_game/game.conf Normal file
View File

@ -0,0 +1 @@
name = 0gb.us

View File

@ -0,0 +1 @@
default

View File

@ -0,0 +1,79 @@
local function can_modify(pos, player)
local chestpos = {x=pos.x,y=pos.y-1,z=pos.z}
local node = minetest.env:get_node_or_nil(chestpos)
if not node then
return false
elseif node.name ~= "default:chest_locked" then
return true
else
local meta = minetest.env:get_meta(chestpos)
return meta:get_string("owner") == player:get_player_name()
end
end
local function parse_shop(text)
local input = text:match('^"" Input: ([%w_: ]*) Output: [%w_: ]* ""$')
local output = text:match('^"" Input: [%w_: ]* Output: ([%w_: ]*) ""$')
-- " Input: default:iron_lump 9 Output: default:papyrus "
if input and output then
return { input=input, output=output }
end
end
local sign = {}
for key, value in pairs(minetest.registered_items["default:sign_wall"]) do
sign[key] = value
end
local on_receive_fields = sign.on_receive_fields
sign.can_dig = can_modify
function sign.on_receive_fields(pos, formname, fields, sender)
if can_modify(pos, sender) then
on_receive_fields(pos, formname, fields, sender)
else
minetest.chat_send_player(sender:get_player_name(), "You may not edit this sign.")
end
end
function sign.on_punch(pos, node, puncher)
if can_modify(pos, puncher) or not puncher:is_player() then
return
end
local chestpos = {x=pos.x,y=pos.y-1,z=pos.z}
local chestinv = minetest.env:get_meta(chestpos):get_inventory()
local signtext = minetest.env:get_meta(pos):get_string("infotext")
local playerinv = puncher:get_inventory()
local shop = parse_shop(signtext)
if shop then
if not chestinv:room_for_item("main", shop.input) then
minetest.chat_send_player(puncher:get_player_name(), "ERROR: Chest inventory is full.")
elseif not chestinv:contains_item("main", shop.output) then
minetest.chat_send_player(puncher:get_player_name(), "ERROR: Chest is out of inventory.")
elseif not playerinv:room_for_item("main", shop.output) then
minetest.chat_send_player(puncher:get_player_name(), "ERROR: Your inventory if full.")
elseif not playerinv:contains_item("main", shop.input) then
minetest.chat_send_player(puncher:get_player_name(), "ERROR: Your inventory does not contain the required items.")
else
local input = playerinv:remove_item("main", shop.input)
chestinv:add_item("main", input)
local output = chestinv:remove_item("main", shop.output)
playerinv:add_item("main", output)
minetest.chat_send_player(puncher:get_player_name(), "You paid "..shop.input.." and recieved "..shop.output..".")
end
end
end
function sign.on_place(itemstack, placer, pointed_thing)
if can_modify(pointed_thing.above, placer) or not placer:is_player() then
return minetest.item_place(itemstack, placer, pointed_thing)
else
minetest.chat_send_player(placer:get_player_name(), "You may not place a sign here.")
end
end
minetest.register_node(":default:sign_wall", sign)
minetest.debug("[barter_0gb_us]:\nPlugin loaded from "..minetest.get_modpath("barter_0gb_us"))

View File

@ -0,0 +1 @@
default

View File

@ -0,0 +1,44 @@
local allowedchunks = 483*3
local poswall = allowedchunks*16+15
local negwall = -allowedchunks*16
local function iswall(pos)
for key, value in pairs(pos) do
if value < negwall or value > poswall then
return true
end
end
end
local default_dig = minetest.node_dig
function minetest.node_dig(pos, node, digger)
if iswall(pos) then
local name = digger:get_player_name()
minetest.chat_send_player(name, "You have reached the edge of the map. Digging is prohibited here.")
else
default_dig(pos, node, digger)
end
end
local default_place = minetest.item_place
function minetest.item_place(itemstack, placer, pointed_thing)
if iswall(pointed_thing.above) then
local name = placer:get_player_name()
minetest.chat_send_player(name, "You have reached the edge of the map. Placing items is prohibited here.")
else
return default_place(itemstack, placer, pointed_thing)
end
end
local default_drop = minetest.item_drop
function minetest.item_drop(itemstack, dropper, pos)
if iswall(pos) then
local name = dropper:get_player_name()
minetest.chat_send_player(name, "You have reached the edge of the map. Dropping items is prohibited here.")
else
return default_drop(itemstack, dropper, pos)
end
end
minetest.debug("[border_0gb_us]:\nPlugin loaded from "..minetest.get_modpath("border_0gb_us"))

View File

@ -0,0 +1,56 @@
function build_0gb_us.replace_with_cobble(node)
if not minetest.registered_nodes[node] or minetest.registered_nodes[node].buildable_to then
return "air"
elseif minetest.registered_nodes[node].paramtype == "light" then
if minetest.registered_nodes[node].paramtype2 == "facedir" then
return "stairs:stair_cobble"
else
return "stairs:slab_cobble"
end
elseif minetest.registered_nodes[node].on_construct then
return "default:furnace"
elseif minetest.registered_nodes[node].groups.falling_node then
return "default:gravel"
else
return "default:cobble"
end
end
function build_0gb_us.import_as_cobble(name, pos0, pos1, filename)
if filename:find("/") then
filename = build_0gb_us.directory.."/"..filename..".we"
else
filename = build_0gb_us.directory.."/"..name.."/"..filename..".we"
end
local file = io.open(filename, "r")
if file then
local player = minetest.env:get_player_by_name(name)
local min, max = build_0gb_us.normalize(pos0, pos1)
for line in file:lines() do
local data = line:split(" ")
if #data == 6 then
local cobble = build_0gb_us.replace_with_cobble(data[4])
build_0gb_us.place(player, {x=min.x+data[1],y=min.y+data[2],z=min.z+data[3]}, cobble, data[6], true)
-- Ignore data[5], which represents param1
end
end
file:close()
minetest.chat_send_player(name, "Imported as cobble.")
else
minetest.chat_send_player(name, "The file failed to load. It may be missing.")
end
end
minetest.register_chatcommand("import_cobble", {
params = "<filename>",
description = "Imports a worldedit-compatible file to the selected area in cobble form",
privs = {build=true},
func = function(name, param)
if not build_0gb_us.pos[name] or not build_0gb_us.pos[name].pos0 or not build_0gb_us.pos[name].pos1 then
minetest.chat_send_player(name, "Use /pos to set a spot to import to.")
else
build_0gb_us.import_as_cobble(name, build_0gb_us.pos[name].pos0, build_0gb_us.pos[name].pos1, param)
end
end,
})

View File

@ -0,0 +1,86 @@
for index, value in pairs({
["default:book"] = {
input = {"default:paper 3"},
output = "default book",
},
["default:bookshelf"] = {
input = {"default:book 3","default:wood 6"},
output = "default:bookshelf",
},
["default:brick"] = {
input = {"default:clay_brick 4"},
output = "default:brick",
},
["default:chest"] = {
input = {"default:wood 8"},
output = "default:chest",
},
["default:chest_locked"] = {
input = {"default:wood 8","default:steel_ingot"},
output = "default:chest",
},
["default:clay"] = {
input = {"default:clay_lump 4"},
output = "default:clay",
},
["default:dirt_with_grass"] = {
input = {"default:dirt"},
output = "default:dirt_with_grass",
},
["default:fence_wood"] = {
input = {"default:stick 6"},
output = "default:fence_wood 2",
},
["default:furnace"] = {
input = {"default:cobble 8"},
output = "default:furnace",
},
["default:ladder"] = {
input = {"default:stick 7"},
outpup = "default:ladder",
},
["default:paper"] = {
input = {"default:papyrus 3"},
output = "default:paper",
},
["default:rail"] = {
input = {"default:steel_ingot 6","default:stick"},
output = "default:rail 15",
},
--[[ ["default:sand"] = {
input = {"default:sandstone"},
output = "default:sand 4",
},]]-- commented out to remove circular crafting loops
["default:sandstone"] = {
input = {"default:sand 4"},
output = "default:sandstone",
},
["default:sign_wall"] = {
input = {"default:stick","default:wood 6"},
-- Because sticks are crafted from planks, the sticks MUST be listed before the planks to avoid error in the auto-crafter
output = "default:sign_wall",
},
["default:stick"] = {
input = {"default:wood"},
output = "default:stick 4",
},
["default:torch"] = {
input = {"default:stick", "default:coal_lump"},
output = "default:torch 4",
},
["default:wood"] = {
input = {"default:tree"},
output = "default:wood 4",
},
["stairs:stair_cobble"] = {
input = {"default:cobble 6"},
output = "stairs:stair_cobble 4",
},
["stairs:slab_cobble"] = {
input = {"default:cobble 3"},
output = "stairs:slab_cobble 3",
},
}) do
build_0gb_us.craft[index] = value
end

View File

@ -0,0 +1,341 @@
if io.open(minetest.get_modpath("build_0gb_us").."/INIT.LUA") then
return minetest.debug("[build_0gb_us]:\nThis plugin requires a case-sensitive file system to function correctly.")
end
local function craft(inv, node)
if not build_0gb_us.craft[node] then
return false
elseif not inv:room_for_item("main", build_0gb_us.craft[node].output) then
return false
end
for index, value in ipairs(build_0gb_us.craft[node].input) do
if not inv:contains_item("main", value) then
local singleitem = value:split(" ")[1]
while not inv:contains_item("main", value) do
if not craft(inv,singleitem) then
return false
end
end
end
end
for index, value in pairs(build_0gb_us.craft[node].input) do
inv:remove_item("main", value)
end
inv:add_item("main", build_0gb_us.craft[node].output)
return true
end
build_0gb_us = {
directory = minetest.setting_get("directory.build.0gb.us") or minetest.get_worldpath().."/schems",
-- compatible with worldedit by default
place = function(player, pos, placenode, dir, updateoverride)
local inv = player:get_inventory()
local node = minetest.env:get_node_or_nil(pos)
if not node or not minetest.registered_nodes[node.name] then
return
elseif minetest.registered_nodes[node.name].buildable_to then
if not minetest.registered_nodes[placenode] then
return
elseif inv:contains_item("main",{name=placenode})
or craft(inv, placenode) then
inv:remove_item("main",{name=placenode})
minetest.env:set_node(pos, {name=placenode, param2=dir})
if minetest.registered_items[node.name].after_place_node then
minetest.registered_items[node.name].after_place_node(pos, player)
-- Fixes locked chest placement in a non-hacky way. Also works for nodes defined in non-default plugins.
end
if not updateoverride then
nodeupdate(pos)
-- Prevents falling nodes and attached nodes from being placed in midair. Should be (and is) overridden for things such as world edit imports, as not overriding this can prevent legitimate constructions to fall apart when imported.
end
end
end
end,
round = function(pos)
return {
x = math.floor(pos.x + 0.5),
y = math.floor(pos.y + 0.5),
z = math.floor(pos.z + 0.5),
}
end,
normalize = function(pos0, pos1)
local min, max = {}, {}
min.x, max.x = math.min(pos0.x, pos1.x), math.max(pos0.x, pos1.x)
min.y, max.y = math.min(pos0.y, pos1.y), math.max(pos0.y, pos1.y)
min.z, max.z = math.min(pos0.z, pos1.z), math.max(pos0.z, pos1.z)
return min, max
end,
fill = function(player, pos0, pos1, node, dir)
local min, max = build_0gb_us.normalize(pos0, pos1)
for y = min.y, max.y do
for x = min.x, max.x do
for z = min.z, max.z do
build_0gb_us.place(player, {x=x,y=y,z=z}, node, dir)
end
end
end
end,
export = function(name, pos0, pos1, filename)
local min, max = build_0gb_us.normalize(pos0, pos1)
os.execute('mkdir -p "'..build_0gb_us.directory.."/"..name..'"')
local tosave = {}
local minused = {}
for y = min.y, max.y do
for x = min.x, max.x do
for z = min.z, max.z do
local node = minetest.env:get_node_or_nil({x=x,y=y,z=z})
if node then
if not minetest.registered_items[node.name]
or not minetest.registered_items[node.name].buildable_to then
table.insert(tosave,{x=x,y=y,z=z,data=node.name.." "..node.param1.." "..node.param2})
if not minused.x or x < minused.x then
minused.x = x
end
if not minused.y or y < minused.y then
minused.y = y
end
if not minused.z or z < minused.z then
minused.z = z
end
end
end
end
end
end
if minused.x then
local file = io.open(build_0gb_us.directory.."/"..name.."/"..filename..".we", "w")
for _, line in ipairs(tosave) do
file:write(line.x-minused.x.." "..line.y-minused.y.." "..line.z-minused.z.." "..line.data.."\n")
end
file:close()
minetest.chat_send_player(name, "Exported.")
else
minetest.chat_send_player(name, "Nothing found to export.")
end
end,
import = function(name, pos0, pos1, filename)
if filename:find("/") then
filename = build_0gb_us.directory.."/"..filename..".we"
else
filename = build_0gb_us.directory.."/"..name.."/"..filename..".we"
end
local file = io.open(filename, "r")
if file then
local player = minetest.env:get_player_by_name(name)
local min, max = build_0gb_us.normalize(pos0, pos1)
for line in file:lines() do
local data = line:split(" ")
if #data == 6 then
build_0gb_us.place(player, {x=min.x+data[1],y=min.y+data[2],z=min.z+data[3]}, data[4], data[6], true)
-- Ignore data[5], which represents param1
end
end
file:close()
minetest.chat_send_player(name, "Imported.")
else
minetest.chat_send_player(name, "The file failed to load. It may be missing.")
end
end,
find_cost = function(name, filename)
if filename:find("/") then
filename = build_0gb_us.directory.."/"..filename..".we"
else
filename = build_0gb_us.directory.."/"..name.."/"..filename..".we"
end
local file = io.open(filename, "r")
if file then
local count = {}
for line in file:lines() do
local data = line:split(" ")
if #data == 6 then
if not count[data[4]] then
count[data[4]] = 1
else
count[data[4]] = count[data[4]] + 1
end
end
end
file:close()
minetest.chat_send_player(name, "Imported.")
else
minetest.chat_send_player(name, "The file failed to load. It may be missing.")
end
end,
primitives = {},
blueprints = {},
craft = {},
pos = {},
}
os.execute('mkdir -p "'..build_0gb_us.directory..'"')
minetest.register_privilege("build", "May use the /build command to build structures")
minetest.register_chatcommand("build", {
params = "<structure>",
description = "Builds a structure if there are enough materials in the user's inventory",
privs = {build=true},
func = function(name, param)
local player = minetest.env:get_player_by_name(name)
local pos = player:getpos()
if not landclaim_0gb_us.can_interact(name, pos) then
owner = landclaim_0gb_us.get_owner(pos)
minetest.chat_send_player(name, "Area owned by "..owner)
return
elseif not build_0gb_us.blueprints[param] then
minetest.chat_send_player(name, 'A blueprint for "'..param..'" does not exist.')
return
else
local center = landclaim_0gb_us.get_chunk_center(pos)
build_0gb_us.blueprints[param](center, player)
end
end,
})
minetest.register_chatcommand("pos0", {
params = "",
description = "Sets position zero",
privs = {build=true},
func = function(name, param)
local player = minetest.env:get_player_by_name(name)
local pos = build_0gb_us.round(player:getpos())
if not build_0gb_us.pos[name] then
build_0gb_us.pos[name] = {}
end
build_0gb_us.pos[name].pos0 = pos
--[[ local select = minetest.env:add_entity(pos, "build_0gb_us:pos")
select:init(name, "pos1")]]
minetest.chat_send_player(name, "Position zero set to "..minetest.pos_to_string(pos))
end,
})
minetest.register_chatcommand("pos1", {
params = "",
description = "Sets position one",
privs = {build=true},
func = function(name, param)
local player = minetest.env:get_player_by_name(name)
local pos = build_0gb_us.round(player:getpos())
if not build_0gb_us.pos[name] then
build_0gb_us.pos[name] = {}
end
build_0gb_us.pos[name].pos1 = pos
--[[ local select = minetest.env:add_entity(pos, "build_0gb_us:pos")
select:init(name, "pos2")]]
minetest.chat_send_player(name, "Position one set to "..minetest.pos_to_string(pos))
end,
})
minetest.register_chatcommand("pos", {
params = "",
description = "Sets position zero and one",
privs = {build=true},
func = function(name, param)
local player = minetest.env:get_player_by_name(name)
local pos = build_0gb_us.round(player:getpos())
if not build_0gb_us.pos[name] then
build_0gb_us.pos[name] = {}
end
build_0gb_us.pos[name].pos0 = pos
build_0gb_us.pos[name].pos1 = pos
--[[ local select = minetest.env:add_entity(pos, "build_0gb_us:pos")
select:init(name, "pos")]]
minetest.chat_send_player(name, "Position zero and one both set to "..minetest.pos_to_string(pos))
end,
})
minetest.register_chatcommand("fill", {
params = "<node>",
description = "Fills an area with the given node",
privs = {build=true},
func = function(name, param)
if param == "" then
minetest.chat_send_player(name, "/fill requires an argument.")
return
end
if not build_0gb_us.pos[name] or not build_0gb_us.pos[name].pos0 or not build_0gb_us.pos[name].pos1 then
minetest.chat_send_player(name, "Use /pos0 and /pos1 to set the corners of an area.")
else
local player = minetest.env:get_player_by_name(name)
build_0gb_us.fill(player, build_0gb_us.pos[name].pos0, build_0gb_us.pos[name].pos1, param)
minetest.chat_send_player(name, "Filled.")
end
end,
})
minetest.register_chatcommand("export", {
params = "<filename>",
description = "Exports the selected area to a worldedit-compatible file",
privs = {build=true},
func = function(name, param)
if not build_0gb_us.pos[name] or not build_0gb_us.pos[name].pos0 or not build_0gb_us.pos[name].pos1 then
minetest.chat_send_player(name, "Use /pos0 and /pos1 to set the corners of an area.")
elseif param:find("/") then
minetest.chat_send_player(name, "Slashes are not allowed in file names.")
else
build_0gb_us.export(name, build_0gb_us.pos[name].pos0, build_0gb_us.pos[name].pos1, param)
end
end,
})
minetest.register_chatcommand("import", {
params = "<filename>",
description = "Imports a worldedit-compatible file to the selected area",
privs = {build=true},
func = function(name, param)
if not build_0gb_us.pos[name] or not build_0gb_us.pos[name].pos0 or not build_0gb_us.pos[name].pos1 then
minetest.chat_send_player(name, "Use /pos to set a spot to import to.")
else
build_0gb_us.import(name, build_0gb_us.pos[name].pos0, build_0gb_us.pos[name].pos1, param)
end
end,
})
minetest.register_chatcommand("importcost", {
params = "<filename>",
description = "Finds the cost of importing a given structure",
privs = {build=true},
func = build_0gb_us.find_cost
})
--[[minetest.register_entity("build_0gb_us:pos",{
on_activate = function(self, staticdata, dtime_s)
if self.owner and self.pos then
if not build_0gb_us.pos[self.owner]
or build_0gb_us.pos[self.owner][self.pos] ~= self.object.get_pos() then
self.object:remove()
end
end
end,
initial_properties = {
hp_max = 1,
physical = true,
weight = 0,
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
visual = "cube",
visual_size = {x=1.1, y=1.1},
mesh = "model",
textures = {"0gb.us_showarea.png", "0gb.us_showarea.png", "0gb.us_showarea.png", "0gb.us_showarea.png", "0gb.us_showarea.png", "0gb.us_showarea.png"}, -- number of required textures depends on visual
colors = {}, -- number of required colors depends on visual
spritediv = {x=1, y=1},
initial_sprite_basepos = {x=0, y=0},
is_visible = true,
makes_footstep_sound = false,
automatic_rotate = false,
},
init = function(self, owner, pos)
self.owner = owner
self.pos = pos
end,
})]]
dofile(minetest.get_modpath("build_0gb_us").."/craft.lua")
dofile(minetest.get_modpath("build_0gb_us").."/cobble.lua")
minetest.debug("[build_0gb_us]:\nPlugin loaded from "..minetest.get_modpath("build_0gb_us"))

View File

@ -0,0 +1 @@
default

View File

@ -0,0 +1,9 @@
minetest.registered_items["default:clay"].drop = nil
minetest.register_craft({
output = 'default:clay_lump 4',
recipe = {{'default:clay'}}
})
minetest.debug("[defaultclay_0gb_us]:\nPlugin loaded from "..minetest.get_modpath("defaultclay_0gb_us"))

View File

@ -0,0 +1 @@
landclaim_0gb_us

View File

@ -0,0 +1,34 @@
minetest.register_privilege("drain", "Lava cleanup duty? Again!?")
minetest.register_chatcommand("drain", {
params = "",
description = "Destroys all nodes that can be built to within the current map chunk ",
privs = {demigod=true},
func = function(name, param)
local player = minetest.env:get_player_by_name(name)
local pos = player:getpos()
if not landclaim_0gb_us.can_interact(name, pos) then
owner = landclaim_0gb_us.get_owner(pos)
minetest.chat_send_player(name, "Area owned by "..owner)
return
end
local center = landclaim_0gb_us.get_chunk_center(pos)
local min = math.max(center.y-7.5, 2)
for y = min,center.y+7.5 do
for x = center.x-7.5,center.x+7.5 do
for z = center.z-7.5,center.z+7.5 do
local node = minetest.env:get_node_or_nil({x=x,y=y,z=z})
if node and minetest.registered_items[node.name].buildable_to then
minetest.env:remove_node({x=x,y=y,z=z})
end
end
end
end
end,
})
minetest.debug("[drain_0gb_us]:\nPlugin loaded from "..minetest.get_modpath("drain_0gb_us"))

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 B

View File

@ -0,0 +1,34 @@
local default_dig = minetest.node_dig
function minetest.node_dig(pos, node, digger)
if not digger:is_player() then
return
end
local inv = digger:get_inventory()
local wielded = digger:get_wielded_item()
local drops = minetest.get_node_drops(node.name, wielded:get_name())
for i,v in ipairs(drops) do
if not inv:room_for_item("main", v) then
player = digger:get_player_name()
minetest.chat_send_player(player, "Your inventory is full.")
return
end
end
default_dig(pos, node, digger)
end
local __builtin_item = minetest.registered_entities["__builtin:item"]
local default_itempunch = __builtin_item.on_punch
function __builtin_item.on_punch(self, hitter)
local inv = hitter:get_inventory()
if inv:room_for_item("main", self.itemstring) then
default_itempunch(self, hitter)
else
player = hitter:get_player_name()
minetest.chat_send_player(player, "Your inventory is full.")
end
end
minetest.debug("[fullinventory_0gb_us]:\nPlugin loaded from "..minetest.get_modpath("fullinventory_0gb_us"))

View File

@ -0,0 +1,10 @@
-- This is a dummy version of inventory_plus, used to allow compatibility with things that depend on it without actually needing to use the actual inventory_plus. Useful for when you want to define a custom menu.
inventory_plus = {}
inventory_plus.register_button = function(player,name,label) end
inventory_plus.set_inventory_formspec = function(player,formspec)
player:set_inventory_formspec(formspec)
end
minetest.debug("[inventory_plus]:\nWait a minute. This isn't the real inventory_plus ...")

View File

@ -0,0 +1,55 @@
if minetest.get_modpath("bucket") then
minetest.register_craftitem(":bucket:bucket_empty", {
description = "Emtpy bucket",
inventory_image = "bucket.png",
stack_max = 1,
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
n = minetest.env:get_node(pointed_thing.under)
liquiddef = bucket.liquids[n.name]
if liquiddef ~= nil and liquiddef.source == n.name and liquiddef.itemname ~= nil then
local player = user:get_player_name()
if landclaim_0gb_us.can_interact(player, pointed_thing.under) then
minetest.env:add_node(pointed_thing.under, {name="air"})
return {name=liquiddef.itemname}
else
owner = landclaim_0gb_us.get_owner(pointed_thing.under)
minetest.chat_send_player(user:get_player_name(), "Area owned by "..owner)
end
end
end,
})
for key, value in pairs(bucket.liquids) do
if minetest.registered_items[value.itemname].on_use then
local item = minetest.registered_items[value.itemname]
local on_use = item.on_use
function item.on_use(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then
return
end
n = minetest.env:get_node(pointed_thing.under)
local player = user:get_player_name()
if minetest.registered_nodes[n.name].buildable_to then
if landclaim_0gb_us.can_interact(player, pointed_thing.under) then
return on_use(itemstack, user, pointed_thing)
else
minetest.chat_send_player(player, "Area owned by "..landclaim_0gb_us.get_owner(pointed_thing.above))
end
else
if landclaim_0gb_us.can_interact(player, pointed_thing.above) then
return on_use(itemstack, user, pointed_thing)
else
minetest.chat_send_player(player, "Area owned by "..landclaim_0gb_us.get_owner(pointed_thing.above))
end
end
end
end
end
end

View File

@ -0,0 +1,12 @@
if minetest.get_modpath("build_0gb_us") then
local place = build_0gb_us.place
function build_0gb_us.place(player, pos, node, dir)
if landclaim_0gb_us.can_interact(player:get_player_name(), pos) then
place(player, pos, node, dir)
else
local owner = landclaim_0gb_us.get_owner(pos)
minetest.chat_send_player(name, "This area is owned by "..owner)
end
end
end

View File

@ -0,0 +1,12 @@
minetest.register_chatcommand("0debug", {
params = "",
description = "debug command",
privs = {interact=true},
func = function(name, param)
local player = minetest.env:get_player_by_name(name)
local pos = player:getpos()
pos.y = pos.y + .5 --compensated for Minetest's incorrect y coordinate for player objects
minetest.chat_send_player(name, landclaim_0gb_us.get_chunk(pos))
end,
})

View File

@ -0,0 +1,15 @@
if minetest.get_modpath("default") then
local sign = minetest.registered_items["default:sign_wall"]
local on_receive_fields = sign.on_receive_fields
function sign.on_receive_fields(pos, formname, fields, sender)
local name = sender:get_player_name()
if landclaim_0gb_us.can_interact(name, pos) then
on_receive_fields(pos, formname, fields, sender)
else
local owner = landclaim_0gb_us.get_owner(pos)
minetest.chat_send_player(name, "Area owned by "..owner)
end
end
minetest.register_node(":default:sign_wall", sign)
end

View File

@ -0,0 +1 @@
points_0gb_us

View File

@ -0,0 +1,28 @@
if minetest.get_modpath("doors") then
function landclaim_0gb_us.protect_against_door(door)
local definition = minetest.registered_items[door]
local on_place = definition.on_place
function definition.on_place(itemstack, placer, pointed_thing)
local bottom = pointed_thing.above
local top = {x=pointed_thing.above.x, y=pointed_thing.above.y+1, z=pointed_thing.above.z}
local name = placer:get_player_name()
if landclaim_0gb_us.can_interact(name, top) and landclaim_0gb_us.can_interact(name, bottom) then
return on_place(itemstack, placer, pointed_thing)
else
topowner = landclaim_0gb_us.get_owner(top)
bottomowner = landclaim_0gb_us.get_owner(bottom)
if topowner and bottomowner and topowner ~= bottomowner then
minetest.chat_send_player(name, "Area owned by "..topowner.." and "..bottomowner)
elseif topowner then
minetest.chat_send_player(name, "Area owned by "..topowner)
else
minetest.chat_send_player(name, "Area owned by "..bottomowner)
end
end
end
end
landclaim_0gb_us.protect_against_door("doors:door_wood")
landclaim_0gb_us.protect_against_door("doors:door_steel")
end

View File

@ -0,0 +1,20 @@
if minetest.get_modpath("fire") then
landclaim_0gb_us.default_flame_should_extinguish = fire.flame_should_extinguish
function fire.flame_should_extinguish(pos)
local corner0 = landclaim_0gb_us.can_interact("fire!", {x=pos.x-1,y=pos.y-1,z=pos.z-1})
local corner1 = landclaim_0gb_us.can_interact("fire!", {x=pos.x-1,y=pos.y-1,z=pos.z+1})
local corner2 = landclaim_0gb_us.can_interact("fire!", {x=pos.x-1,y=pos.y+1,z=pos.z-1})
local corner3 = landclaim_0gb_us.can_interact("fire!", {x=pos.x-1,y=pos.y+1,z=pos.z+1})
local corner4 = landclaim_0gb_us.can_interact("fire!", {x=pos.x+1,y=pos.y-1,z=pos.z-1})
local corner5 = landclaim_0gb_us.can_interact("fire!", {x=pos.x+1,y=pos.y-1,z=pos.z+1})
local corner6 = landclaim_0gb_us.can_interact("fire!", {x=pos.x+1,y=pos.y+1,z=pos.z-1})
local corner7 = landclaim_0gb_us.can_interact("fire!", {x=pos.x+1,y=pos.y+1,z=pos.z+1})
if corner0 and corner1 and corner2 and corner3 and corner4 and corner5 and corner6 and corner7 then
return landclaim_0gb_us.default_flame_should_extinguish(pos)
else
return true
end
end
end

View File

@ -0,0 +1,318 @@
if io.open(minetest.get_modpath("landclaim_0gb_us").."/INIT.LUA") then
return minetest.debug("[landclaim_0gb_us]:\nThis plugin depends on points_0gb_us, which requires a case-sensitive file system to function correctly.")
end
--Configuration
local price = {
ore = minetest.setting_get("ore.landclaim.0gb.us") or "default:stone_with_iron",
number = tonumber(minetest.setting_get("number.landclaim.0gb.us") or 9),
}
-- Lua definitions:
landclaim_0gb_us = {}
local claims = {}
local filename = minetest.get_worldpath().."/0gb.us"
function landclaim_0gb_us.load_claims()
local file = io.open(filename, "r")
if file then
for line in file:lines() do
if line ~= "" then
local area = line:split(" ")
local shared = {}
if area[3] and area[3] ~= "*" then
for k,v in ipairs(area[3]:split(",")) do
shared[v] = v
end
end
claims[area[1]] = {owner=area[2], shared=shared}
end
end
file:close()
end
end
function landclaim_0gb_us.save_claims()
local file = io.open(filename, "w")
for key,value in pairs(claims) do
local sharedata = ""
for k,v in pairs(value.shared) do
sharedata = sharedata..v..","
end
local sharestring
if sharedata == "" then
sharestring = "*"
else
sharestring = sharedata:sub(1,-2)
end
file:write(key.." "..value.owner.." "..sharestring.."\n")
end
file:close()
end
function landclaim_0gb_us.get_chunk(pos)
local x = math.floor((pos.x+.5)/16)
local y = math.floor((pos.y+.5)/16)
local z = math.floor((pos.z+.5)/16)
return x..","..y..","..z
end
function landclaim_0gb_us.get_chunk_center(pos)
local x = math.floor((pos.x+.5)/16)*16+7.5
local y = math.floor((pos.y+.5)/16)*16+7.5
local z = math.floor((pos.z+.5)/16)*16+7.5
return {x=x,y=y,z=z}
end
function landclaim_0gb_us.get_owner(pos)
local chunk = landclaim_0gb_us.get_chunk(pos)
if claims[chunk] then
return claims[chunk].owner
end
end
function landclaim_0gb_us.can_interact(name, pos)
local chunk = landclaim_0gb_us.get_chunk(pos)
return claims[chunk] == nil or claims[chunk].owner == name or claims[chunk].shared[name]
end
landclaim_0gb_us.default_place = minetest.item_place
landclaim_0gb_us.default_dig = minetest.node_dig
-- Redefined Lua:
function minetest.node_dig(pos, node, digger)
local player = digger:get_player_name()
if landclaim_0gb_us.can_interact(player, pos) then
landclaim_0gb_us.default_dig(pos, node, digger)
else
minetest.chat_send_player(player, "Area owned by "..landclaim_0gb_us.get_owner(pos))
end
end
function minetest.item_place(itemstack, placer, pointed_thing)
if itemstack:get_definition().type == "node" then
owner = landclaim_0gb_us.get_owner(pointed_thing.above)
player = placer:get_player_name()
if landclaim_0gb_us.can_interact(player, pointed_thing.above) then
return landclaim_0gb_us.default_place(itemstack, placer, pointed_thing)
else
minetest.chat_send_player(player, "Area owned by "..owner)
end
else
return landclaim_0gb_us.default_place(itemstack, placer, pointed_thing)
end
end
landclaim_0gb_us.load_claims()
-- Load now
-- In-game additions:
minetest.register_chatcommand("landowner", {
params = "",
description = "tells the owner of the current map chunk",
privs = {interact=true},
func = function(name, param)
local player = minetest.env:get_player_by_name(name)
local pos = player:getpos()
pos.y = pos.y + .5 --compensated for Minetest's incorrect y coordinate for player objects
local owner = landclaim_0gb_us.get_owner(pos)
if owner then
minetest.chat_send_player(name, "This area is owned by "..owner)
else
minetest.chat_send_player(name, "This area is unowned.")
end
end,
})
minetest.register_chatcommand("claim", {
params = "",
description = "claims the current map chunk",
privs = {interact=true},
func = function(name, param)
local player = minetest.env:get_player_by_name(name)
local pos = player:getpos()
pos.y = pos.y + .5 --compensated for Minetest's incorrect y coordinate for player objects
local owner = landclaim_0gb_us.get_owner(pos)
if owner then
minetest.chat_send_player(name, "This area is already owned by "..owner)
elseif points_0gb_us.read_points(name, price.ore) < price.number then
minetest.chat_send_player(name, "You need to mine more "..price.ore.." before you can claim an area.")
else
chunk = landclaim_0gb_us.get_chunk(pos)
claims[chunk] = {owner=name,shared={}}
landclaim_0gb_us.save_claims()
minetest.chat_send_player(claims[chunk].owner, "You now own this area.")
points_0gb_us.add_points(name, price.ore, -price.number)
points_0gb_us.save(name)
end
end,
})
minetest.register_chatcommand("unclaim", {
params = "",
description = "unclaims the current map chunk",
privs = {interact=true},
func = function(name, param)
local player = minetest.env:get_player_by_name(name)
local pos = player:getpos()
pos.y = pos.y + .5 --compensated for Minetest's incorrect y coordinate for player objects
local owner = landclaim_0gb_us.get_owner(pos)
local inv = player:get_inventory()
if owner then
if owner == name then
points_0gb_us.add_points(name, price.ore, price.number)
points_0gb_us.save(name)
chunk = landclaim_0gb_us.get_chunk(pos)
claims[chunk] = nil
landclaim_0gb_us.save_claims()
minetest.chat_send_player(name, "You renounced your claim on this area.")
else
minetest.chat_send_player(name, "This area is owned by "..owner)
end
else
minetest.chat_send_player(name, "This area is unowned.")
end
end,
})
minetest.register_chatcommand("sharearea", {
params = "<name>",
description = "shares the current map chunk with <name>",
privs = {interact=true},
func = function(name, param)
local player = minetest.env:get_player_by_name(name)
local pos = player:getpos()
pos.y = pos.y + .5 --compensated for Minetest's incorrect y coordinate for player objects
local owner = landclaim_0gb_us.get_owner(pos)
if owner then
if owner == name and name ~= param then
if minetest.auth_table[param] then
claims[landclaim_0gb_us.get_chunk(pos)].shared[param] = param
landclaim_0gb_us.save_claims()
minetest.chat_send_player(name, param.." may now edit this area.")
minetest.chat_send_player(param, name.." has just shared an area with you.")
else
minetest.chat_send_player(name, param.." is not a valid player.")
end
else
minetest.chat_send_player(name, "This area is owned by "..owner)
end
else
minetest.chat_send_player(name, "This area is unowned.")
end
end,
})
minetest.register_chatcommand("unsharearea", {
params = "<name>",
description = "unshares the current map chunk with <name>",
privs = {interact=true},
func = function(name, param)
local player = minetest.env:get_player_by_name(name)
local pos = player:getpos()
pos.y = pos.y + .5 --compensated for Minetest's incorrect y coordinate for player objects
local owner = landclaim_0gb_us.get_owner(pos)
if owner then
if owner == name then
if name ~= param then
claims[landclaim_0gb_us.get_chunk(pos)].shared[param] = nil
landclaim_0gb_us.save_claims()
minetest.chat_send_player(name, param.." may no longer edit this area.")
minetest.chat_send_player(param, name.." has just revoked your editing privileges in an area.")
else
minetest.chat_send_player(name, 'Use "/unclaim" to unclaim the aria.')
end
else
minetest.chat_send_player(name, "This area is owned by "..owner)
end
else
minetest.chat_send_player(name, "This area is unowned.")
end
end,
})
minetest.register_chatcommand("mayedit", {
params = "",
description = "lists the people who may edit the current map chunk",
privs = {interact=true},
func = function(name, param)
local player = minetest.env:get_player_by_name(name)
local pos = player:getpos()
pos.y = pos.y + .5 --compensated for Minetest's incorrect y coordinate for player objects
local mayedit = landclaim_0gb_us.get_owner(pos)
if mayedit then
local chunk = landclaim_0gb_us.get_chunk(pos)
for user, user in pairs(claims[chunk].shared) do
mayedit = mayedit..", "..user
end
minetest.chat_send_player(name, mayedit)
else
minetest.chat_send_player(name, "This area is unowned.")
end
end,
})
minetest.register_entity("landclaim_0gb_us:showarea",{
on_activate = function(self, staticdata, dtime_s)
minetest.after(16,function()
self.object:remove()
end)
end,
initial_properties = {
hp_max = 1,
physical = true,
weight = 0,
collisionbox = {-8,-8,-8,8,8,8},
visual = "mesh",
visual_size = {x=16.1, y=16.1},
mesh = "0gb.us_showarea.x",
textures = {"0gb.us_showarea.png", "0gb.us_showarea.png", "0gb.us_showarea.png", "0gb.us_showarea.png", "0gb.us_showarea.png", "0gb.us_showarea.png"}, -- number of required textures depends on visual
colors = {}, -- number of required colors depends on visual
spritediv = {x=1, y=1},
initial_sprite_basepos = {x=0, y=0},
is_visible = true,
makes_footstep_sound = false,
automatic_rotate = false,
}
})
minetest.register_chatcommand("showarea", {
params = "",
description = "highlights the boundaries of the current protected area",
privs = {interact=true},
func = function(name, param)
local player = minetest.env:get_player_by_name(name)
local pos = player:getpos()
pos.y = pos.y + .5 --compensated for Minetest's incorrect y coordinate for player objects
local owner = landclaim_0gb_us.get_owner(pos)
if owner or param == "override" then
if landclaim_0gb_us.can_interact(name, pos) or param == "override" then
local entpos = landclaim_0gb_us.get_chunk_center(pos)
minetest.env:add_entity(entpos, "landclaim_0gb_us:showarea")
else
minetest.chat_send_player(name, "This area is owned by "..owner)
end
else
minetest.chat_send_player(name, "This area is unowned.")
end
end,
})
minetest.after(0,function()
local path = minetest.get_modpath("landclaim_0gb_us")
dofile(path.."/bucket.lua")
dofile(path.."/build_0gb_us.lua")
dofile(path.."/default.lua")
dofile(path.."/doors.lua")
dofile(path.."/fire.lua")
dofile(path.."/debug.lua")
end)
minetest.debug("[landclaim_0gb_us]:\nPlugin loaded from "..minetest.get_modpath("landclaim_0gb_us"))

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

View File

@ -0,0 +1,220 @@
xof 0303txt 0032
Frame Root {
FrameTransformMatrix {
1.000000, 0.000000, 0.000000, 0.000000,
0.000000, 0.000000, 1.000000, 0.000000,
0.000000, 1.000000,-0.000000, 0.000000,
0.000000, 0.000000, 0.000000, 1.000000;;
}
Frame Cube {
FrameTransformMatrix {
5.000000, 0.000000, 0.000000, 0.000000,
0.000000, 5.000000, 0.000000, 0.000000,
0.000000, 0.000000, 5.000000, 0.000000,
0.000000, 0.000000, 0.000000, 1.000000;;
}
Mesh { //Cube_001 Mesh
48;
-1.000000; 1.000000;-1.000000;,
-1.000000;-1.000000;-1.000000;,
1.000000;-1.000000;-1.000000;,
1.000000; 1.000000;-1.000000;,
0.999999;-1.000001; 1.000000;,
-1.000000;-1.000000; 1.000000;,
-1.000000; 1.000000; 1.000000;,
1.000000; 0.999999; 1.000000;,
1.000000;-1.000000;-1.000000;,
0.999999;-1.000001; 1.000000;,
1.000000; 0.999999; 1.000000;,
1.000000; 1.000000;-1.000000;,
-1.000000;-1.000000;-1.000000;,
-1.000000;-1.000000; 1.000000;,
0.999999;-1.000001; 1.000000;,
1.000000;-1.000000;-1.000000;,
-1.000000; 1.000000;-1.000000;,
-1.000000; 1.000000; 1.000000;,
-1.000000;-1.000000; 1.000000;,
-1.000000;-1.000000;-1.000000;,
-1.000000; 1.000000; 1.000000;,
-1.000000; 1.000000;-1.000000;,
1.000000; 1.000000;-1.000000;,
1.000000; 0.999999; 1.000000;,
1.000000;-1.000000;-1.000000;,
-1.000000;-1.000000;-1.000000;,
-1.000000; 1.000000;-1.000000;,
1.000000; 1.000000;-1.000000;,
-1.000000; 1.000000; 1.000000;,
-1.000000;-1.000000; 1.000000;,
0.999999;-1.000001; 1.000000;,
1.000000; 0.999999; 1.000000;,
1.000000; 0.999999; 1.000000;,
0.999999;-1.000001; 1.000000;,
1.000000;-1.000000;-1.000000;,
1.000000; 1.000000;-1.000000;,
0.999999;-1.000001; 1.000000;,
-1.000000;-1.000000; 1.000000;,
-1.000000;-1.000000;-1.000000;,
1.000000;-1.000000;-1.000000;,
-1.000000;-1.000000; 1.000000;,
-1.000000; 1.000000; 1.000000;,
-1.000000; 1.000000;-1.000000;,
-1.000000;-1.000000;-1.000000;,
1.000000; 1.000000;-1.000000;,
-1.000000; 1.000000;-1.000000;,
-1.000000; 1.000000; 1.000000;,
1.000000; 0.999999; 1.000000;;
12;
4;0;1;2;3;,
4;4;5;6;7;,
4;8;9;10;11;,
4;12;13;14;15;,
4;16;17;18;19;,
4;20;21;22;23;,
4;24;25;26;27;,
4;28;29;30;31;,
4;32;33;34;35;,
4;36;37;38;39;,
4;40;41;42;43;,
4;44;45;46;47;;
MeshNormals { //Cube_001 Normals
48;
0.000000; 0.000000;-1.000000;,
0.000000; 0.000000;-1.000000;,
0.000000; 0.000000;-1.000000;,
0.000000; 0.000000;-1.000000;,
0.000000;-0.000000; 1.000000;,
0.000000;-0.000000; 1.000000;,
0.000000;-0.000000; 1.000000;,
0.000000;-0.000000; 1.000000;,
1.000000;-0.000000; 0.000000;,
1.000000;-0.000000; 0.000000;,
1.000000;-0.000000; 0.000000;,
1.000000;-0.000000; 0.000000;,
-0.000000;-1.000000;-0.000000;,
-0.000000;-1.000000;-0.000000;,
-0.000000;-1.000000;-0.000000;,
-0.000000;-1.000000;-0.000000;,
-1.000000; 0.000000;-0.000000;,
-1.000000; 0.000000;-0.000000;,
-1.000000; 0.000000;-0.000000;,
-1.000000; 0.000000;-0.000000;,
0.000000; 1.000000; 0.000000;,
0.000000; 1.000000; 0.000000;,
0.000000; 1.000000; 0.000000;,
0.000000; 1.000000; 0.000000;,
0.000000;-0.000000; 1.000000;,
0.000000;-0.000000; 1.000000;,
0.000000;-0.000000; 1.000000;,
0.000000;-0.000000; 1.000000;,
0.000000; 0.000000;-1.000000;,
0.000000; 0.000000;-1.000000;,
0.000000; 0.000000;-1.000000;,
0.000000; 0.000000;-1.000000;,
-1.000000; 0.000000;-0.000000;,
-1.000000; 0.000000;-0.000000;,
-1.000000; 0.000000;-0.000000;,
-1.000000; 0.000000;-0.000000;,
0.000000; 1.000000; 0.000000;,
0.000000; 1.000000; 0.000000;,
0.000000; 1.000000; 0.000000;,
0.000000; 1.000000; 0.000000;,
1.000000;-0.000000; 0.000000;,
1.000000;-0.000000; 0.000000;,
1.000000;-0.000000; 0.000000;,
1.000000;-0.000000; 0.000000;,
-0.000000;-1.000000;-0.000000;,
-0.000000;-1.000000;-0.000000;,
-0.000000;-1.000000;-0.000000;,
-0.000000;-1.000000;-0.000000;;
12;
4;0;1;2;3;,
4;4;5;6;7;,
4;8;9;10;11;,
4;12;13;14;15;,
4;16;17;18;19;,
4;20;21;22;23;,
4;24;25;26;27;,
4;28;29;30;31;,
4;32;33;34;35;,
4;36;37;38;39;,
4;40;41;42;43;,
4;44;45;46;47;;
} //End of Cube_001 Normals
MeshMaterialList { //Cube_001 Material List
1;
12;
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0;;
Material Material {
0.640000; 0.640000; 0.640000; 0.000000;;
96.078431;
0.500000; 0.500000; 0.500000;;
0.000000; 0.000000; 0.000000;;
TextureFilename {"0gb.us_showarea.png";}
}
} //End of Cube_001 Material List
MeshTextureCoords { //Cube_001 UV Coordinates
48;
0.000000; 0.000000;,
1.000000; 0.000000;,
1.000000; 1.000000;,
0.000000; 1.000000;,
0.000000; 0.000000;,
1.000000; 0.000000;,
1.000000; 1.000000;,
0.000000; 1.000000;,
0.000000; 0.000000;,
1.000000; 0.000000;,
1.000000; 1.000000;,
0.000000; 1.000000;,
0.000000; 0.000000;,
1.000000; 0.000000;,
1.000000; 1.000000;,
0.000000; 1.000000;,
0.000000; 0.000000;,
1.000000; 0.000000;,
1.000000; 1.000000;,
0.000000; 1.000000;,
0.000000; 0.000000;,
1.000000; 0.000000;,
1.000000; 1.000000;,
0.000000; 1.000000;,
1.000000; 1.000000;,
1.000000; 0.000000;,
0.000000; 0.000000;,
0.000000; 1.000000;,
1.000000; 1.000000;,
1.000000; 0.000000;,
0.000000; 0.000000;,
0.000000; 1.000000;,
1.000000; 1.000000;,
1.000000; 0.000000;,
0.000000; 0.000000;,
0.000000; 1.000000;,
1.000000; 1.000000;,
1.000000; 0.000000;,
0.000000; 0.000000;,
0.000000; 1.000000;,
1.000000; 1.000000;,
1.000000; 0.000000;,
0.000000; 0.000000;,
0.000000; 1.000000;,
1.000000; 1.000000;,
1.000000; 0.000000;,
0.000000; 0.000000;,
0.000000; 1.000000;;
} //End of Cube_001 UV Coordinates
} //End of Cube_001 Mesh
} //End of Cube
} //End of Root Frame

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

View File

@ -0,0 +1,20 @@
if io.open(minetest.get_modpath("logpulverize_0gb_us").."/INIT.LUA") then
return minetest.debug("[logpulverize_0gb_us]:\nThis plugin requires a case-sensitive file system to function correctly.")
end
local directory = minetest.get_worldpath().."/logpulverize.0gb.us/"
os.execute('mkdir -p "'..directory..'"')
local func = minetest.chatcommands.pulverize.func
function minetest.chatcommands.pulverize.func(name, param)
local player = minetest.env:get_player_by_name(name)
if player and not player:get_wielded_item():is_empty() then
local file = io.open(directory..name, "a")
file:write(player:get_wielded_item():to_string().."\n")
file:close()
end
func(name, param)
end
minetest.debug("[logpulverize_0gb_us]:\nPlugin loaded from "..minetest.get_modpath("logpulverize_0gb_us"))

View File

@ -0,0 +1,39 @@
local function set_formspec(player)
player:set_inventory_formspec(
"size[8,9.5]\
list[current_player;main;0,3.5;8,6;]\
list[current_player;craft;3,0;3,3;]\
list[current_player;craftpreview;7,1;1,1;]\
button[0,0.1;3,0.5;skins;Choose Skin]"..
-- button[0,0.85;3,0.5;craftguide.0gb.us;Craft Guide]\
"button[0,1.6;3,0.5;go.teleport.0gb.us;Warp Points]\
button[0,2.35;3,0.5;die;Die (Respawn)]"
)
end
minetest.register_on_joinplayer(function(player)
set_formspec(player)
local inv = player:get_inventory()
inv:set_size("main", 8*6)
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if fields.main then
set_formspec(player)
elseif fields.die then
player:set_hp(0)
end
end)
minetest.register_chatcommand("die", {
params = "",
description = "kills you, causing you to respawn",
privs = {},
func = function(name, param)
local player = minetest.env:get_player_by_name(name)
player:set_hp(0)
end,
})
minetest.debug("[menu_0gb_us]:\nPlugin loaded from "..minetest.get_modpath("menu_0gb_us"))

View File

View File

@ -0,0 +1,66 @@
local directory = minetest.get_worldpath().."/points.0gb.us/"
local points = {}
points_0gb_us = {
load = function(name)
points[name] = {}
local file = io.open(directory..name, "r")
if file then
for line in file:lines() do
if line ~= "" then
local space = line:find(" ", 1, true)
local key = line:sub(1, space-1)
local value = line:sub(space+1)
points[name][key] = tonumber(value)
end
end
file:close()
end
end,
save = function(name)
local file = io.open(directory..name, "w")
for key,value in pairs(points[name]) do
file:write(key.." "..value.."\n")
end
file:close()
end,
unload = function(name)
points[name] = nil
end,
read_points = function(name, node)
return points[name][node] or 0
end,
add_points = function(name, node, number)
-- number can be negative
if points[name][node] then
points[name][node] = points[name][node] + number
else
points[name][node] = number
end
end,
register_ore = function(ore)
def = {}
for key, value in pairs(minetest.registered_nodes[ore]) do
def[key] = value
end
function def.after_dig_node(pos, oldnode, oldmetadata, digger)
local name = digger:get_player_name()
points_0gb_us.add_points(name, oldnode.name, 1)
points_0gb_us.save(name)
end
minetest.register_node(":"..ore, def)
end,
query = function(name)
RETURN = {}
for key, value in pairs(points[name]) do
RETURN[key] = value
end
return RETURN
end,
}

View File

@ -0,0 +1,11 @@
if io.open(minetest.get_modpath("points_0gb_us").."/INIT.LUA") then
return minetest.debug("[points_0gb_us] This plugin requires a case-sensitive file system to function correctly.")
end
local path = minetest.get_modpath("points_0gb_us")
dofile(path.."/api.lua")
dofile(path.."/startup.lua")
dofile(path.."/support.lua")
minetest.debug("[points_0gb_us]:\nPlugin loaded from "..minetest.get_modpath("points_0gb_us"))

View File

@ -0,0 +1,11 @@
local directory = minetest.get_worldpath().."/points.0gb.us/"
os.execute('mkdir -p "'..directory..'"')
minetest.register_on_joinplayer(function(player)
points_0gb_us.load(player:get_player_name())
end)
minetest.register_on_leaveplayer(function(player)
points_0gb_us.unload(player:get_player_name())
end)

View File

@ -0,0 +1,63 @@
minetest.after(1, function()
for _,ore in ipairs({
"default:stone_with_coal",
"default:stone_with_iron",
"default:stone_with_mese",
"gemstones:ruby_in_ground",
"gemstones:diamond_in_ground",
"gemstones:sapphire_in_ground",
"orichalcum:orichalcum_ore",
"titanium:titanium_in_ground",
"moreores:mineral_copper",
"moreores:mineral_tin",
"moreores:mineral_silver",
"moreores:mineral_gold",
"moreores:mineral_mithril",
"technic:mineral_diamond",
"technic:mineral_uranium",
"technic:mineral_chromium",
"technic:mineral_zinc",
"glooptest:mineral_kalite",
"glooptest:mineral_alatro",
"glooptest:mineral_talinite",
"glooptest:mineral_akalin",
"glooptest:mineral_arol",
"glooptest:mineral_desert_iron",
"glooptest:mineral_desert_coal",
"unuke:uranium",
"uranium:uranium_ore",
"gloopores:mineral_alatro",
"gloopores:mineral_kalite",
"gloopores:mineral_arol",
"gloopores:mineral_talinite",
"gloopores:mineral_akalin",
"gloopores:mineral_desert_coal",
"gloopores:mineral_desert_iron",
"gems:ruby_ore",
"gems:emerald_ore",
"diamonds:diamond_in_ground",
"gems:mineral_garnet",
"gems:mineral_aquamarine",
"gems:mineral_topaz",
"gems:mineral_diamond",
"gems:mineral_opal",
"blox:glowore",
"birthstones:alexandriteore",
"birthstones:amethystore",
"birthstones:aquamarineore",
"birthstones:diamondore",
"birthstones:emeraldore",
"birthstones:garnetore",
"birthstones:peridotore",
"birthstones:rubyore",
"birthstones:sapphireore",
"birthstones:topazore",
"birthstones:zirconore",
}) do
if minetest.registered_nodes[ore] then
points_0gb_us.register_ore(ore)
end
end
end)

View File

@ -0,0 +1,20 @@
* default
* [url=http://forum.minetest.net/viewtopic.php?id=4281]gemstones[/url]
* [url=http://forum.minetest.net/viewtopic.php?id=3913]orichalcum[/url]
* [url=http://forum.minetest.net/viewtopic.php?id=3113]titanium[/url]
* [url=http://forum.minetest.net/viewtopic.php?id=549]moreores[/url]
* [url=http://forum.minetest.net/viewtopic.php?id=2538]technic[/url]
* [url=http://forum.minetest.net/viewtopic.php?id=4345]glooptest[/url]
* [url=http://forum.minetest.net/viewtopic.php?id=1250]unuke[/url]
* [url=http://forum.minetest.net/viewtopic.php?id=2234]uranium[/url]
* [url=http://forum.minetest.net/viewtopic.php?pid=61693]gloopores[/url]
* [url=http://forum.minetest.net/viewtopic.php?id=2596]gems[/url] (naming clash)
* [url=http://forum.minetest.net/viewtopic.php?id=4294]gems[/url] (naming clash)
* [url=http://forum.minetest.net/viewtopic.php?id=2724]diamonds[/url]
* [url=http://forum.minetest.net/viewtopic.php?id=3663]birthstones[/url]
* [url=http://forum.minetest.net/viewtopic.php?id=3377]dirttest[/url]
* [url=http://forum.minetest.net/viewtopic.php?id=1960]blox[/url]
NOT
* http://forum.minetest.net/viewtopic.php?id=1241&p=2

View File

@ -0,0 +1 @@
stairs

View File

@ -0,0 +1,53 @@
for _, subname in pairs({
"wood",
"stone",
"cobble",
"brick",
"sandstone",
}) do
local slab = {}
for index, value in pairs(minetest.registered_items["stairs:slab_"..subname]) do
slab[index] = value
end
slab.on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return itemstack
end
-- If it's being placed on an another similar one, replace it with
-- a full block
local slabpos = nil
local slabnode = nil
local p0 = pointed_thing.under
local p1 = pointed_thing.above
local n0 = minetest.env:get_node(p0)
if n0.name == "stairs:slab_" .. subname and
p0.y+1 == p1.y then
slabpos = p0
slabnode = n0
end
if slabpos then
-- Remove the slab at slabpos
--[[ minetest.env:remove_node(slabpos)
-- Make a fake stack of a single item and try to place it
local fakestack = ItemStack(recipeitem)
pointed_thing.above = slabpos
fakestack = minetest.item_place(fakestack, placer, pointed_thing)
-- If the item was taken from the fake stack, decrement original
if not fakestack or fakestack:is_empty() then
itemstack:take_item(1)
-- Else put old node back
else
minetest.env:set_node(slabpos, slabnode)
end]]
return itemstack
end
-- Otherwise place regularly
return minetest.item_place(itemstack, placer, pointed_thing)
end
minetest.register_node(":stairs:slab_"..subname, slab)
end
minetest.debug("[slabfix_0gb_us] Plugin loaded from "..minetest.get_modpath("slabfix_0gb_us"))

View File

@ -0,0 +1,2 @@
inventory_plus
points_0gb_us

View File

@ -0,0 +1,254 @@
if io.open(minetest.get_modpath("teleport_0gb_us").."/INIT.LUA") then
return minetest.debug("[teleport_0gb_us] This plugin depends on points_0gb_us, which requires a case-sensitive file system to function correctly.")
end
-- Configuration:
local price = {
ore = minetest.setting_get("ore.teleport.0gb.us") or "default:stone_with_coal",
number = tonumber(minetest.setting_get("number.teleport.0gb.us") or 99),
}
-- END OF CONFIGURATION --
local directory = minetest.get_worldpath().."/teleport.0gb.us/"
local teleport = {}
local page = {}
local formspecpage = {}
os.execute('mkdir -p "'..directory..'"')
local function build_pages(name)
formspecpage[name] = {""}
local x = 0
local y = 6
local z = 0
for key, value in pairs(teleport[name]) do
if y == 6 then
y = 0
z = z + 1
formspecpage[name][z] = ""
end
formspecpage[name][z] = formspecpage[name][z].."button["..x..".5,"..y..";3,1;teleport.teleport.0gb.us;"..key.."]"
x = x + 3
if x == 12 then
x = 0
y = y + 1
end
end
end
local function load(player)
local name = player:get_player_name()
teleport[name] = {}
page[name] = 1
local file = io.open(directory..name, "r")
if file then
for line in file:lines() do
if line ~= "" then
local space = line:find(" ", 1, true)
local key = line:sub(1, space-1)
local value = line:sub(space+1)
teleport[name][key] = minetest.string_to_pos(value)
end
end
file:close()
end
build_pages(name)
end
local function save(name)
local file = io.open(directory..name, "w")
for key,value in pairs(teleport[name]) do
file:write(key.." "..minetest.pos_to_string(value).."\n")
end
file:close()
build_pages(name)
end
minetest.register_on_joinplayer(function(player)
inventory_plus.register_button(player, "go.teleport.0gb.us", "Warp Points")
load(player)
end)
minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name()
teleport[name] = nil
page[name] = nil
end)
local function warp(name, warp)
if teleport[name][warp] then
local player = minetest.env:get_player_by_name(name)
player:setpos(teleport[name][warp])
minetest.chat_send_player(name, "Teleporting to "..warp)
else
minetest.chat_send_player(name, "You don't have a warp point by that name.")
end
end
local function removewarp(name, warp)
if teleport[name][warp] then
points_0gb_us.add_points(name, price.ore, price.number)
points_0gb_us.save(name)
teleport[name][warp] = nil
save(name)
minetest.chat_send_player(name, 'Warp point "'..warp..'" removed.')
else
minetest.chat_send_player(name, "You don't have a warp point by that name.")
end
end
local function setnewwarp(name, warp)
if not string.find(warp, "^[%w_%-]+$") then
minetest.chat_send_player(name, "The chosen warp point name contains invalid characters, or is blank.")
elseif warp:len() > 19 then
minetest.chat_send_player(name, "The warp point name may have no more than nineteen characters.")
elseif teleport[name][warp] then
minetest.chat_send_player(name, "You already have a warp point by that name.")
elseif points_0gb_us.read_points(name, price.ore) < price.number then
minetest.chat_send_player(name, "You need to mine more "..price.ore.." before you can set a warp point.")
else
points_0gb_us.add_points(name, price.ore, -price.number)
points_0gb_us.save(name)
local player = minetest.env:get_player_by_name(name)
teleport[name][warp] = player:getpos()
save(name)
minetest.chat_send_player(name, 'Warp point "'..warp..'" added at current location.')
end
end
local function setwarp(name, warp)
if teleport[name][warp] then
local player = minetest.env:get_player_by_name(name)
teleport[name][warp] = player:getpos()
save(name)
minetest.chat_send_player(name, 'Warp point "'..warp..'" moved to current location.')
else
minetest.chat_send_player(name, "You don't have a warp point by that name.")
end
end
local function renamewarp(name, warp, newwarp)
if not string.find(newwarp, "^[%w_%-]+$") then
minetest.chat_send_player(name, "The chosen warp point name contains invalid characters, or is blank.")
elseif teleport[name][newwarp] then
minetest.chat_send_player(name, "The chosen warp point name is already in use.")
elseif not teleport[name][warp] then
minetest.chat_send_player(name, "That warp point does not exist.")
elseif newwarp:len() > 19 then
minetest.chat_send_player(name, "The warp point name may have no more than nineteen characters.")
else
teleport[name][newwarp] = teleport[name][warp]
teleport[name][warp] = nil
save(name)
minetest.chat_send_player(name, "Warp point renamed.")
end
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
local name = player:get_player_name()
if fields["go.teleport.0gb.us"] or fields["teleport.teleport.0gb.us"] then
if fields["teleport.teleport.0gb.us"] then
warp(name, fields["teleport.teleport.0gb.us"])
end
if fields["go.teleport.0gb.us"] == "<< Back" then
page[name] = ((page[name] - 2) % #formspecpage[name]) +1
elseif fields["go.teleport.0gb.us"] == "Next >>" then
page[name] = (page[name] % #formspecpage[name]) + 1
elseif page[name] > #formspecpage[name] then
page[name] = 1
end
inventory_plus.set_inventory_formspec(player,
"size[13,7.5]"..
"button[0.5,6.5;3,1;main;Back to main menu]"..
"button[3.5,6.5;3,1;go.teleport.0gb.us;<< Back]"..
"button[6.5,6.5;3,1;go.teleport.0gb.us;Next >>]"..
"button[9.5,6.5;3,1;edit.teleport.0gb.us;Edit warp point]"..
formspecpage[name][page[name]]
)
elseif fields["edit.teleport.0gb.us"] then
inventory_plus.set_inventory_formspec(player,
"size[13,7.5]"..
"field[8.3,0.5;4,1;name.teleport.0gb.us;Warp point name:;]"..
"field[8.3,1.5;4,1;newname.teleport.0gb.us;New warp point name:;]"..
"button[8,2;4,1;edit.teleport.0gb.us;Rename warp point]"..
"button[8,3;4,1;edit.teleport.0gb.us;Remove warp point]"..
"button[8,4;4,1;edit.teleport.0gb.us;Add warp point here]"..
"button[8,5;4,1;edit.teleport.0gb.us;Move warp point here]"..
"button[0.5,6.5;3,1;main;Back to main menu]"..
"button[9.5,6.5;3,1;go.teleport.0gb.us;Back to warp points]"
)
if fields["name.teleport.0gb.us"] then
if fields["edit.teleport.0gb.us"] == "Remove warp point" then
removewarp(name, fields["name.teleport.0gb.us"])
elseif fields["edit.teleport.0gb.us"] == "Move warp point here" then
setwarp(name, fields["name.teleport.0gb.us"])
elseif fields["edit.teleport.0gb.us"] == "Add warp point here" then
setnewwarp(name, fields["name.teleport.0gb.us"])
elseif fields["newname.teleport.0gb.us"] then
renamewarp(name, fields["name.teleport.0gb.us"], fields["newname.teleport.0gb.us"])
end
end
end
end)
minetest.register_chatcommand("warp", {
params = "<warp point>",
description = "teleports you to one of your warp points",
privs = {},
func = warp,
})
minetest.register_chatcommand("setnewwarp", {
params = "<warp point>",
description = "adds a new warp point at your current location",
privs = {},
func = setnewwarp,
})
minetest.register_chatcommand("setwarp", {
params = "<warp point>",
description = "moves one of your warp points to your current location",
privs = {},
func = setwarp,
})
minetest.register_chatcommand("renamewarp", {
params = "<warp point> <new name>",
description = "renames a warp point",
privs = {},
func = function(name, param)
params = param:split(" ")
if params[2] then
renamewarp(name, params[1], params[2])
else
minetest.chat_send_player(name, "/renamewarp requires two parameters.")
end
end,
})
minetest.register_chatcommand("removewarp", {
params = "<warp point>",
description = "removes a warp point",
privs = {},
func = removewarp,
})
minetest.register_chatcommand("listwarps", {
params = "",
description = "lists all of your warp points",
privs = {},
func = function(name, param)
for key, value in pairs(teleport[name]) do
minetest.chat_send_player(name, key..": "..minetest.pos_to_string(value))
end
end,
})
minetest.debug("[teleport_0gb_us]:\nPlugin loaded from "..minetest.get_modpath("teleport_0gb_us"))

View File

@ -0,0 +1,254 @@
if io.open(minetest.get_modpath("teleport_0gb_us").."/INIT.LUA") then
return minetest.debug("[teleport_0gb_us] This plugin depends on points_0gb_us, which requires a case-sensitive file system to function correctly.")
end
-- Configuration:
local price = {
ore = minetest.setting_get("ore.teleport.0gb.us") or "default:stone_with_coal",
number = tonumber(minetest.setting_get("number.teleport.0gb.us") or 99),
}
-- END OF CONFIGURATION --
local directory = minetest.get_worldpath().."/teleport.0gb.us/"
local teleport = {}
local page = {}
local formspecpage = {}
os.execute('mkdir -p "'..directory..'"')
local function build_pages(name)
formspecpage[name] = {""}
local x = 0
local y = 6
local z = 0
for key, value in pairs(teleport[name]) do
if y == 6 then
y = 0
z = z + 1
formspecpage[name][z] = ""
end
formspecpage[name][z] = formspecpage[name][z].."button["..x..".5,"..y..";3,1;teleport.teleport.0gb.us;"..key.."]"
x = x + 3
if x == 12 then
x = 0
y = y + 1
end
end
end
local function load(player)
local name = player:get_player_name()
teleport[name] = {}
page[name] = 1
local file = io.open(directory..name, "r")
if file then
for line in file:lines() do
if line ~= "" then
local space = line:find(" ", 1, true)
local key = line:sub(1, space-1)
local value = line:sub(space+1)
teleport[name][key] = minetest.string_to_pos(value)
end
end
file:close()
end
build_pages(name)
end
local function save(name)
local file = io.open(directory..name, "w")
for key,value in pairs(teleport[name]) do
file:write(key.." "..minetest.pos_to_string(value).."\n")
end
file:close()
build_pages(name)
end
minetest.register_on_joinplayer(function(player)
inventory_plus.register_button(player, "go.teleport.0gb.us", "Warp Points")
load(player)
end)
minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name()
teleport[name] = nil
page[name] = nil
end)
local function warp(name, warp)
if teleport[name][warp] then
local player = minetest.env:get_player_by_name(name)
player:setpos(teleport[name][warp])
minetest.chat_send_player(name, "Teleporting to "..warp)
else
minetest.chat_send_player(name, "You don't have a warp point by that name.")
end
end
local function removewarp(name, warp)
if teleport[name][warp] then
points_0gb_us.add_points(name, price.ore, price.number)
points_0gb_us.save(name)
teleport[name][warp] = nil
save(name)
minetest.chat_send_player(name, 'Warp point "'..warp..'" removed.')
else
minetest.chat_send_player(name, "You don't have a warp point by that name.")
end
end
local function setnewwarp(name, warp)
if not string.find(warp, "^[%w_%-]+$") then
minetest.chat_send_player(name, "The chosen warp point name contains invalid characters, or is blank.")
elseif warp:len() > 19 then
minetest.chat_send_player(name, "The warp point name may have no more than nineteen characters.")
elseif teleport[name][warp] then
minetest.chat_send_player(name, "You already have a warp point by that name.")
elseif points_0gb_us.read_points(name, price.ore) < price.number then
minetest.chat_send_player(name, "You need to mine more "..price.ore.." before you can set a warp point.")
else
points_0gb_us.add_points(name, price.ore, -price.number)
points_0gb_us.save(name)
local player = minetest.env:get_player_by_name(name)
teleport[name][warp] = player:getpos()
save(name)
minetest.chat_send_player(name, 'Warp point "'..warp..'" added at current location.')
end
end
local function setwarp(name, warp)
if teleport[name][warp] then
local player = minetest.env:get_player_by_name(name)
teleport[name][warp] = player:getpos()
save(name)
minetest.chat_send_player(name, 'Warp point "'..warp..'" moved to current location.')
else
minetest.chat_send_player(name, "You don't have a warp point by that name.")
end
end
local function renamewarp(name, warp, newwarp)
if not string.find(newwarp, "^[%w_%-]+$") then
minetest.chat_send_player(name, "The chosen warp point name contains invalid characters, or is blank.")
elseif teleport[name][newwarp] then
minetest.chat_send_player(name, "The chosen warp point name is already in use.")
elseif not teleport[name][warp] then
minetest.chat_send_player(name, "That warp point does not exist.")
elseif newwarp:len() > 19 then
minetest.chat_send_player(name, "The warp point name may have no more than nineteen characters.")
else
teleport[name][newwarp] = teleport[name][warp]
teleport[name][warp] = nil
save(name)
minetest.chat_send_player(name, "Warp point renamed.")
end
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
local name = player:get_player_name()
if fields["go.teleport.0gb.us"] or fields["teleport.teleport.0gb.us"] then
if fields["teleport.teleport.0gb.us"] then
warp(name, fields["teleport.teleport.0gb.us"])
end
if fields["go.teleport.0gb.us"] == "<< Back" then
page[name] = ((page[name] - 2) % #formspecpage[name]) +1
elseif fields["go.teleport.0gb.us"] == "Next >>" then
page[name] = (page[name] % #formspecpage[name]) + 1
elseif page[name] > #formspecpage[name] then
page[name] = 1
end
inventory_plus.set_inventory_formspec(player,
"size[13,7.5]"..
"button[0.5,6.5;3,1;main;Back to main menu]"..
"button[3.5,6.5;3,1;go.teleport.0gb.us;<< Back]"..
"button[6.5,6.5;3,1;go.teleport.0gb.us;Next >>]"..
"button[9.5,6.5;3,1;edit.teleport.0gb.us;Edit warp point]"..
formspecpage[name][page[name]]
)
elseif fields["edit.teleport.0gb.us"] then
inventory_plus.set_inventory_formspec(player,
"size[13,7.5]"..
"field[8.3,0.5;4,1;name.teleport.0gb.us;Warp point name:;]"..
"field[8.3,1.5;4,1;newname.teleport.0gb.us;New warp point name:;]"..
"button[8,2;4,1;edit.teleport.0gb.us;Rename warp point]"..
"button[8,3;4,1;edit.teleport.0gb.us;Remove warp point]"..
"button[8,4;4,1;edit.teleport.0gb.us;Add warp point here]"..
"button[8,5;4,1;edit.teleport.0gb.us;Move warp point here]"..
"button[0.5,6.5;3,1;main;Back to main menu]"..
"button[9.5,6.5;3,1;go.teleport.0gb.us;Back to warp points]"
)
if fields["name.teleport.0gb.us"] then
if fields["edit.teleport.0gb.us"] == "Remove warp point" then
removewarp(name, fields["name.teleport.0gb.us"])
elseif fields["edit.teleport.0gb.us"] == "Move warp point here" then
setwarp(name, fields["name.teleport.0gb.us"])
elseif fields["edit.teleport.0gb.us"] == "Add warp point here" then
setnewwarp(name, fields["name.teleport.0gb.us"])
elseif fields["newname.teleport.0gb.us"] then
renamewarp(name, fields["name.teleport.0gb.us"], fields["newname.teleport.0gb.us"])
end
end
end
end)
minetest.register_chatcommand("warp", {
params = "<warp point>",
description = "teleports you to one of your warp points",
privs = {},
func = warp,
})
minetest.register_chatcommand("setnewwarp", {
params = "<warp point>",
description = "adds a new warp point at your current location",
privs = {},
func = setnewwarp,
})
minetest.register_chatcommand("setwarp", {
params = "<warp point>",
description = "moves one of your warp points to your current location",
privs = {},
func = setwarp,
})
minetest.register_chatcommand("renamewarp", {
params = "<warp point> <new name>",
description = "renames a warp point",
privs = {},
func = function(name, param)
params = param:split(" ")
if params[2] then
renamewarp(name, params[1], params[2])
else
minetest.chat_send_player(name, "/renamewarp requires two parameters.")
end
end,
})
minetest.register_chatcommand("removewarp", {
params = "<warp point>",
description = "removes a warp point",
privs = {},
func = removewarp,
})
minetest.register_chatcommand("listwarps", {
params = "",
description = "lists all of your warp points",
privs = {},
func = function(name, param)
for key, value in pairs(teleport[name]) do
minetest.chat_send_player(name, key..": "..minetest.pos_to_string(value))
end
end,
})
minetest.debug("[teleport_0gb_us] Plugin loaded from "..minetest.get_modpath("teleport_0gb_us"))

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

View File

@ -0,0 +1,50 @@
The main game for the Minetest game engine [minetest_game]
==========================================================
To build the wholeness of the Minetest project, insert this repository as
/games/minetest_game
in the Minetest Engine.
The Minetest Engine can be found in:
https://github.com/celeron55/minetest/
Compatibility
--------------
The minetest_game github master HEAD is generally compatible with the github
master HEAD of minetest.
Additionally, when the minetest engine is tagged to be a certain version (eg.
0.4.dev-20120326), minetest_game is tagged with the version too.
When stable releases are made, minetest_game is packaged and made available in
https://github.com/celeron55/minetest_game/downloads
and in case the repository has grown too much, it may be reset. In that sense,
this is not a "real" git repository. (Package maintainers please note!)
License of source code
----------------------
Copyright (C) 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.
License of media (textures and sounds)
--------------------------------------
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
See README.txt in each mod directory for information about other authors.
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/

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>

View File

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

View File

@ -0,0 +1,103 @@
-- 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 = {}
-- 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)
-- This function can be called from any mod (that depends on bucket).
function bucket.register_liquid(source, flowing, itemname, inventory_image)
bucket.liquids[source] = {
source = source,
flowing = flowing,
itemname = itemname,
}
bucket.liquids[flowing] = bucket.liquids[source]
if itemname ~= nil then
minetest.register_craftitem(itemname, {
inventory_image = inventory_image,
stack_max = 1,
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 buildable node
n = minetest.env:get_node(pointed_thing.under)
if minetest.registered_nodes[n.name].buildable_to then
-- buildable; replace the node
minetest.env:add_node(pointed_thing.under, {name=source})
else
-- not buildable to; place the liquid above
-- check if the node above can be replaced
n = minetest.env:get_node(pointed_thing.above)
if minetest.registered_nodes[n.name].buildable_to then
minetest.env:add_node(pointed_thing.above,{name=source})
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 = 1,
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
n = minetest.env:get_node(pointed_thing.under)
liquiddef = bucket.liquids[n.name]
if liquiddef ~= nil and liquiddef.source == n.name and liquiddef.itemname ~= nil then
minetest.env:add_node(pointed_thing.under, {name="air"})
return {name=liquiddef.itemname}
end
end,
})
bucket.register_liquid(
"default:water_source",
"default:water_flowing",
"bucket:bucket_water",
"bucket_water.png"
)
bucket.register_liquid(
"default:lava_source",
"default:lava_flowing",
"bucket:bucket_lava",
"bucket_lava.png"
)
minetest.register_craft({
type = "fuel",
recipe = "bucket:bucket_lava",
burntime = 60,
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

View File

@ -0,0 +1,95 @@
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>
Originating from work by kddekadenz/Dogers:
default_grass_footstep.{1,2,3}.ogg
default_dig_crumbly.{1,2}.ogg
Cisoun's WTFPL texture pack:
default_chest_front.png
default_chest_lock.png
default_chest_side.png
default_chest_top.png
default_cobble.png
default_dirt.png
default_grass.png
default_grass_side.png
default_jungletree.png
default_jungletree_top.png
default_lava.png
default_leaves.png
default_mossycobble.png
default_sand.png
default_sapling.png
default_sign_wall.png
default_stone.png
default_tool_mesepick.png
default_tool_steelpick.png
default_tool_steelshovel.png
default_tool_stonepick.png
default_tool_stoneshovel.png
default_tool_woodpick.png
default_tool_woodshovel.png
default_tree.png
default_tree_top.png
default_water.png
Originating from G4JC's Almost MC Texture Pack:
default_wood.png
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:
default_nc_back.png
default_nc_front.png
default_nc_rb.png
default_nc_side.png
Calinou's improved default textures (CC BY-SA):
default_brick.png
default_clay_brick.png
default_papyrus.png
default_tool_steelsword.png
MirceaKitsune (WTFPL):
character.x
Jordach (CC BY-SA 3.0):
character.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/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,92 @@
-- minetest/default/leafdecay.lua
-- To enable leaf decay for a node, add it to the "leafdecay" group.
--
-- The rating of the group determines how far from a node in the group "tree"
-- the node can be without decaying.
--
-- If param2 of the node is ~= 0, the node will always be preserved. Thus, if
-- the player places a node of that kind, you will want to set param2=1 or so.
default.leafdecay_trunk_cache = {}
default.leafdecay_enable_cache = true
-- Spread the load of finding trunks
default.leafdecay_trunk_find_allow_accumulator = 0
minetest.register_globalstep(function(dtime)
local finds_per_second = 5000
default.leafdecay_trunk_find_allow_accumulator =
math.floor(dtime * finds_per_second)
end)
minetest.register_abm({
nodenames = {"group:leafdecay"},
neighbors = {"air", "group:liquid"},
-- A low interval and a high inverse chance spreads the load
interval = 2,
chance = 5,
action = function(p0, node, _, _)
--print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")")
local do_preserve = false
local d = minetest.registered_nodes[node.name].groups.leafdecay
if not d or d == 0 then
--print("not groups.leafdecay")
return
end
local n0 = minetest.env:get_node(p0)
if n0.param2 ~= 0 then
--print("param2 ~= 0")
return
end
local p0_hash = nil
if default.leafdecay_enable_cache then
p0_hash = minetest.hash_node_position(p0)
local trunkp = default.leafdecay_trunk_cache[p0_hash]
if trunkp then
local n = minetest.env:get_node(trunkp)
local reg = minetest.registered_nodes[n.name]
-- Assume ignore is a trunk, to make the thing work at the border of the active area
if n.name == "ignore" or (reg and reg.groups.tree and reg.groups.tree ~= 0) then
--print("cached trunk still exists")
return
end
--print("cached trunk is invalid")
-- Cache is invalid
table.remove(default.leafdecay_trunk_cache, p0_hash)
end
end
if default.leafdecay_trunk_find_allow_accumulator <= 0 then
return
end
default.leafdecay_trunk_find_allow_accumulator =
default.leafdecay_trunk_find_allow_accumulator - 1
-- Assume ignore is a trunk, to make the thing work at the border of the active area
local p1 = minetest.env:find_node_near(p0, d, {"ignore", "group:tree"})
if p1 then
do_preserve = true
if default.leafdecay_enable_cache then
--print("caching trunk")
-- Cache the trunk
default.leafdecay_trunk_cache[p0_hash] = p1
end
end
if not do_preserve then
-- Drop stuff other than the node itself
itemstacks = minetest.get_node_drops(n0.name)
for _, itemname in ipairs(itemstacks) do
if itemname ~= n0.name then
local p_drop = {
x = p0.x - 0.5 + math.random(),
y = p0.y - 0.5 + math.random(),
z = p0.z - 0.5 + math.random(),
}
minetest.env:add_item(p_drop, itemname)
end
end
-- Remove node
minetest.env:remove_node(p0)
end
end
})

View File

@ -0,0 +1,292 @@
-- minetest/default/mapgen.lua
--
-- Aliases for map generator outputs
--
minetest.register_alias("mapgen_air", "air")
minetest.register_alias("mapgen_stone", "default:stone")
minetest.register_alias("mapgen_tree", "default:tree")
minetest.register_alias("mapgen_leaves", "default:leaves")
minetest.register_alias("mapgen_apple", "default:apple")
minetest.register_alias("mapgen_water_source", "default:water_source")
minetest.register_alias("mapgen_dirt", "default:dirt")
minetest.register_alias("mapgen_sand", "default:sand")
minetest.register_alias("mapgen_gravel", "default:gravel")
minetest.register_alias("mapgen_clay", "default:clay")
minetest.register_alias("mapgen_lava_source", "default:lava_source")
minetest.register_alias("mapgen_cobble", "default:cobble")
minetest.register_alias("mapgen_mossycobble", "default:mossycobble")
minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass")
minetest.register_alias("mapgen_junglegrass", "default:junglegrass")
minetest.register_alias("mapgen_stone_with_coal", "default:stone_with_coal")
minetest.register_alias("mapgen_stone_with_iron", "default:stone_with_iron")
minetest.register_alias("mapgen_mese", "default:mese")
minetest.register_alias("mapgen_desert_sand", "default:desert_sand")
minetest.register_alias("mapgen_desert_stone", "default:desert_stone")
--
-- Ore generation
--
local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max)
if maxp.y < height_min or minp.y > height_max then
return
end
local y_min = math.max(minp.y, height_min)
local y_max = math.min(maxp.y, height_max)
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
local pr = PseudoRandom(seed)
local num_chunks = math.floor(chunks_per_volume * volume)
local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk)
--print("generate_ore num_chunks: "..dump(num_chunks))
for i=1,num_chunks do
local y0 = pr:next(y_min, y_max-chunk_size+1)
if y0 >= height_min and y0 <= height_max then
local x0 = pr:next(minp.x, maxp.x-chunk_size+1)
local z0 = pr:next(minp.z, maxp.z-chunk_size+1)
local p0 = {x=x0, y=y0, z=z0}
for x1=0,chunk_size-1 do
for y1=0,chunk_size-1 do
for z1=0,chunk_size-1 do
if pr:next(1,inverse_chance) == 1 then
local x2 = x0+x1
local y2 = y0+y1
local z2 = z0+z1
local p2 = {x=x2, y=y2, z=z2}
if minetest.env:get_node(p2).name == wherein then
minetest.env:set_node(p2, {name=name})
end
end
end
end
end
end
end
--print("generate_ore done")
end
function default.make_papyrus(pos, size)
for y=0,size-1 do
local p = {x=pos.x, y=pos.y+y, z=pos.z}
local nn = minetest.env:get_node(p).name
if minetest.registered_nodes[nn] and
minetest.registered_nodes[nn].buildable_to then
minetest.env:set_node(p, {name="default:papyrus"})
else
return
end
end
end
function default.make_cactus(pos, size)
for y=0,size-1 do
local p = {x=pos.x, y=pos.y+y, z=pos.z}
local nn = minetest.env:get_node(p).name
if minetest.registered_nodes[nn] and
minetest.registered_nodes[nn].buildable_to then
minetest.env:set_node(p, {name="default:cactus"})
else
return
end
end
end
-- facedir: 0/1/2/3 (head node facedir value)
-- length: length of rainbow tail
function default.make_nyancat(pos, facedir, length)
local tailvec = {x=0, y=0, z=0}
if facedir == 0 then
tailvec.z = 1
elseif facedir == 1 then
tailvec.x = 1
elseif facedir == 2 then
tailvec.z = -1
elseif facedir == 3 then
tailvec.x = -1
else
print("default.make_nyancat(): Invalid facedir: "+dump(facedir))
facedir = 0
tailvec.z = 1
end
local p = {x=pos.x, y=pos.y, z=pos.z}
minetest.env:set_node(p, {name="default:nyancat", param2=facedir})
for i=1,length do
p.x = p.x + tailvec.x
p.z = p.z + tailvec.z
minetest.env:set_node(p, {name="default:nyancat_rainbow"})
end
end
function generate_nyancats(seed, minp, maxp)
local height_min = -31000
local height_max = -32
if maxp.y < height_min or minp.y > height_max then
return
end
local y_min = math.max(minp.y, height_min)
local y_max = math.min(maxp.y, height_max)
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
local pr = PseudoRandom(seed + 9324342)
local max_num_nyancats = math.floor(volume / (16*16*16))
for i=1,max_num_nyancats do
if pr:next(0, 1000) == 0 then
local x0 = pr:next(minp.x, maxp.x)
local y0 = pr:next(minp.y, maxp.y)
local z0 = pr:next(minp.z, maxp.z)
local p0 = {x=x0, y=y0, z=z0}
default.make_nyancat(p0, pr:next(0,3), pr:next(3,15))
end
end
end
minetest.register_on_generated(function(minp, maxp, seed)
-- Generate regular ores
generate_ore("default:stone_with_coal", "default:stone", minp, maxp, seed+0, 1/8/8/8, 3, 8, -31000, 64)
generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+1, 1/12/12/12, 2, 3, -15, 2)
generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+2, 1/9/9/9, 3, 5, -63, -16)
generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+3, 1/7/7/7, 3, 5, -31000, -64)
generate_ore("default:mese", "default:stone", minp, maxp, seed+4, 1/16/16/16, 2, 3, -127, -64)
generate_ore("default:mese", "default:stone", minp, maxp, seed+5, 1/9/9/9, 3, 5, -31000,-128)
generate_ore("default:stone_with_coal", "default:stone", minp, maxp, seed+7, 1/24/24/24, 6,27, -31000, 0)
generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+6, 1/24/24/24, 6,27, -31000, -64)
if maxp.y >= 2 and minp.y <= 0 then
-- Generate clay
-- Assume X and Z lengths are equal
local divlen = 4
local divs = (maxp.x-minp.x)/divlen+1;
for divx=0+1,divs-1-1 do
for divz=0+1,divs-1-1 do
local cx = minp.x + math.floor((divx+0.5)*divlen)
local cz = minp.z + math.floor((divz+0.5)*divlen)
if minetest.env:get_node({x=cx,y=1,z=cz}).name == "default:water_source" and
minetest.env:get_node({x=cx,y=0,z=cz}).name == "default:sand" then
local is_shallow = true
local num_water_around = 0
if minetest.env:get_node({x=cx-divlen*2,y=1,z=cz+0}).name == "default:water_source" then
num_water_around = num_water_around + 1 end
if minetest.env:get_node({x=cx+divlen*2,y=1,z=cz+0}).name == "default:water_source" then
num_water_around = num_water_around + 1 end
if minetest.env:get_node({x=cx+0,y=1,z=cz-divlen*2}).name == "default:water_source" then
num_water_around = num_water_around + 1 end
if minetest.env:get_node({x=cx+0,y=1,z=cz+divlen*2}).name == "default:water_source" then
num_water_around = num_water_around + 1 end
if num_water_around >= 2 then
is_shallow = false
end
if is_shallow then
for x1=-divlen,divlen do
for z1=-divlen,divlen do
if minetest.env:get_node({x=cx+x1,y=0,z=cz+z1}).name == "default:sand" then
minetest.env:set_node({x=cx+x1,y=0,z=cz+z1}, {name="default:clay"})
end
end
end
end
end
end
end
-- Generate papyrus
local perlin1 = minetest.env:get_perlin(354, 3, 0.7, 100)
-- Assume X and Z lengths are equal
local divlen = 8
local divs = (maxp.x-minp.x)/divlen+1;
for divx=0,divs-1 do
for divz=0,divs-1 do
local x0 = minp.x + math.floor((divx+0)*divlen)
local z0 = minp.z + math.floor((divz+0)*divlen)
local x1 = minp.x + math.floor((divx+1)*divlen)
local z1 = minp.z + math.floor((divz+1)*divlen)
-- Determine papyrus amount from perlin noise
local papyrus_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 45 - 20)
-- Find random positions for papyrus based on this random
local pr = PseudoRandom(seed+1)
for i=0,papyrus_amount do
local x = pr:next(x0, x1)
local z = pr:next(z0, z1)
if minetest.env:get_node({x=x,y=1,z=z}).name == "default:dirt_with_grass" and
minetest.env:find_node_near({x=x,y=1,z=z}, 1, "default:water_source") then
default.make_papyrus({x=x,y=2,z=z}, pr:next(2, 4))
end
end
end
end
-- Generate cactuses
local perlin1 = minetest.env:get_perlin(230, 3, 0.6, 100)
-- Assume X and Z lengths are equal
local divlen = 16
local divs = (maxp.x-minp.x)/divlen+1;
for divx=0,divs-1 do
for divz=0,divs-1 do
local x0 = minp.x + math.floor((divx+0)*divlen)
local z0 = minp.z + math.floor((divz+0)*divlen)
local x1 = minp.x + math.floor((divx+1)*divlen)
local z1 = minp.z + math.floor((divz+1)*divlen)
-- Determine cactus amount from perlin noise
local cactus_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 6 - 3)
-- Find random positions for cactus based on this random
local pr = PseudoRandom(seed+1)
for i=0,cactus_amount do
local x = pr:next(x0, x1)
local z = pr:next(z0, z1)
-- Find ground level (0...15)
local ground_y = nil
for y=30,0,-1 do
if minetest.env:get_node({x=x,y=y,z=z}).name ~= "air" then
ground_y = y
break
end
end
-- If desert sand, make cactus
if ground_y and minetest.env:get_node({x=x,y=ground_y,z=z}).name == "default:desert_sand" then
default.make_cactus({x=x,y=ground_y+1,z=z}, pr:next(3, 4))
end
end
end
end
-- Generate dry shrubs
local perlin1 = minetest.env:get_perlin(329, 3, 0.6, 100)
-- Assume X and Z lengths are equal
local divlen = 16
local divs = (maxp.x-minp.x)/divlen+1;
for divx=0,divs-1 do
for divz=0,divs-1 do
local x0 = minp.x + math.floor((divx+0)*divlen)
local z0 = minp.z + math.floor((divz+0)*divlen)
local x1 = minp.x + math.floor((divx+1)*divlen)
local z1 = minp.z + math.floor((divz+1)*divlen)
-- Determine dry shrubs amount from perlin noise
local shrub_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 5 + 0)
-- Find random positions for dry shrubs based on this random
local pr = PseudoRandom(seed+1)
for i=0,shrub_amount do
local x = pr:next(x0, x1)
local z = pr:next(z0, z1)
-- Find ground level (0...15)
local ground_y = nil
for y=30,0,-1 do
if minetest.env:get_node({x=x,y=y,z=z}).name ~= "air" then
ground_y = y
break
end
end
-- If desert sand, make dry shrub
if ground_y and minetest.env:get_node({x=x,y=ground_y,z=z}).name == "default:desert_sand" then
local p = {x=x,y=ground_y+1,z=z}
local nn = minetest.env:get_node(p).name
if minetest.registered_nodes[nn] and
minetest.registered_nodes[nn].buildable_to then
minetest.env:set_node(p, {name="default:dry_shrub"})
end
end
end
end
end
end
-- Generate nyan cats
generate_nyancats(seed, minp, maxp)
end)

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,132 @@
-- Minetest 0.4 mod: player
-- See README.txt for licensing and other information.
--
-- Start of configuration area:
--
-- Player animation speed
animation_speed = 30
-- Player animation blending
-- Note: This is currently broken due to a bug in Irrlicht, leave at 0
animation_blend = 0
-- Default player appearance
default_model = "character.x"
default_textures = {"character.png", }
-- Frame ranges for each player model
function player_get_animations(model)
if model == "character.x" then
return {
stand_START = 0,
stand_END = 79,
sit_START = 81,
sit_END = 160,
lay_START = 162,
lay_END = 166,
walk_START = 168,
walk_END = 187,
mine_START = 189,
mine_END = 198,
walk_mine_START = 200,
walk_mine_END = 219
}
end
end
--
-- End of configuration area.
--
-- Player stats and animations
local player_model = {}
local player_anim = {}
local player_sneak = {}
local ANIM_STAND = 1
local ANIM_SIT = 2
local ANIM_LAY = 3
local ANIM_WALK = 4
local ANIM_WALK_MINE = 5
local ANIM_MINE = 6
-- Called when a player's appearance needs to be updated
function player_update_visuals(pl)
local name = pl:get_player_name()
player_model[name] = default_model
player_anim[name] = 0 -- Animation will be set further below immediately
player_sneak[name] = false
prop = {
mesh = default_model,
textures = default_textures,
visual = "mesh",
visual_size = {x=1, y=1},
}
pl:set_properties(prop)
end
-- Update appearance when the player joins
minetest.register_on_joinplayer(player_update_visuals)
-- Check each player and apply animations
function player_step(dtime)
for _, pl in pairs(minetest.get_connected_players()) do
local name = pl:get_player_name()
local anim = player_get_animations(player_model[name])
local controls = pl:get_player_control()
local walking = false
local animation_speed_mod = animation_speed
-- Determine if the player is walking
if controls.up or controls.down or controls.left or controls.right then
walking = true
end
-- Determine if the player is sneaking, and reduce animation speed if so
if controls.sneak and pl:get_hp() ~= 0 and (walking or controls.LMB) then
animation_speed_mod = animation_speed_mod / 2
-- Refresh player animation below if sneak state changed
if not player_sneak[name] then
player_anim[name] = 0
player_sneak[name] = true
end
else
-- Refresh player animation below if sneak state changed
if player_sneak[name] then
player_anim[name] = 0
player_sneak[name] = false
end
end
-- Apply animations based on what the player is doing
if pl:get_hp() == 0 then
if player_anim[name] ~= ANIM_LAY then
pl:set_animation({x=anim.lay_START, y=anim.lay_END}, animation_speed_mod, animation_blend)
player_anim[name] = ANIM_LAY
end
elseif walking and controls.LMB then
if player_anim[name] ~= ANIM_WALK_MINE then
pl:set_animation({x=anim.walk_mine_START, y=anim.walk_mine_END}, animation_speed_mod, animation_blend)
player_anim[name] = ANIM_WALK_MINE
end
elseif walking then
if player_anim[name] ~= ANIM_WALK then
pl:set_animation({x=anim.walk_START, y=anim.walk_END}, animation_speed_mod, animation_blend)
player_anim[name] = ANIM_WALK
end
elseif controls.LMB then
if player_anim[name] ~= ANIM_MINE then
pl:set_animation({x=anim.mine_START, y=anim.mine_END}, animation_speed_mod, animation_blend)
player_anim[name] = ANIM_MINE
end
elseif player_anim[name] ~= ANIM_STAND then
pl:set_animation({x=anim.stand_START, y=anim.stand_END}, animation_speed_mod, animation_blend)
player_anim[name] = ANIM_STAND
end
end
end
minetest.register_globalstep(player_step)
-- END

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 763 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 871 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 933 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 B

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