initial commit

FINALLY
master
Mitori Itoshiki 2013-04-20 18:42:41 +04:00
commit 7860f59f1f
1136 changed files with 93962 additions and 0 deletions

22
.gitattributes vendored Normal file
View File

@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
## Generic ignorable patterns and files
*~
.*.swp
*bak*
tags
*.vim
*.orig
*.rej

15
README.txt Normal file
View File

@ -0,0 +1,15 @@
Minetest Common Mods (0.4)
==========================
Contains common game content mods, included in the main distribution, for usage
of various Minetest games.
Install in $path_share/games/common.
Included mods
-------------
default:
Basic Minecraft-like game content.
(others):
Mods for various minor purposes.

2
game.conf Normal file
View File

@ -0,0 +1,2 @@
name = Dwarves 1.0

85
mods/bags/README.txt Normal file
View File

@ -0,0 +1,85 @@
----------------------------------
Bags for Minetest
----------------------------------
Copyright (c) 2012 cornernote, Brett O'Donnell <cornernote@gmail.com>
Source Code: https://github.com/cornernote/minetest-bags
License: GPLv3
Textures by: tonyka
Texture License: GPLv3
----------------------------------
Description
----------------------------------
Allows players to craft and attach bags to their inventory to increase player item storage capacity.
----------------------------------
Crafts
----------------------------------
8-slot bag:
-S- <- bag:small
WWW S = default:stick
WWW W = default:wood
16-slot bag:
-S- <- bag:medium
BBB S = default:stick
BBB B = bags:small
24-slot bag:
-S- <- bag:large
BBB S = default:stick
BBB B = bags:medium
----------------------------------
Modders Guide
----------------------------------
To turn your craftitem into a bag simply add bagslots=X to the groups in the node definition.
EG:
minetest.register_node("your_mod:your_item", {
description = "Your Item",
groups = {bagslots=16},
})
----------------------------------
License
----------------------------------
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 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 General Public License for more details.
You should have received a copy of the GNU 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.
----------------------------------
Credits
----------------------------------
Thank you to the minetest community who has shared their code and knowledge with me.

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

@ -0,0 +1 @@
inventory_plus

140
mods/bags/init.lua Normal file
View File

@ -0,0 +1,140 @@
--[[
Bags for Minetest
Copyright (c) 2012 cornernote, Brett O'Donnell <cornernote@gmail.com>
Source Code: https://github.com/cornernote/minetest-particles
License: GPLv3
]]--
-- get_formspec
local get_formspec = function(player,page)
if page=="bags" then
return "size[8,7.5]"
.."list[current_player;main;0,3.5;8,4;]"
.."button[0,0;2,0.5;main;Back]"
.."button[0,2;2,0.5;bag1;Bag 1]"
.."button[2,2;2,0.5;bag2;Bag 2]"
.."button[4,2;2,0.5;bag3;Bag 3]"
.."button[6,2;2,0.5;bag4;Bag 4]"
.."list[detached:"..player:get_player_name().."_bags;bag1;0.5,1;1,1;]"
.."list[detached:"..player:get_player_name().."_bags;bag2;2.5,1;1,1;]"
.."list[detached:"..player:get_player_name().."_bags;bag3;4.5,1;1,1;]"
.."list[detached:"..player:get_player_name().."_bags;bag4;6.5,1;1,1;]"
end
for i=1,4 do
if page=="bag"..i then
local image = player:get_inventory():get_stack("bag"..i, 1):get_definition().inventory_image
return "size[8,8.5]"
.."list[current_player;main;0,4.5;8,4;]"
.."button[0,0;2,0.5;main;Main]"
.."button[2,0;2,0.5;bags;Bags]"
.."image[7,0;1,1;"..image.."]"
.."list[current_player;bag"..i.."contents;0,1;8,3;]"
end
end
end
-- register_on_player_receive_fields
minetest.register_on_player_receive_fields(function(player, formname, fields)
if fields.bags then
inventory_plus.set_inventory_formspec(player, get_formspec(player,"bags"))
return
end
for i=1,4 do
local page = "bag"..i
if fields[page] then
if player:get_inventory():get_stack(page, 1):get_definition().groups.bagslots==nil then
page = "bags"
end
inventory_plus.set_inventory_formspec(player, get_formspec(player,page))
return
end
end
end)
-- register_on_joinplayer
minetest.register_on_joinplayer(function(player)
inventory_plus.register_button(player,"bags","Bags")
local player_inv = player:get_inventory()
local bags_inv = minetest.create_detached_inventory(player:get_player_name().."_bags",{
on_put = function(inv, listname, index, stack, player)
player:get_inventory():set_stack(listname, index, stack)
player:get_inventory():set_size(listname.."contents", stack:get_definition().groups.bagslots)
end,
on_take = function(inv, listname, index, stack, player)
player:get_inventory():set_stack(listname, index, nil)
end,
allow_put = function(inv, listname, index, stack, player)
if stack:get_definition().groups.bagslots then
return 1
else
return 0
end
end,
allow_take = function(inv, listname, index, stack, player)
if player:get_inventory():is_empty(listname.."contents")==true then
return stack:get_size(listname)
else
return 0
end
end,
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
return 0
end,
})
for i=1,4 do
local bag = "bag"..i
player_inv:set_size(bag, 1)
bags_inv:set_size(bag, 1)
bags_inv:set_stack(bag,1,player_inv:get_stack(bag,1))
end
end)
-- register bag tools
minetest.register_tool("bags:small", {
description = "Small Bag",
inventory_image = "bags_small.png",
groups = {bagslots=8},
})
minetest.register_tool("bags:medium", {
description = "Medium Bag",
inventory_image = "bags_medium.png",
groups = {bagslots=16},
})
minetest.register_tool("bags:large", {
description = "Large Bag",
inventory_image = "bags_large.png",
groups = {bagslots=24},
})
-- register bag crafts
minetest.register_craft({
output = "bags:small",
recipe = {
{"", "default:stick", ""},
{"default:wood", "default:wood", "default:wood"},
{"default:wood", "default:wood", "default:wood"},
},
})
minetest.register_craft({
output = "bags:medium",
recipe = {
{"", "default:stick", ""},
{"bags:small", "bags:small", "bags:small"},
{"bags:small", "bags:small", "bags:small"},
},
})
minetest.register_craft({
output = "bags:large",
recipe = {
{"", "default:stick", ""},
{"bags:medium", "bags:medium", "bags:medium"},
{"bags:medium", "bags:medium", "bags:medium"},
},
})
-- log that we started
minetest.log("action", "[MOD]"..minetest.get_current_modname().." -- loaded from "..minetest.get_modpath(minetest.get_current_modname()))

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

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

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

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

@ -0,0 +1 @@
default

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

@ -0,0 +1,157 @@
--
-- Helper functions
--
local function is_water(pos)
local nn = minetest.env:get_node(pos).name
return minetest.get_item_group(nn, "water") ~= 0
end
local function get_sign(i)
if i == 0 then
return 0
else
return i/math.abs(i)
end
end
local function get_velocity(v, yaw, y)
local x = math.cos(yaw)*v
local z = math.sin(yaw)*v
return {x=x, y=y, z=z}
end
local function get_v(v)
return math.sqrt(v.x^2+v.z^2)
end
--
-- Cart entity
--
local boat = {
physical = true,
collisionbox = {-0.6,-0.4,-0.6, 0.6,0.3,0.6},
visual = "mesh",
mesh = "boat.x",
textures = {"default_wood.png"},
driver = nil,
v = 0,
}
function boat:on_rightclick(clicker)
if not clicker or not clicker:is_player() then
return
end
if self.driver and clicker == self.driver then
self.driver = nil
clicker:set_detach()
elseif not self.driver then
self.driver = clicker
clicker:set_attach(self.object, "", {x=0,y=5,z=0}, {x=0,y=0,z=0})
self.object:setyaw(clicker:get_look_yaw())
end
end
function boat:on_activate(staticdata, dtime_s)
self.object:set_armor_groups({immortal=1})
if staticdata then
self.v = tonumber(staticdata)
end
end
function boat:get_staticdata()
return tostring(v)
end
function boat:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
self.object:remove()
if puncher and puncher:is_player() then
puncher:get_inventory():add_item("main", "boats:boat")
end
end
function boat:on_step(dtime)
self.v = get_v(self.object:getvelocity())*get_sign(self.v)
if self.driver then
local ctrl = self.driver:get_player_control()
if ctrl.up then
self.v = self.v+0.1
end
if ctrl.down then
self.v = self.v-0.08
end
if ctrl.left then
self.object:setyaw(self.object:getyaw()+math.pi/120+dtime*math.pi/120)
end
if ctrl.right then
self.object:setyaw(self.object:getyaw()-math.pi/120-dtime*math.pi/120)
end
end
local s = get_sign(self.v)
self.v = self.v - 0.02*s
if s ~= get_sign(self.v) then
self.object:setvelocity({x=0, y=0, z=0})
self.v = 0
return
end
if math.abs(self.v) > 4.5 then
self.v = 4.5*get_sign(self.v)
end
local p = self.object:getpos()
p.y = p.y-0.5
if not is_water(p) then
if minetest.registered_nodes[minetest.env:get_node(p).name].walkable then
self.v = 0
end
self.object:setacceleration({x=0, y=-10, z=0})
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y))
else
p.y = p.y+1
if is_water(p) then
self.object:setacceleration({x=0, y=10, z=0})
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y))
else
self.object:setacceleration({x=0, y=0, z=0})
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), 0))
local pos = self.object:getpos()
pos.y = math.floor(pos.y)+0.5
self.object:setpos(pos)
end
end
end
minetest.register_entity("boats:boat", boat)
minetest.register_craftitem("boats:boat", {
description = "Boat",
inventory_image = minetest.inventorycube("boat_top.png", "boat_side.png", "boat_side.png"),
wield_image = "boat_side.png",
liquids_pointable = true,
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return
end
if not is_water(pointed_thing.under) then
return
end
pointed_thing.under.y = pointed_thing.under.y+0.5
minetest.env:add_entity(pointed_thing.under, "boats:boat")
itemstack:take_item()
return itemstack
end,
})
minetest.register_craft({
output = "boats:boat",
recipe = {
{"", "", ""},
{"group:wood", "", "group:wood"},
{"group:wood", "group:wood", "group:wood"},
},
})

11110
mods/boats/models/boat.x Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

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

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

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

@ -0,0 +1 @@
default

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

@ -0,0 +1,124 @@
-- Minetest 0.4 mod: bones
-- See README.txt for licensing and other information.
local function is_owner(pos, name)
local owner = minetest.env:get_meta(pos):get_string("owner")
if owner == "" or owner == name then
return true
end
return false
end
minetest.register_node("bones:bones", {
description = "Bones",
tiles = {
"bones_top.png",
"bones_bottom.png",
"bones_side.png",
"bones_side.png",
"bones_rear.png",
"bones_front.png"
},
paramtype2 = "facedir",
groups = {dig_immediate=2},
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_gravel_footstep", gain=0.45},
}),
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
if is_owner(pos, player:get_player_name()) then
return count
end
return 0
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
return 0
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if is_owner(pos, player:get_player_name()) then
return stack:get_count()
end
return 0
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.env:get_meta(pos)
if meta:get_string("owner") ~= "" and meta:get_inventory():is_empty("main") then
meta:set_string("infotext", meta:get_string("owner").."'s old bones")
meta:set_string("formspec", "")
meta:set_string("owner", "")
end
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.env:get_meta(pos)
local meta2 = meta
meta:from_table(oldmetadata)
local inv = meta:get_inventory()
for i=1,inv:get_size("main") do
local stack = inv:get_stack("main", i)
if not stack:is_empty() then
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
minetest.env:add_item(p, stack)
end
end
meta:from_table(meta2:to_table())
end,
on_timer = function(pos, elapsed)
local meta = minetest.env:get_meta(pos)
local time = meta:get_int("time")+elapsed
local publish = 1200
if tonumber(minetest.setting_get("share_bones_time")) then
publish = tonumber(minetest.setting_get("share_bones_time"))
end
if publish == 0 then
return
end
if time >= publish then
meta:set_string("infotext", meta:get_string("owner").."'s old bones")
meta:set_string("owner", "")
else
return true
end
end,
})
minetest.register_on_dieplayer(function(player)
if minetest.setting_getbool("creative_mode") then
return
end
local pos = player:getpos()
pos.x = math.floor(pos.x+0.5)
pos.y = math.floor(pos.y+0.5)
pos.z = math.floor(pos.z+0.5)
local param2 = minetest.dir_to_facedir(player:get_look_dir())
minetest.env:add_node(pos, {name="bones:bones", param2=param2})
local meta = minetest.env:get_meta(pos)
local inv = meta:get_inventory()
local player_inv = player:get_inventory()
inv:set_size("main", 8*4)
local empty_list = inv:get_list("main")
inv:set_list("main", player_inv:get_list("main"))
player_inv:set_list("main", empty_list)
for i=1,player_inv:get_size("craft") do
inv:add_item("main", player_inv:get_stack("craft", i))
player_inv:set_stack("craft", i, nil)
end
meta:set_string("formspec", "size[8,9;]"..
"list[current_name;main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", player:get_player_name().."'s fresh bones")
meta:set_string("owner", player:get_player_name())
meta:set_int("time", 0)
local timer = minetest.env:get_node_timer(pos)
timer:start(10)
end)

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 412 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

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

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

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

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

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

@ -0,0 +1,135 @@
-- Minetest 0.4 mod: bucket
-- See README.txt for licensing and other information.
local LIQUID_MAX = 8 --The number of water levels when liquid_finite is enabled
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, name)
bucket.liquids[source] = {
source = source,
flowing = flowing,
itemname = itemname,
}
bucket.liquids[flowing] = bucket.liquids[source]
if itemname ~= nil then
minetest.register_craftitem(itemname, {
description = name,
inventory_image = inventory_image,
stack_max = 1,
liquids_pointable = true,
groups = {not_in_creative_inventory=1},
on_place = function(itemstack, user, pointed_thing)
-- Must be pointing to node
if pointed_thing.type ~= "node" then
return
end
local place_liquid = function(pos, node, source, flowing, fullness)
if math.floor(fullness/128) == 1 or (not minetest.setting_getbool("liquid_finite")) then
minetest.env:add_node(pos, {name=source, param2=fullness})
return
elseif node.name == flowing then
fullness = fullness + node.param2
elseif node.name == source then
fullness = LIQUID_MAX
end
if fullness >= LIQUID_MAX then
minetest.env:add_node(pos, {name=source, param2=LIQUID_MAX})
else
minetest.env:add_node(pos, {name=flowing, param2=fullness})
end
end
-- Check if pointing to a buildable node
local node = minetest.env:get_node(pointed_thing.under)
local fullness = tonumber(itemstack:get_metadata())
if not fullness then fullness = LIQUID_MAX end
if minetest.registered_nodes[node.name].buildable_to then
-- buildable; replace the node
place_liquid(pointed_thing.under, node, source, flowing, fullness)
else
-- not buildable to; place the liquid above
-- check if the node above can be replaced
local node = minetest.env:get_node(pointed_thing.above)
if minetest.registered_nodes[node.name].buildable_to then
place_liquid(pointed_thing.above, node, source, flowing, fullness)
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
node = minetest.env:get_node(pointed_thing.under)
liquiddef = bucket.liquids[node.name]
if liquiddef ~= nil and liquiddef.itemname ~= nil and (node.name == liquiddef.source or
(node.name == liquiddef.flowing and minetest.setting_getbool("liquid_finite"))) then
minetest.env:add_node(pointed_thing.under, {name="air"})
if node.name == liquiddef.source then node.param2 = LIQUID_MAX end
return ItemStack({name = liquiddef.itemname, metadata = tostring(node.param2)})
end
end,
})
bucket.register_liquid(
"default:water_source",
"default:water_flowing",
"bucket:bucket_water",
"bucket_water.png",
"Water Bucket"
)
bucket.register_liquid(
"default:lava_source",
"default:lava_flowing",
"bucket:bucket_lava",
"bucket_lava.png",
"Lava Bucket"
)
minetest.register_craft({
type = "fuel",
recipe = "bucket:bucket_lava",
burntime = 60,
replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}},
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -0,0 +1,8 @@
=== BUILTIN_ITEM MOD for MINETEST-C55 ===
by PilzAdam
This mod adds new features to the builtin items:
- They are pushed by flowing water
- They are destroyed by lava
- They are removed after 300 seconds or the time that is specified by
remove_items in minetest.conf

113
mods/builtin_item/init.lua Normal file
View File

@ -0,0 +1,113 @@
-- Minetest: builtin/item_entity.lua
minetest.register_entity(":__builtin:item", {
initial_properties = {
hp_max = 1,
physical = true,
collisionbox = {-0.17,-0.17,-0.17, 0.17,0.17,0.17},
visual = "sprite",
visual_size = {x=0.5, y=0.5},
textures = {""},
spritediv = {x=1, y=1},
initial_sprite_basepos = {x=0, y=0},
is_visible = false,
},
itemstring = '',
physical_state = true,
timer = 0,
set_item = function(self, itemstring)
self.itemstring = itemstring
local stack = ItemStack(itemstring)
local itemtable = stack:to_table()
local itemname = nil
if itemtable then
itemname = stack:to_table().name
end
local item_texture = nil
local item_type = ""
if minetest.registered_items[itemname] then
item_texture = minetest.registered_items[itemname].inventory_image
item_type = minetest.registered_items[itemname].type
end
prop = {
is_visible = true,
visual = "sprite",
textures = {"unknown_item.png"}
}
prop.visual = "wielditem"
prop.textures = {itemname}
prop.visual_size = {x=0.20, y=0.20}
prop.automatic_rotate = math.pi * 0.25
self.object:set_properties(prop)
end,
get_staticdata = function(self)
--return self.itemstring
return minetest.serialize({
itemstring = self.itemstring,
always_collect = self.always_collect,
})
end,
on_activate = function(self, staticdata)
if string.sub(staticdata, 1, string.len("return")) == "return" then
local data = minetest.deserialize(staticdata)
if data and type(data) == "table" then
self.itemstring = data.itemstring
self.always_collect = data.always_collect
end
else
self.itemstring = staticdata
end
self.object:set_armor_groups({immortal=1})
self.object:setvelocity({x=0, y=2, z=0})
self.object:setacceleration({x=0, y=-10, z=0})
self:set_item(self.itemstring)
end,
on_step = function(self, dtime)
self.timer = self.timer + dtime
if (self.timer > 300) then
self.object:remove()
end
if self.itemstring == "air" then
self.object:remove()
end
local p = self.object:getpos()
local nn = minetest.env:get_node(p).name
if nn == "default:lava_source" or nn == "default:lava_flowing" then
minetest.sound_play("lava_hiss", {pos=p, loop=false})
self.object:remove()
end
noder = minetest.env:get_node(p).name
p.y = p.y - 0.3
local nn = minetest.env:get_node(p).name
if not minetest.registered_nodes[nn] or minetest.registered_nodes[nn].walkable then
if self.physical_state then
self.object:setvelocity({x=0, y=0, z=0})
self.object:setacceleration({x=0, y=0, z=0})
self.physical_state = false
self.object:set_properties({
physical = false
})
end
else
if not self.physical_state then
self.object:setvelocity({x=0,y=0,z=0})
self.object:setacceleration({x=0, y=-10, z=0})
self.physical_state = true
self.object:set_properties({
physical = true
})
end
end
end,
on_punch = function(self, hitter)
if self.itemstring ~= '' then
hitter:get_inventory():add_item("main", self.itemstring)
end
self.object:remove()
end,
})

Binary file not shown.

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

@ -0,0 +1,22 @@
Minetest 0.4 mod: carts
=======================
by PilzAdam
License of source code:
-----------------------
WTFPL
License of media (textures, sounds and models):
-----------------------------------------------
CC-0
Authors of media files:
-----------------------
kddekadenz:
cart_bottom.png
cart_side.png
cart_top.png
Zeg9:
cart.x
cart.png

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

@ -0,0 +1 @@
default

56
mods/carts/functions.lua Normal file
View File

@ -0,0 +1,56 @@
--
-- Helper functions
--
cart_func = {}
function cart_func:get_sign(z)
if z == 0 then
return 0
else
return z/math.abs(z)
end
end
-- Returns the velocity as a unit vector
-- The smaller part of the vector will be turned to 0
function cart_func:velocity_to_dir(v)
if math.abs(v.x) > math.abs(v.z) then
return {x=cart_func:get_sign(v.x), y=cart_func:get_sign(v.y), z=0}
else
return {x=0, y=cart_func:get_sign(v.y), z=cart_func:get_sign(v.z)}
end
end
function cart_func:is_rail(p)
local nn = minetest.env:get_node(p).name
return minetest.get_item_group(nn, "rail") ~= 0
end
function cart_func:is_int(z)
z = math.abs(z)
return math.abs(math.floor(z+0.5)-z) <= 0.1
end
cart_func.v3 = {}
function cart_func.v3:add(v1, v2)
return {x=v1.x+v2.x, y=v1.y+v2.y, z=v1.z+v2.z}
end
function cart_func.v3:copy(v)
return {x=v.x, y=v.y, z=v.z}
end
function cart_func.v3:round(v)
return {
x = math.floor(v.x+0.5),
y = math.floor(v.y+0.5),
z = math.floor(v.z+0.5),
}
end
function cart_func.v3:equal(v1, v2)
return v1.x == v2.x and v1.y == v2.y and v1.z == v2.z
end

440
mods/carts/init.lua Normal file
View File

@ -0,0 +1,440 @@
dofile(minetest.get_modpath("carts").."/functions.lua")
--
-- Cart entity
--
local cart = {
physical = false,
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
visual = "mesh",
mesh = "cart.x",
visual_size = {x=1, y=1},
textures = {"cart.png"},
driver = nil,
velocity = {x=0, y=0, z=0},
old_pos = nil,
old_velocity = nil,
MAX_V = 15, -- Limit of the velocity
}
function cart:on_rightclick(clicker)
if not clicker or not clicker:is_player() then
return
end
if self.driver and clicker == self.driver then
self.driver = nil
clicker:set_detach()
elseif not self.driver then
self.driver = clicker
clicker:set_attach(self.object, "", {x=0,y=5,z=0}, {x=0,y=0,z=0})
end
end
function cart:on_activate(staticdata, dtime_s)
self.object:set_armor_groups({immortal=1})
if staticdata then
local tmp = minetest.deserialize(staticdata)
if tmp then
self.velocity = tmp.velocity
end
end
self.old_pos = self.object:getpos()
self.old_velocity = self.velocity
end
function cart:get_staticdata()
return minetest.serialize({
velocity = self.velocity,
})
end
-- Remove the cart if holding a tool or accelerate it
function cart:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
if not puncher or not puncher:is_player() then
return
end
if puncher:get_player_control().sneak then
self.object:remove()
puncher:get_inventory():add_item("main", "carts:cart")
return
end
if puncher == self.driver then
return
end
local d = cart_func:velocity_to_dir(direction)
local s = self.velocity
if time_from_last_punch > tool_capabilities.full_punch_interval then
time_from_last_punch = tool_capabilities.full_punch_interval
end
local f = 4*(time_from_last_punch/tool_capabilities.full_punch_interval)
local v = {x=s.x+d.x*f, y=s.y, z=s.z+d.z*f}
if math.abs(v.x) < 6 and math.abs(v.z) < 6 then
self.velocity = v
else
if math.abs(self.velocity.x) < 6 and math.abs(v.x) >= 6 then
self.velocity.x = 6*cart_func:get_sign(self.velocity.x)
end
if math.abs(self.velocity.z) < 6 and math.abs(v.z) >= 6 then
self.velocity.z = 6*cart_func:get_sign(self.velocity.z)
end
end
end
-- Returns the direction as a unit vector
function cart:get_rail_direction(pos, dir)
local d = cart_func.v3:copy(dir)
-- Check front
d.y = 0
local p = cart_func.v3:add(cart_func.v3:copy(pos), d)
if cart_func:is_rail(p) then
return d
end
-- Check downhill
d.y = -1
p = cart_func.v3:add(cart_func.v3:copy(pos), d)
if cart_func:is_rail(p) then
return d
end
-- Check uphill
d.y = 1
p = cart_func.v3:add(cart_func.v3:copy(pos), d)
if cart_func:is_rail(p) then
return d
end
d.y = 0
-- Check left and right
local view_dir
local other_dir
local a
if d.x == 0 and d.z ~= 0 then
view_dir = "z"
other_dir = "x"
if d.z < 0 then
a = {1, -1}
else
a = {-1, 1}
end
elseif d.z == 0 and d.x ~= 0 then
view_dir = "x"
other_dir = "z"
if d.x > 0 then
a = {1, -1}
else
a = {-1, 1}
end
else
return {x=0, y=0, z=0}
end
d[view_dir] = 0
d[other_dir] = a[1]
p = cart_func.v3:add(cart_func.v3:copy(pos), d)
if cart_func:is_rail(p) then
return d
end
d.y = -1
p = cart_func.v3:add(cart_func.v3:copy(pos), d)
if cart_func:is_rail(p) then
return d
end
d.y = 0
d[other_dir] = a[2]
p = cart_func.v3:add(cart_func.v3:copy(pos), d)
if cart_func:is_rail(p) then
return d
end
d.y = -1
p = cart_func.v3:add(cart_func.v3:copy(pos), d)
if cart_func:is_rail(p) then
return d
end
d.y = 0
return {x=0, y=0, z=0}
end
function cart:calc_rail_direction(pos, vel)
local velocity = cart_func.v3:copy(vel)
local p = cart_func.v3:copy(pos)
if cart_func:is_int(p.x) and cart_func:is_int(p.z) then
local dir = cart_func:velocity_to_dir(velocity)
local dir_old = cart_func.v3:copy(dir)
dir = self:get_rail_direction(cart_func.v3:round(p), dir)
local v = math.max(math.abs(velocity.x), math.abs(velocity.z))
velocity = {
x = v * dir.x,
y = v * dir.y,
z = v * dir.z,
}
if cart_func.v3:equal(velocity, {x=0, y=0, z=0}) then
-- First try this HACK
-- Move the cart on the rail if above or under it
if cart_func:is_rail(cart_func.v3:add(p, {x=0, y=1, z=0})) and vel.y >= 0 then
p = cart_func.v3:add(p, {x=0, y=1, z=0})
return self:calc_rail_direction(p, vel)
end
if cart_func:is_rail(cart_func.v3:add(p, {x=0, y=-1, z=0})) and vel.y <= 0 then
p = cart_func.v3:add(p, {x=0, y=-1, z=0})
return self:calc_rail_direction(p, vel)
end
-- Now the HACK gets really dirty
if cart_func:is_rail(cart_func.v3:add(p, {x=0, y=2, z=0})) and vel.y >= 0 then
p = cart_func.v3:add(p, {x=0, y=1, z=0})
return self:calc_rail_direction(p, vel)
end
if cart_func:is_rail(cart_func.v3:add(p, {x=0, y=-2, z=0})) and vel.y <= 0 then
p = cart_func.v3:add(p, {x=0, y=-1, z=0})
return self:calc_rail_direction(p, vel)
end
return {x=0, y=0, z=0}, p
end
if not cart_func.v3:equal(dir, dir_old) then
return velocity, cart_func.v3:round(p)
end
end
return velocity, p
end
function cart:on_step(dtime)
local pos = self.object:getpos()
local dir = cart_func:velocity_to_dir(self.velocity)
-- Stop the cart if the velocity is nearly 0
-- Only if on a flat railway
if dir.y == 0 then
if math.abs(self.velocity.x) < 0.1 and math.abs(self.velocity.z) < 0.1 then
-- Start the cart if powered from mesecons
local a = tonumber(minetest.env:get_meta(pos):get_string("cart_acceleration"))
if a then
for _,y in ipairs({0,-1,1}) do
for _,z in ipairs({1,-1}) do
if cart_func.v3:equal(self:get_rail_direction(self.object:getpos(), {x=0, y=y, z=z}), {x=0, y=y, z=z}) then
self.velocity = {
x = 0,
y = 0.2*y,
z = 0.2*z,
}
self.old_velocity = self.velocity
return
end
end
for _,x in ipairs({1,-1}) do
if cart_func.v3:equal(self:get_rail_direction(self.object:getpos(), {x=x, y=y, z=0}), {x=x, y=y, z=0}) then
self.velocity = {
x = 0.2*x,
y = 0.2*y,
z = 0,
}
self.old_velocity = self.velocity
return
end
end
end
end
self.velocity = {x=0, y=0, z=0}
self.object:setvelocity(self.velocity)
self.old_velocity = self.velocity
self.old_pos = self.object:getpos()
return
end
end
--
-- Set the new moving direction
--
-- Recalcualte the rails that are passed since the last server step
local old_dir = cart_func:velocity_to_dir(self.old_velocity)
if old_dir.x ~= 0 then
local sign = cart_func:get_sign(pos.x-self.old_pos.x)
while true do
if sign ~= cart_func:get_sign(pos.x-self.old_pos.x) or pos.x == self.old_pos.x then
break
end
self.old_pos.x = self.old_pos.x + cart_func:get_sign(pos.x-self.old_pos.x)*0.1
self.old_pos.y = self.old_pos.y + cart_func:get_sign(pos.x-self.old_pos.x)*0.1*old_dir.y
self.old_velocity, self.old_pos = self:calc_rail_direction(self.old_pos, self.old_velocity)
old_dir = cart_func:velocity_to_dir(self.old_velocity)
if not cart_func.v3:equal(cart_func:velocity_to_dir(self.old_velocity), dir) then
self.velocity = self.old_velocity
pos = self.old_pos
self.object:setpos(self.old_pos)
break
end
end
elseif old_dir.z ~= 0 then
local sign = cart_func:get_sign(pos.z-self.old_pos.z)
while true do
if sign ~= cart_func:get_sign(pos.z-self.old_pos.z) or pos.z == self.old_pos.z then
break
end
self.old_pos.z = self.old_pos.z + cart_func:get_sign(pos.z-self.old_pos.z)*0.1
self.old_pos.y = self.old_pos.y + cart_func:get_sign(pos.z-self.old_pos.z)*0.1*old_dir.y
self.old_velocity, self.old_pos = self:calc_rail_direction(self.old_pos, self.old_velocity)
old_dir = cart_func:velocity_to_dir(self.old_velocity)
if not cart_func.v3:equal(cart_func:velocity_to_dir(self.old_velocity), dir) then
self.velocity = self.old_velocity
pos = self.old_pos
self.object:setpos(self.old_pos)
break
end
end
end
-- Calculate the new step
self.velocity, pos = self:calc_rail_direction(pos, self.velocity)
self.object:setpos(pos)
dir = cart_func:velocity_to_dir(self.velocity)
-- Accelerate or decelerate the cart according to the pitch and acceleration of the rail node
local a = tonumber(minetest.env:get_meta(pos):get_string("cart_acceleration"))
if not a then
a = 0
end
if self.velocity.y < 0 then
self.velocity = {
x = self.velocity.x + (a+0.13)*cart_func:get_sign(self.velocity.x),
y = self.velocity.y + (a+0.13)*cart_func:get_sign(self.velocity.y),
z = self.velocity.z + (a+0.13)*cart_func:get_sign(self.velocity.z),
}
elseif self.velocity.y > 0 then
self.velocity = {
x = self.velocity.x + (a-0.1)*cart_func:get_sign(self.velocity.x),
y = self.velocity.y + (a-0.1)*cart_func:get_sign(self.velocity.y),
z = self.velocity.z + (a-0.1)*cart_func:get_sign(self.velocity.z),
}
else
self.velocity = {
x = self.velocity.x + (a-0.03)*cart_func:get_sign(self.velocity.x),
y = self.velocity.y + (a-0.03)*cart_func:get_sign(self.velocity.y),
z = self.velocity.z + (a-0.03)*cart_func:get_sign(self.velocity.z),
}
-- Place the cart exactly on top of the rail
if cart_func:is_rail(cart_func.v3:round(pos)) then
self.object:setpos({x=pos.x, y=math.floor(pos.y+0.5), z=pos.z})
pos = self.object:getpos()
end
end
-- Dont switch moving direction
-- Only if on flat railway
if dir.y == 0 then
if cart_func:get_sign(dir.x) ~= cart_func:get_sign(self.velocity.x) then
self.velocity.x = 0
end
if cart_func:get_sign(dir.y) ~= cart_func:get_sign(self.velocity.y) then
self.velocity.y = 0
end
if cart_func:get_sign(dir.z) ~= cart_func:get_sign(self.velocity.z) then
self.velocity.z = 0
end
end
-- Allow only one moving direction (multiply the other one with 0)
dir = cart_func:velocity_to_dir(self.velocity)
self.velocity = {
x = math.abs(self.velocity.x) * dir.x,
y = self.velocity.y,
z = math.abs(self.velocity.z) * dir.z,
}
-- Move cart exactly on the rail
if dir.x ~= 0 and not cart_func:is_int(pos.z) then
pos.z = math.floor(0.5+pos.z)
self.object:setpos(pos)
elseif dir.z ~= 0 and not cart_func:is_int(pos.x) then
pos.x = math.floor(0.5+pos.x)
self.object:setpos(pos)
end
-- Limit the velocity
if math.abs(self.velocity.x) > self.MAX_V then
self.velocity.x = self.MAX_V*cart_func:get_sign(self.velocity.x)
end
if math.abs(self.velocity.y) > self.MAX_V then
self.velocity.y = self.MAX_V*cart_func:get_sign(self.velocity.y)
end
if math.abs(self.velocity.z) > self.MAX_V then
self.velocity.z = self.MAX_V*cart_func:get_sign(self.velocity.z)
end
self.object:setvelocity(self.velocity)
self.old_pos = self.object:getpos()
self.old_velocity = cart_func.v3:copy(self.velocity)
if dir.x < 0 then
self.object:setyaw(math.pi/2)
elseif dir.x > 0 then
self.object:setyaw(3*math.pi/2)
elseif dir.z < 0 then
self.object:setyaw(math.pi)
elseif dir.z > 0 then
self.object:setyaw(0)
end
if dir.y == -1 then
self.object:set_animation({x=1, y=1}, 1, 0)
elseif dir.y == 1 then
self.object:set_animation({x=2, y=2}, 1, 0)
else
self.object:set_animation({x=0, y=0}, 1, 0)
end
end
minetest.register_entity("carts:cart", cart)
minetest.register_craftitem("carts:cart", {
description = "Minecart",
inventory_image = minetest.inventorycube("cart_top.png", "cart_side.png", "cart_side.png"),
wield_image = "cart_side.png",
on_place = function(itemstack, placer, pointed_thing)
if not pointed_thing.type == "node" then
return
end
if cart_func:is_rail(pointed_thing.under) then
minetest.env:add_entity(pointed_thing.under, "carts:cart")
itemstack:take_item()
return itemstack
elseif cart_func:is_rail(pointed_thing.above) then
minetest.env:add_entity(pointed_thing.above, "carts:cart")
itemstack:take_item()
return itemstack
end
end,
})
minetest.register_craft({
output = "carts:cart",
recipe = {
{"", "", ""},
{"default:steel_ingot", "", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
},
})

BIN
mods/carts/models/cart.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

339
mods/carts/models/cart.x Normal file
View File

@ -0,0 +1,339 @@
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, 3.535534, 3.535534, 0.000000,
0.000000,-3.535534, 3.535534, 0.000000,
0.000000,-3.000000, 3.000000, 1.000000;;
}
Mesh { //Cube_001 Mesh
72;
-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.833334;-1.000000; 1.000000;,
-1.000000;-1.000000; 1.000000;,
-1.000000;-0.833333; 1.000000;,
-0.833334;-0.833333; 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;,
0.999999;-1.000001; 1.000000;,
0.833332;-1.000000; 1.000000;,
0.833333;-0.833334; 1.000000;,
1.000000;-0.833334; 1.000000;,
0.833332;-1.000000; 1.000000;,
-0.833334;-1.000000; 1.000000;,
-0.833334;-0.833333; 1.000000;,
0.833333;-0.833334; 1.000000;,
1.000000; 0.833333; 1.000000;,
0.833334; 0.833333; 1.000000;,
0.833334; 1.000000; 1.000000;,
1.000000; 0.999999; 1.000000;,
1.000000;-0.833334; 1.000000;,
0.833333;-0.833334; 1.000000;,
0.833334; 0.833333; 1.000000;,
1.000000; 0.833333; 1.000000;,
0.833334; 0.833333; 1.000000;,
-0.833333; 0.833333; 1.000000;,
-0.833333; 1.000000; 1.000000;,
0.833334; 1.000000; 1.000000;,
0.833334; 0.833333;-0.800000;,
-0.833333; 0.833333;-0.800000;,
-0.833333; 0.833333; 1.000000;,
0.833334; 0.833333; 1.000000;,
-0.833333; 0.833333; 1.000000;,
-1.000000; 0.833333; 1.000000;,
-1.000000; 1.000000; 1.000000;,
-0.833333; 1.000000; 1.000000;,
-0.833334;-0.833333; 1.000000;,
-1.000000;-0.833333; 1.000000;,
-1.000000; 0.833333; 1.000000;,
-0.833333; 0.833333; 1.000000;,
0.833333;-0.833334;-0.800000;,
-0.833334;-0.833333;-0.800000;,
-0.833333; 0.833333;-0.800000;,
0.833334; 0.833333;-0.800000;,
-0.833333; 0.833333;-0.800000;,
-0.833334;-0.833333;-0.800000;,
-0.833334;-0.833333; 1.000000;,
-0.833333; 0.833333; 1.000000;,
-0.833334;-0.833333;-0.800000;,
0.833333;-0.833334;-0.800000;,
0.833333;-0.833334; 1.000000;,
-0.833334;-0.833333; 1.000000;,
0.833333;-0.833334;-0.800000;,
0.833334; 0.833333;-0.800000;,
0.833334; 0.833333; 1.000000;,
0.833333;-0.833334; 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;,
0.999999;-1.000001; 1.000000;,
1.000000; 0.999999; 1.000000;,
1.000000; 1.000000;-1.000000;;
18;
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;,
4;48;49;50;51;,
4;52;53;54;55;,
4;56;57;58;59;,
4;60;61;62;63;,
4;64;65;66;67;,
4;68;69;70;71;;
MeshNormals { //Cube_001 Normals
72;
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;,
-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;,
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;,
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; 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;,
-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;;
18;
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;,
4;48;49;50;51;,
4;52;53;54;55;,
4;56;57;58;59;,
4;60;61;62;63;,
4;64;65;66;67;,
4;68;69;70;71;;
} //End of Cube_001 Normals
MeshMaterialList { //Cube_001 Material List
1;
18;
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0;;
Material Material {
0.640000; 0.640000; 0.640000; 1.000000;;
96.078431;
0.500000; 0.500000; 0.500000;;
0.000000; 0.000000; 0.000000;;
TextureFilename {"cart.png";}
}
} //End of Cube_001 Material List
MeshTextureCoords { //Cube_001 UV Coordinates
72;
0.000000; 0.500000;,
0.500000; 0.500000;,
0.500000; 1.000000;,
0.000000; 1.000000;,
0.031250; 0.500000;,
-0.000000; 0.500000;,
-0.000000; 0.468750;,
0.031250; 0.468750;,
0.500000; 0.500000;,
0.500000; 0.000000;,
1.000000; 0.000000;,
1.000000; 0.500000;,
0.468750; 0.468750;,
0.500000; 0.468750;,
0.500000; 0.500000;,
0.468750; 0.500000;,
0.031250; 0.468750;,
0.468750; 0.468750;,
0.468750; 0.500000;,
0.031250; 0.500000;,
0.468750; 0.000000;,
0.500000; 0.000000;,
0.500000; 0.031250;,
0.468750; 0.031250;,
0.468750; 0.031250;,
0.500000; 0.031250;,
0.500000; 0.468750;,
0.468750; 0.468750;,
0.468750; 0.031250;,
0.031250; 0.031250;,
0.031250; 0.000000;,
0.468750; 0.000000;,
1.000000; 0.500000;,
0.500000; 0.500000;,
0.500000; 0.000000;,
1.000000; 0.000000;,
0.031250; 0.031250;,
0.000000; 0.031250;,
0.000000; 0.000000;,
0.031250; 0.000000;,
0.031250; 0.468750;,
-0.000000; 0.468750;,
0.000000; 0.031250;,
0.031250; 0.031250;,
0.000000; 0.500000;,
0.500000; 0.500000;,
0.500000; 1.000000;,
0.000000; 1.000000;,
1.000000; 0.500000;,
0.500000; 0.500000;,
0.500000; 0.000000;,
1.000000; 0.000000;,
1.000000; 0.500000;,
0.500000; 0.500000;,
0.500000; 0.000000;,
1.000000; 0.000000;,
1.000000; 0.500000;,
0.500000; 0.500000;,
0.500000; 0.000000;,
1.000000; 0.000000;,
0.500000; 0.500000;,
0.500000; 0.000000;,
1.000000; 0.000000;,
1.000000; 0.500000;,
1.000000; 0.000000;,
1.000000; 0.500000;,
0.500000; 0.500000;,
0.500000; 0.000000;,
0.500000; 0.500000;,
0.500000; 0.000000;,
1.000000; 0.000000;,
1.000000; 0.500000;;
} //End of Cube_001 UV Coordinates
} //End of Cube_001 Mesh
} //End of Cube
} //End of Root Frame
AnimationSet {
Animation {
{Cube}
AnimationKey { //Position
2;
4;
0;3; 0.000000, 0.000000, 0.000000;;,
1;3; 0.000000, 3.000000, 3.000000;;,
2;3; 0.000000,-3.000000, 3.000000;;,
3;3; 0.000000,-3.000000, 3.000000;;;
}
AnimationKey { //Rotation
0;
4;
0;4; -1.000000, 0.000000, 0.000000, 0.000000;;,
1;4; -0.923880,-0.382683,-0.000000, 0.000000;;,
2;4; -0.923880, 0.382683, 0.000000, 0.000000;;,
3;4; -0.923880, 0.382683, 0.000000, 0.000000;;;
}
AnimationKey { //Scale
1;
4;
0;3; 5.000000, 5.000000, 5.000000;;,
1;3; 5.000000, 5.000000, 5.000000;;,
2;3; 5.000000, 5.000000, 5.000000;;,
3;3; 5.000000, 5.000000, 5.000000;;;
}
}
} //End of AnimationSet

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

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

@ -0,0 +1 @@
default

115
mods/classes/init.lua Normal file
View File

@ -0,0 +1,115 @@
classes = {
mesh = {
elf = "elf_character.x",
human = "character.x",
dwarf = "dwarf_character.x",
},
class = {},
default = "human",
file = minetest.get_worldpath().."/classes.mt",
}
classes.load = function(self)
local input = io.open(self.file, "r")
local data = nil
if input then
data = input:read('*all')
end
if data and data ~= "" then
lines = string.split(data, "\n")
for _, line in ipairs(lines) do
data = string.split(line, " ", 2)
self.class[data[1]] = data[2]
end
io.close(input)
end
end
classes.save = function(self)
local output = io.open(self.file,'w')
for name, class in pairs(self.class) do
if name and class then
output:write(name.." "..class.."\n")
end
end
io.close(output)
end
classes.get_character_mesh = function(self, name)
local mesh = ""
local mod_path = minetest.get_modpath("3d_armor")
if mod_path then
mesh = "3d_armor_"
end
if classes.class[name] then
return mesh..classes.mesh[classes.class[name]]
end
return mesh..classes.mesh[classes.default]
end
classes.update_character_mesh = function(self, player)
if not player then
return
end
local name = player:get_player_name()
if classes.class[name] then
player:set_properties({
visual = "mesh",
mesh = self:get_character_mesh(name),
visual_size = {x=1, y=1},
})
end
end
local default_class = minetest.setting_get("classes_default_class")
if default_class then
if classes.mesh[default_class] then
classes.default = default_class
end
else
minetest.setting_set("classes_default_class", classes.default)
end
classes:load()
minetest.register_privilege("class", "Player can change class.")
minetest.register_chatcommand("class", {
params = "[class]",
description = "Change or view character class.",
func = function(name, param)
if param == "" then
minetest.chat_send_player(name, "Current character class: "..classes.class[name])
return
end
if not minetest.check_player_privs(name, {class=true}) then
minetest.chat_send_player(name, "Changing class requires the 'class' privilege!")
return
end
if not classes.mesh[param] then
local valid = ""
for k,_ in pairs(classes.mesh) do
valid = valid.." "..k
end
minetest.chat_send_player(name, "Invalid class '"..param.."', choose from:"..valid)
return
end
if classes.class[name] == param then
return
end
classes.class[name] = param
classes:save()
local player = minetest.env:get_player_by_name(name)
classes:update_character_mesh(player)
end,
})
minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
if not classes.class[name] then
classes.class[name] = classes.default
end
minetest.after(0.5, function(player)
classes:update_character_mesh(player)
end, player)
end)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

9
mods/clean/README.txt Normal file
View File

@ -0,0 +1,9 @@
This mod deletes old blocks and objects from Minetest.
Insert the names of the old nodes in the table "old_nodes" like this:
local old_nodes = {"modname:nodename1", "modname:nodename2"}
The nodes will automatically be removed when a player is close to them.
The same will happen to entities when you insert there names
into the table "old_entities".
License:
Sourcecode: WTFPL

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

@ -0,0 +1,16 @@
local old_nodes = {}
local old_entities = {}
for _,node_name in ipairs(old_nodes) do
minetest.register_node(":"..node_name, {
groups = {old=1},
})
end
for _,entity_name in ipairs(old_entities) do
minetest.register_entity(":"..entity_name, {
on_activate = function(self, staticdata)
self.object:remove()
end,
})
end

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

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

View File

@ -0,0 +1 @@
default

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

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

298
mods/darkage/README.md Normal file
View File

@ -0,0 +1,298 @@
=== DarkAge MOD for MINETEST-C55 ===
by Master Gollum
Introduction:
This mod adds a few new blocks that allows to create new buildings in a
pre industrial landscape. Of course, feel free to use them in any other
construction :P
It also provides more layers of stones. I tried not to turn mining in
a rainbow, so don't expect to find them easily. There are two kinds of
materials, stones, that spawns in layers at different deep and clay
like materials (silt and mud) that you will find in water places.
Silt and Mud are more easy to find than stone layers, but if you find
one it will be a real mine, with all probability with hundreds of blocks.
I used mainly 4 square recipes to avoid collisions with other MODs,
anyway I have not checked all them, so it is possible that another
person is already using one or more of this combinations.
I also used Desert Sand and Desert Stone, because they almost are not
used in the default version. Probably I will change this recipes in
next releases.
Release Notes
Version 0.3
* 29 Nodes + 3 Craft Items
* Furniture and building decoration
* Stone layers
Version 0.2
* 13 Nodes
* Sedimentary stones
Version 0.1
* 6 Nodes
PS: This document has been structured as the README.txt of PilzAdam in
his Bed MOD.
How to install:
Unzip the archive an place it in minetest-base-directory/mods/minetest/
if you have a windows client or a linux run-in-place client. If you
have a linux system-wide instalation place it in
~/.minetest/mods/minetest/.
If you want to install this mod only in one world create the folder
worldmods/ in your worlddirectory.
For further information or help see:
http://wiki.minetest.com/wiki/Installing_Mods
Tunning:
Comments the following lines to remove what you don't like:
(To comment them just add -- at the beginning of their lines)
Stone Layers
dofile(minetest.get_modpath("darkage").."/mapgen.lua")
The stones will not spawn in the map.
Furniture Nodes
dofile(minetest.get_modpath("darkage").."/furniture.lua")
Only pure stones will be provided.
BUILDING NODES
Adobe: Sand and Clay mixture with Straw to build houses or walls
Used from historical times, one of the first bricks
invented. I have to improve this texture, it is ugly :P
CRAFT -> 4
[Sand] [Sand]
[Clay Lumb] [Straw]
Basalt: a darken version of the default Stone
COOKING
[Basalt Cobble]
Basalt Cobble: A darken version of the default Cobble
CRAFT -> 4
[Cobble] [Cobble]
[Coal Lump] [Coal Lump]
Chalk: a soft, white and porous sedimentary rock. It becomes
Chalk Powder when digged. Can't be craft, only found as
stratum.
Chalk Powder: pile of chalk from digging Chalk stones. Can
be used to prepare plaster. See Cobblestone with Plaster.
Cobblestone with Plaster: Cobbles where has been applied a
layer of white plaster.
When digged it lost the plaster layer!
CRAFT -> 2
[Cobblestone] [Chalk Powder]
[Cobblestone] [Chalk Powder]
Dark Dirt: A darken version of the Dirt where the grass doesn't
grown, perfect for create a path in a forest. I was using
Gravel, but the noise walking was annoying to me (like
walking over iron coal with the nude feet :P), for this I
created this node.
CRAFT -> 4
[Dirt] [Dirt]
[Gravel] [Gravel]
Desert Stone Cobble: To add more uses to the Desert Stones.
I suppossed they are harder than regular Stones so it
cracks at 50% and releases the Cobbles or just regular
Desert Stones.
From dig Desert Stone
Desert Iron Ore: I know that others MODs add ores to the
Desert Stones, mine also does it, but just Iron, I supposed
the red color is because of the iron, so it goes with more
high probability than regular Stones and it doesn't add
Coal to them. It will not be a lot so you can keep it with
another MOD that does the same or just comment the lines that
does it.
Dry Leaves: Just a cube of Leaves toasted :P Well I found the
Leaves unuseful, so I thought to turn them into Straw, ok
it is not the same, but well, why not? Just dry them in a
Furnace and then put together to create the Straw
COOKING
[Leaves]
Gneiss: high grade metamorphic rock formed from Schist, very
common, and used in construction. It sometimes brokes in
Gneiss Cobble when being digged.
COOKING
[Schist]
Gneiss Cobble: brick version of the gneiss.
From dig gneiss
Mud: mixture of water and some combination of soil, silt, and
clay. Used for build houses, specially in desertic regions.
It brokes in 4 Mud Lumps when digged.
CRAFT -> 3
[Dirt] [Dirt]
[Clay Lump] [Silt Lump]
CRAFT -> 1
[Mud Lump] [Mud Lump]
[Mud Lump] [Mud Lump]
Old Red Sandstone: a light red sandstone, in fact it's
sandstone with iron that gives it this color.
CRAFT -> 4
[Sandstone] [Sandstone]
[Iron Lumb] [Sandstone]
COOKING
[Old Red Sandstone Cobble]
Old Red Sandstone Cobble: Cobbles of Old Red Sandstone.
CRAFT -> 4
[Sandstone Cobble] [Sandstone Cobble]
[Iron Lumb] [Sandstone Cobble]
COOKING
[Desert Stone] --> I think I will change it in the future
release with its own Cobbles.
Reinforced Cobble: brick with crossed wooden.
CRAFT -> 1
[Stick] [] [Stick]
[] [Cobble] []
[Stick] [] [Stick]
Sandstone Cobble: brick version of the Sandstone, good for
buildings with a pale color.
COOKING
[Sandstone]
Schist: medium grade metamorphic rock from Slate.
COOKING
[Slate]
Silt: granular material of a size somewhere between sand and clay.
It brokes in 4 Silt Lumps.
CRAFT -> 1
[Silt Lump] [Silt Lump]
[Silt Lump] [Silt Lump]
Slate: fine-grained, foliated, homogeneous metamorphic rock
derived from an original shale-type sedimentary rock through
low-grade regional metamorphism. It is used to build roof.
COOKING
[Shale]
COOKING
[Slate Cobble]
Slate Cobble: Cobble obtained from Slate
From dig Slate
Slate Tale: Nice blue slate tales for roofs. They has been used
as building traditional building material in zones where
slate is easy to find.
Note: It has stairs and slabs.
CRAFT -> 2
[Slate Cobble] [Slate Cobble]
[Slate Cobble] [Slate Cobble]
Straw: a cube of yellish straw, try them in the roofs they will
be very nice. Used also as traditional building material
from ancient times.
CRAFT -> 2
[Shrub] [Shrub]
[Shrub] [Shrub]
CRAFT -> 2
[Dry Leaves] [Dry Leaves]
[Dry Leaves] [Dry Leaves]
Straw Bale: a decoration item, looks great for a farm or a
country side house.
CRAFT -> 1
[Straw] [Straw]
[Straw] [Straw]
Desert Stone: just the default block, it can be obtained now
from Desert Sand. The idea is that Desert Sand is stonner
than regular Sand, so it takes less to create a Desert
Stone than a Sandstone.
CRAFT -> 2
[Sandstone] [Sandstone]
[Sandstone] [Sandstone]
FURNITURE NODES
Just started so they are few ones
Box: a more smaller container than the Chest, but it requires
less wood. As cheep as 4 woods and have 16 slots. The craft
is a little weird but I think it makes sense and avoids
collision with the recipe of Hardwood of the MOD
building_blocks.
CRAFT -> 2
[Wood] [] [Wood]
[] [] []
[Wood] [] [Wood]
Chain: climbable chain.
CRAFT -> 2
[Steel Ingot]
[Steel Ingot]
[Steel Ingot]
Iron Bars: alternative window for the Glass.
CRAFT -> 3
[Steel Ingot] [] [Steel Ingot]
[Steel Ingot] [] [Steel Ingot]
[Steel Ingot] [] [Steel Ingot]
Iron Grille: alternative window for the Glass.
CRAFT -> 3
[] [Iron Bars] []
[Iron Bars] [] [Iron Bars]
[] [Iron Bars] []
Wood Bars: alternative window for the Glass.
CRAFT -> 3
[Stick] [] [Stick]
[Stick] [] [Stick]
[Stick] [] [Stick]
Wood Frame: alternative window for the Glass.
CRAFT -> 1
[Stick] [Stick] [Stick]
[Stick] [Glass] [Stick]
[Stick] [Stick] [Stick]
License:
Sourcecode: WTFPL (see below)
Graphics: WTFPL (see below)
See also:
http://minetest.net/
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

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

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

283
mods/darkage/furniture.lua Normal file
View File

@ -0,0 +1,283 @@
minetest.register_node("darkage:chain", {
description = "Chain",
drawtype = "signlike",
tiles = {"darkage_chain.png"},
inventory_image = "darkage_chain.png",
wield_image = "darkage_chain.png",
paramtype = "light",
paramtype2 = "wallmounted",
is_ground_content = true,
walkable = false,
climbable = true,
selection_box = {
type = "wallmounted",
--wall_top = = <default>
--wall_bottom = = <default>
--wall_side = = <default>
},
groups = {snappy=1,cracky=2,oddly_breakable_by_hand=2},
legacy_wallmounted = true
})
minetest.register_node('darkage:box', {
description = "Box",
tiles = { 'darkage_box_top.png','darkage_box_top.png','darkage_box.png'},
sunlight_propagates = false,
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
groups = { snappy = 3 },
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec",
"size[8,8]"..
"list[current_name;main;0,0;8,3;]"..
"list[current_player;main;0,4;8,4;]")
meta:set_string("infotext", "Box")
local inv = meta:get_inventory()
inv:set_size("main", 16)
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", player:get_player_name()..
" moves stuff in box at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" moves stuff to box at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" takes stuff from box at "..minetest.pos_to_string(pos))
end,
})
minetest.register_node('darkage:wood_shelves', {
description = "Wooden Shelves",
tiles = { 'darkage_shelves.png','darkage_shelves.png','darkage_shelves.png',
'darkage_shelves.png','darkage_shelves.png','darkage_shelves_front.png'},
sunlight_propagates = false,
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
groups = { snappy = 3 },
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec",
"size[8,10]"..
"list[context;up;0,0;8,3;]"..
"list[context;down;0,3;8,3;]"..
"list[current_player;main;0,6;8,4;]")
meta:set_string("infotext", "Wooden Shelves")
local inv = meta:get_inventory()
inv:set_size("up", 16)
inv:set_size("down", 16)
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("shape") and inv:is_empty("out") and inv:is_empty("water")
end,
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", player:get_player_name()..
" moves stuff in shelves at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" moves stuff to shelves at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" takes stuff from shelves at "..minetest.pos_to_string(pos))
end,
})
--minetest.register_node("darkage:rosace", {
-- description = "Rose Window",
-- tiles = {"darkage_rosace.png"},
-- is_ground_content = true,
-- groups = {cracky=3},
-- sounds = default.node_sound_stone_defaults()
--})
minetest.register_node("darkage:iron_bars", {
description = "Iron Bars",
drawtype = "glasslike",
tiles = {"darkage_iron_bars.png"},
inventory_image = "darkage_iron_bars.png",
wield_image = "darkage_iron_bars.png",
is_ground_content = true,
paramtype = "light",
sunlight_propagates = true,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:lamp", {
description = "Lamp",
tiles = {
"darkage_lamp.png"
},
paramtype = "light",
sunlight_propagates = true,
light_source = LIGHT_MAX-1,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,flammable=1},
sounds = default.node_sound_glass_defaults(),
})
minetest.register_node("darkage:iron_grille", {
description = "Iron Grille",
drawtype = "glasslike",
tiles = {"darkage_iron_grille.png"},
inventory_image = "darkage_iron_grille.png",
wield_image = "darkage_iron_grille.png",
is_ground_content = true,
paramtype = "light",
sunlight_propagates = true,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:wood_bars", {
description = "Wooden Bars",
drawtype = "glasslike",
tiles = {"darkage_wood_bars.png"},
inventory_image = "darkage_wood_bars.png",
wield_image = "darkage_wood_bars.png",
is_ground_content = true,
paramtype = "light",
sunlight_propagates = true,
groups = {snappy=1,choppy=2},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:wood_grille", {
description = "Wooden Grille",
drawtype = "glasslike",
tiles = {"darkage_wood_grille.png"},
inventory_image = "darkage_wood_grille.png",
wield_image = "darkage_wood_grille.png",
is_ground_content = true,
paramtype = "light",
sunlight_propagates = true,
groups = {snappy=1,choppy=2},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:wood_frame", {
description = "Wooden Frame",
drawtype = "glasslike",
tiles = {"darkage_wood_frame.png"},
inventory_image = "darkage_wood_frame.png",
wield_image = "darkage_wood_frame.png",
is_ground_content = true,
paramtype = "light",
sunlight_propagates = true,
groups = {snappy=1,choppy=2},
sounds = default.node_sound_stone_defaults()
})
---------------
-- Crafts Item
---------------
----------
-- Crafts
----------
minetest.register_craft({
output = 'darkage:box',
recipe = {
{'default:wood','','default:wood'},
{'','',''},
{'default:wood','','default:wood'},
}
})
minetest.register_craft({
output = 'darkage:chain 2',
recipe = {
{'default:steel_ingot'},
{'default:steel_ingot'},
{'default:steel_ingot'},
}
})
minetest.register_craft({
output = 'darkage:iron_bars 2',
recipe = {
{'default:steel_ingot','','default:steel_ingot'},
{'default:steel_ingot','','default:steel_ingot'},
{'default:steel_ingot','','default:steel_ingot'},
}
})
minetest.register_craft({
output = 'darkage:iron_grille 3',
recipe = {
{'','darkage:iron_bars',''},
{'darkage:iron_bars','','darkage:iron_bars'},
{'','darkage:iron_bars',''},
}
})
minetest.register_craft({
output = 'darkage:lamp',
recipe = {
{'default:stick','','default:stick'},
{'','default:torch',''},
{'default:stick','','default:stick'},
}
})
minetest.register_craft({
output = 'darkage:wood_bars 2',
recipe = {
{'default:stick','','default:stick'},
{'default:stick','','default:stick'},
{'default:stick','','default:stick'},
}
})
minetest.register_craft({
output = 'darkage:wood_grille 3',
recipe = {
{'','darkage:wood_bars',''},
{'darkage:wood_bars','','darkage:wood_bars'},
{'','darkage:wood_bars',''},
}
})
minetest.register_craft({
output = 'darkage:wood_shelves',
recipe = {
{'darkage:box'},
{'darkage:box'},
}
})
minetest.register_craft({
output = 'darkage:wood_frame',
recipe = {
{'default:stick','','default:stick'},
{'','default:glass',''},
{'default:stick','','default:stick'},
}
})
-- Cookings
minetest.register_craft({
type = "cooking",
output = "default:glass",
recipe = "darkage:wood_frame",
})

527
mods/darkage/init.lua Normal file
View File

@ -0,0 +1,527 @@
print (" ---- Dark Age is Loading! ---- ")
-- Commend this lines if you don't like some of this features
dofile(minetest.get_modpath("darkage").."/mapgen.lua")
--dofile(minetest.get_modpath("darkage").."/building.lua")
dofile(minetest.get_modpath("darkage").."/furniture.lua")
dofile(minetest.get_modpath("darkage").."/stairs.lua")
----------
-- Items
----------
minetest.register_node("darkage:adobe", {
description = "Adobe",
tiles = {"darkage_adobe.png"},
is_ground_content = true,
groups = {crumbly=3},
sounds = default.node_sound_sand_defaults(),
})
minetest.register_node("darkage:basalt", {
description = "Basalt",
tiles = {"darkage_basalt.png"},
is_ground_content = true,
drop = 'darkage:basalt_cobble',
groups = {cracky=3},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:basalt_cobble", {
description = "Basalt Cobble",
tiles = {"darkage_basalt_cobble.png"},
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:chalk", {
description = "Chalk",
tiles = {"darkage_chalk.png"},
is_ground_content = true,
drop = 'darkage:chalk_powder 2',
groups = {crumbly=2,cracky=2},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:cobble_with_plaster", {
description = "Cobblestone With Plaster",
tiles = {"darkage_cobble_with_plaster_D.png", "darkage_cobble_with_plaster_B.png", "darkage_cobble_with_plaster_C.png",
"darkage_cobble_with_plaster_A.png", "default_cobble.png", "darkage_chalk.png"},
is_ground_content = true,
paramtype2 = "facedir",
drop = 'default:cobble',
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("darkage:desert_stone_cobble", {
description = "Desert Stone Cobble",
tiles = {"darkage_desert_stone_cobble.png"},
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:desert_stone_with_iron", {
description = "Desert Iron Ore",
tiles = {"default_desert_stone.png^darkage_mineral_iron.png"},
is_ground_content = true,
groups = {cracky=3},
drop = 'default:iron_lump',
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("darkage:darkdirt", {
description = "Dark Dirt",
tiles = {"darkage_darkdirt.png"},
is_ground_content = true,
groups = {crumbly=2},
sounds = default.node_sound_dirt_defaults(),
})
minetest.register_node("darkage:dry_leaves", {
description = "Dry Leaves",
tiles = {"darkage_dry_leaves.png"},
is_ground_content = true,
paramtype = "light",
groups = {snappy=3, flammable=2},
sounds = default.node_sound_leaves_defaults()
})
minetest.register_node("darkage:gneiss", {
description = "Gneiss",
tiles = {"darkage_gneiss.png"},
is_ground_content = true,
groups = {cracky=3},
drop = {
max_items = 1,
items = {
{
-- player will get cobbles with 1/3 chance
items = {'darkage:gneiss_cobble'},
rarity = 3,
},
{
items = {'darkage:gneiss'},
}
}
},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:gneiss_cobble", {
description = "Gneiss Cobble",
tiles = {"darkage_gneiss_cobble.png"},
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:marble", {
description = "Marble",
tiles = {"darkage_marble.png"},
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:mud", {
description = "Mud",
tiles = {"darkage_mud_up.png","darkage_mud.png"},
is_ground_content = true,
groups = {crumbly=3},
drop = 'darkage:mud_lump 4',
sounds = default.node_sound_dirt_defaults({
footstep = "",
}),
})
minetest.register_node("darkage:ors", {
description = "Old Red Sandstone",
tiles = {"darkage_ors.png"},
is_ground_content = true,
drop = 'darkage:ors_cobble',
groups = {crumbly=2,cracky=2},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:ors_cobble", {
description = "Old Red Sandstone Cobble",
tiles = {"darkage_ors_cobble.png"},
is_ground_content = true,
groups = {crumbly=2,cracky=2},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:sandstone_cobble", {
description = "Sandstone Cobble",
tiles = {"darkage_sandstone_cobble.png"},
is_ground_content = true,
groups = {crumbly=2,cracky=2},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:serpentine", {
description = "Serpentine",
tiles = {"darkage_serpentine.png"},
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:shale", {
description = "Shale",
tiles = {"darkage_shale.png","darkage_shale.png","darkage_shale_side.png"},
is_ground_content = true,
groups = {crumbly=2,cracky=2},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:schist", {
description = "Schist",
tiles = {"darkage_schist.png"},
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:silt", {
description = "Silt",
tiles = {"darkage_silt.png"},
is_ground_content = true,
groups = {crumbly=3},
drop = 'darkage:silt_lump 4',
sounds = default.node_sound_dirt_defaults({
footstep = "",
}),
})
minetest.register_node("darkage:slate", {
description = "Slate",
tiles = {"darkage_slate.png","darkage_slate.png","darkage_slate_side.png"},
is_ground_content = true,
drop = 'darkage:slate_cobble',
groups = {cracky=2},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:slate_cobble", {
description = "Slate Cobble",
tiles = {"darkage_slate_cobble.png"},
is_ground_content = true,
groups = {cracky=2},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:slate_tale", {
description = "Slate Tale",
tiles = {"darkage_slate_tale.png"},
is_ground_content = true,
groups = {cracky=2},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:straw", {
description = "Straw",
tiles = {"darkage_straw.png"},
is_ground_content = true,
groups = {snappy=3, flammable=2},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("darkage:stone_brick", {
description = "Stone Brick",
tiles = {"darkage_stone_brick.png"},
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:straw_bale", {
description = "Straw Bale",
tiles = {"darkage_straw_bale.png"},
is_ground_content = true,
drop = 'darkage:straw 4',
groups = {snappy=2, flammable=2},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("darkage:marble", {
description = "Marble",
tiles = {"darkage_marble.png"},
is_ground_content = true,
groups = {cracky=2},
sounds = default.node_sound_stone_defaults()
})
minetest.register_node("darkage:marble_tile", {
description = "Marble Tile",
tiles = {"darkage_marble_tile.png"},
is_ground_content = true,
groups = {cracky=2},
sounds = default.node_sound_stone_defaults()
})
---------------
-- Overrides
---------------
minetest.registered_nodes["default:desert_stone"].drop= {
max_items = 1,
items = {
{
-- player will get cobbles with 1/3 chance
items = {'darkage:desert_stone_cobble'},
rarity = 2,
},
{
items = {'default:desert_stone'},
}
}
}
---------------
-- Crafts Items
---------------
minetest.register_craftitem("darkage:chalk_powder", {
description = "Chalk Powder",
inventory_image = "darkage_chalk_powder.png",
})
minetest.register_craftitem("darkage:mud_lump", {
description = "Mud Lump",
inventory_image = "darkage_mud_lump.png",
})
minetest.register_craftitem("darkage:silt_lump", {
description = "Silt Lump",
inventory_image = "darkage_silt_lump.png",
})
----------
-- Crafts
----------
--sand+clay+water+straw
minetest.register_craft({
output = 'darkage:adobe 4',
recipe = {
{'default:sand','default:sand'},
{'default:clay_lump','darkage:straw'},
}
})
minetest.register_craft({
output = 'darkage:basalt_cobble 4',
recipe = {
{'default:cobble','default:cobble'},
{'default:coal_lump','default:coal_lump'},
}
})
minetest.register_craft({
output = 'darkage:cobble_with_plaster 2',
recipe = {
{'default:cobble','darkage:chalk_powder'},
{'default:cobble','darkage:chalk_powder'},
}
})
minetest.register_craft({
output = 'darkage:cobble_with_plaster 2',
recipe = {
{'darkage:chalk_powder','default:cobble'},
{'darkage:chalk_powder','default:cobble'},
}
})
minetest.register_craft({
output = 'darkage:darkdirt 4',
recipe = {
{'default:dirt','default:dirt'},
{'default:gravel','default:gravel'},
}
})
minetest.register_craft({
output = 'darkage:mud 3',
recipe = {
{'default:dirt','default:dirt'},
{'default:clay_lump','darkage:silt_lump'},
}
})
minetest.register_craft({
output = 'darkage:mud',
recipe = {
{'darkage:mud_lump','darkage:mud_lump'},
{'darkage:mud_lump','darkage:mud_lump'},
}
})
minetest.register_craft({
output = 'darkage:ors 4',
recipe = {
{'default:sandstone','default:sandstone'},
{'default:iron_lump','default:sandstone'},
}
})
minetest.register_craft({
output = 'darkage:ors_cobble 4',
recipe = {
{'darkage:sandstone_cobble','darkage:sandstone_cobble'},
{'default:iron_lump','darkage:sandstone_cobble'},
}
})
minetest.register_craft({
output = 'darkage:silt 3',
recipe = {
{'default:sand','default:sand'},
{'default:clay_lump','default:clay_lump'},
}
})
minetest.register_craft({
output = 'darkage:silt',
recipe = {
{'darkage:silt_lump','darkage:silt_lump'},
{'darkage:silt_lump','darkage:silt_lump'},
}
})
minetest.register_craft({
output = 'darkage:slate_tale 2',
recipe = {
{'darkage:slate_cobble','darkage:slate_cobble'},
{'darkage:slate_cobble','darkage:slate_cobble'},
}
})
minetest.register_craft({
output = 'darkage:stone_brick 3',
recipe = {
{'default:cobble','default:cobble'},
{'default:cobble','default:cobble'},
}
})
minetest.register_craft({
output = 'darkage:straw 2',
recipe = {
{'default:dry_shrub','default:dry_shrub'},
{'default:dry_shrub','default:dry_shrub'},
}
})
minetest.register_craft({
output = 'darkage:straw 2',
recipe = {
{'darkage:dry_leaves','darkage:dry_leaves'},
{'darkage:dry_leaves','darkage:dry_leaves'},
}
})
minetest.register_craft({
output = 'darkage:straw_bale',
recipe = {
{'darkage:straw','darkage:straw'},
{'darkage:straw','darkage:straw'},
}
})
-- Cookings
minetest.register_craft({
type = "cooking",
output = "darkage:basalt",
recipe = "darkage:basalt_cobble",
})
minetest.register_craft({
type = "cooking",
output = "default:desert_stone",
recipe = "darkage:desert_stone_cobble",
})
minetest.register_craft({
type = "cooking",
output = "darkage:dry_leaves",
recipe = "default:leaves",
})
minetest.register_craft({
type = "cooking",
output = "darkage:sandstone_cobble",
recipe = "default:sandstone",
})
minetest.register_craft({
type = "cooking",
output = "darkage:gneiss",
recipe = "darkage:schist",
})
minetest.register_craft({
type = "cooking",
output = "darkage:gneiss",
recipe = "darkage:gneiss_cobble",
})
minetest.register_craft({
type = "cooking",
output = "darkage:ors",
recipe = "darkage:ors_cobble",
})
minetest.register_craft({
type = "cooking",
output = "darkage:sandstone_cobble",
recipe = "default:sandstone",
})
minetest.register_craft({
type = "cooking",
output = "darkage:schist",
recipe = "darkage:slate",
})
minetest.register_craft({
type = "cooking",
output = "darkage:shale",
recipe = "darkage:mud",
})
minetest.register_craft({
type = "cooking",
output = "darkage:slate",
recipe = "darkage:shale",
})
minetest.register_craft({
type = "cooking",
output = "darkage:slate",
recipe = "darkage:slate_cobble",
})
-- Desert
minetest.register_craft({
type = "cooking",
output = "darkage:ors_cobble",
recipe = "default:desert_stone",
})
minetest.register_craft({
output = 'default:desert_stone 2',
recipe = {
{'default:desert_sand','default:desert_sand'},
{'default:desert_sand','default:desert_sand'},
}
})

255
mods/darkage/mapgen.lua Normal file
View File

@ -0,0 +1,255 @@
--Makes a stratus of rocks
--name of the rock to generate
--wherein kind of node to replace, for example default:stone
--minp, maxp the corners of the map to be generated
--seed random seed
--stratus_chance inverse probability in a given radius 1:2, 1:3 etc
--radius horizontal radius of the stratus
--radius_y vertical radius of the stratus
--deep how deep can be from the ground
local function generate_stratus(name, wherein, ceilin, ceil, minp, maxp, seed, stratus_chance, radius, radius_y, deep, height_min, height_max)
if maxp.y < height_min or minp.y > height_max then
return
end
-- it will be only generate a stratus for every 100 m of area
local stratus_per_volume=1
local area=45
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)/area)*((y_max-y_min+1)/area)*((maxp.z-minp.z+1)/area)
local pr = PseudoRandom(seed)
local blocks = math.floor(stratus_per_volume*volume)
print(" <<"..dump(name)..">>");
if blocks == 0 then
blocks = 1
end
print(" blocks: "..dump(blocks).." in vol: "..dump(volume).." ("..dump(maxp.x-minp.x+1)..","..dump(y_max-y_min+1)..","..dump(maxp.z-minp.z+1)..")")
for i=1,blocks do
local x = pr:next(1,stratus_chance)
if x == 1 then
-- TODO deep
local y0=y_max-radius_y+1
if y0 < y_min then
y0=y_min
else
y0=pr:next(y_min, y0)
end
local x0 = maxp.x-radius+1
if x0 < minp.x then
x0 = minp.x
else
x0 = pr:next(minp.x, x0)
end
local z0 = maxp.z-radius+1
if z0 < minp.z then
x0 = minp.z
else
z0 = pr:next(minp.z, z0)
end
local p0 = {x=x0, y=y0, z=z0}
local n = minetest.env:get_node(p0).name
local i = 0
--print(" upper node "..n)
x = 0
for k, v in ipairs(ceilin) do
if n == v then
x = 1
break
end
end
if x == 1 then
-- search for the node to replace
--print(" Searching nodes to replace from "..dump(y0-1).." to "..dump(y_min))
for y1=y0-1,y_min,-1 do
p0.y=y1
n = minetest.env:get_node(p0).name
x = 0
for k, v in ipairs(wherein) do
if n == v then
x = 1
break
end
end
if x == 1 then
y0=y1-deep
if y0 < y_min then
y0 = y_min
end
break
end
end
local rx=pr:next(radius/2,radius)+1
local rz=pr:next(radius/2,radius)+1
local ry=pr:next(radius_y/2,radius_y)+1
--print(" area of generation ("..dump(rx)..","..dump(rz)..","..dump(ry)..")")
for x1=0,rx do
rz = rz + 3 - pr:next(1,6)
if rz < 1 then
rz = 1
end
for z1=pr:next(1,3),rz do
local ry0=ry+ pr:next(1,3)
for y1=pr:next(1,3),ry0 do
local x2 = x0+x1
local y2 = y0+y1
local z2 = z0+z1
local p2 = {x=x2, y=y2, z=z2}
n = minetest.env:get_node(p2).name
x = 0
for k, v in ipairs(wherein) do
if n == v then
x = 1
break
end
end
if x == 1 then
if ceil == nil then
minetest.env:set_node(p2, {name=name})
i = i +1
else
local p3 = {p2.x,p2.y+1,p2}
if minetest.env:get_node(p3).name == ceil then
minetest.env:set_node(p2, {name=name})
i = i +1
end
end
end
end
end
end
print(" generated "..dump(i).." blocks in ("..dump(x0)..","..dump(y0)..","..dump(z0)..")")
end
end
end
--print("generate_ore done")
end
local function generate_claylike(name, minp, maxp, seed, chance, minh, maxh, dirt)
if maxp.y >= maxh+1 and minp.y <= minh-1 then
local pr = PseudoRandom(seed)
local divlen = 4
local divs = (maxp.x-minp.x)/divlen+1;
for yy=minh,maxh do
local x = pr:next(1,chance)
if x == 1 then
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)
local up = minetest.env:get_node({x=cx,y=yy,z=cz}).name
local down = minetest.env:get_node({x=cx,y=yy-1,z=cz}).name
if ( up == "default:water_source" or up == "air" ) and
( down == "default:sand" or (dirt == 1 and (down == "default:dirt" or down == "default:dirt_with_grass" ))) then
local is_shallow = true
local num_water_around = 0
if minetest.env:get_node({x=cx-divlen*2,y=yy,z=cz}).name == "default:water_source" then
num_water_around = num_water_around + 1 end
if minetest.env:get_node({x=cx+divlen*2,y=yy,z=cz}).name == "default:water_source" then
num_water_around = num_water_around + 1 end
if minetest.env:get_node({x=cx,y=yy,z=cz-divlen*2}).name == "default:water_source" then
num_water_around = num_water_around + 1 end
if minetest.env:get_node({x=cx,y=yy,z=cz+divlen*2}).name == "default:water_source" then
num_water_around = num_water_around + 1 end
if num_water_around >= 3 then
is_shallow = false
end
if is_shallow then
for x1=-divlen,divlen do
for z1=-divlen,divlen do
local p={x=cx+x1,y=yy-1,z=cz+z1}
down = minetest.env:get_node(p).name
if down == "default:sand" or (dirt == 1 and (down == "default:dirt" or down == "default:dirt_with_grass")) then
minetest.env:set_node(p, {name=name})
end
end
end
end
end
end
end
end
end
end
end
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
minetest.register_on_generated(function(minp, maxp, seed)
-- Generate stratus
print("DARKAGE: Generate stratus");
generate_ore("darkage:desert_stone_with_iron", "default:desert_stone", minp, maxp, seed+0, 1/7/7/7, 3, 5, -15, 40)
generate_claylike("darkage:mud", minp, maxp, seed+1, 4, 0, 2, 0)
generate_claylike("darkage:silt", minp, maxp, seed+2, 4, -1, 1, 1)
generate_stratus("darkage:chalk",
{"default:stone"},
{"default:stone","air"}, nil,
minp, maxp, seed+3, 4, 25, 8, 0, -20, 50)
generate_stratus("darkage:ors",
{"default:stone"},
{"default:stone","air","default:water_source"}, nil,
minp, maxp, seed+4, 4, 25, 7, 50, -200, 500)
generate_stratus("darkage:shale",
{"default:stone"},
{"default:stone","air"}, nil,
minp, maxp, seed+5, 4, 23, 7, 50, -50, 20)
generate_stratus("darkage:slate",
{"default:stone"},
{"default:stone","air"}, nil,
minp, maxp, seed+6, 6, 23, 5, 50, -500, 0)
generate_stratus("darkage:schist",
{"default:stone"},
{"default:stone","air"}, nil,
minp, maxp, seed+7, 6, 19, 6, 50, -31000, -10)
generate_stratus("darkage:basalt",
{"default:stone"},
{"default:stone","air"}, nil,
minp, maxp, seed+8, 5, 20, 5, 20, -31000, -50)
generate_stratus("darkage:marble",
{"default:stone"},
{"default:stone","air"}, nil,
minp, maxp, seed+9, 4, 25, 6, 50, -31000, -75)
generate_stratus("darkage:serpentine",
{"default:stone"},
{"default:stone","air"}, nil,
minp, maxp, seed+10, 4, 28, 8, 50, -31000, -350)
generate_stratus("darkage:gneiss",
{"default:stone"},
{"default:stone","air"}, nil,
minp, maxp, seed+11, 4, 15, 5, 50, -31000, -250)
end)

144
mods/darkage/stairs.lua Normal file
View File

@ -0,0 +1,144 @@
darkage = {}
function darkage.register_stairs(modname, item, groups, images, description)
local recipeitem = modname..":"..item
local itemname = modname..":stair_"..item
minetest.register_node(itemname, {
description = description.." stair",
drawtype = "nodebox",
tiles = images,
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = true,
groups = groups,
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, 0, 0.5, 0.5, 0.5},
},
},
})
minetest.register_craft({
output = itemname .. ' 4',
recipe = {
{recipeitem, "", ""},
{recipeitem, recipeitem, ""},
{recipeitem, recipeitem, recipeitem},
},
})
-- Flipped recipe for the silly minecrafters
minetest.register_craft({
output = itemname .. ' 4',
recipe = {
{"", "", recipeitem},
{"", recipeitem, recipeitem},
{recipeitem, recipeitem, recipeitem},
},
})
itemname=modname..":slab_" .. item
minetest.register_node(itemname, {
description = description.." slab",
drawtype = "nodebox",
tiles = images,
paramtype = "light",
is_ground_content = true,
groups = groups,
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
},
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
},
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)
local n1 = minetest.env:get_node(p1)
if n0.name == itemname then
slabpos = p0
slabnode = n0
elseif n1.name == itemname then
slabpos = p1
slabnode = n1
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_craft({
output = itemname .. ' 3',
recipe = {
{recipeitem, recipeitem, recipeitem},
},
})
end
darkage.register_stairs("darkage","basalt_cobble",
{cracky=3},
{"darkage_basalt_cobble.png"},
"Basalt Cobble"
)
darkage.register_stairs("darkage","slate_tale",
{cracky=3},
{"darkage_slate_tale.png"},
"Slate Tale"
)
darkage.register_stairs("darkage","straw",
{snappy=3, flammable=2},
{"darkage_straw.png"},
"Straw"
)
darkage.register_stairs("darkage","stone_brick",
{cracky=3},
{"darkage_stone_brick.png"},
"Stone Brick"
)
darkage.register_stairs("darkage","ors_cobble",
{cracky=3},
{"darkage_ors_cobble.png"},
"Old Red Sandtone"
)
darkage.register_stairs("darkage","desert_stone_cobble",
{cracky=3},
{"darkage_desert_stone_cobble.png"},
"Desert Stone Cobble"
)

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 785 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 805 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 809 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 942 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

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