bring all upstream minetest_game code up-to-date.
|
@ -0,0 +1,277 @@
|
|||
minetest_game API
|
||||
======================
|
||||
GitHub Repo: https://github.com/minetest/minetest_game
|
||||
|
||||
Introduction
|
||||
------------
|
||||
The minetest_game gamemode offers multiple new possibilities in addition to Minetest's built-in API, allowing you to
|
||||
add new plants to farming mod, buckets for new liquids, new stairs and custom panes.
|
||||
For information on the Minetest API, visit https://github.com/minetest/minetest/blob/master/doc/lua_api.txt
|
||||
Please note:
|
||||
[XYZ] refers to a section the Minetest API
|
||||
[#ABC] refers to a section in this document
|
||||
^ Explanation for line above
|
||||
|
||||
Bucket API
|
||||
----------
|
||||
The bucket API allows registering new types of buckets for non-default liquids.
|
||||
|
||||
bucket.register_liquid(
|
||||
"default:lava_source", -- Source node name
|
||||
"default:lava_flowing", -- Flowing node name
|
||||
"bucket:bucket_lava", -- Name to be used for bucket
|
||||
"bucket_lava.png", -- Bucket texture (for wielditem and inventory_image)
|
||||
"Lava Bucket" -- Bucket description
|
||||
)
|
||||
|
||||
Doors API
|
||||
---------
|
||||
The doors mod allows modders to register custom doors.
|
||||
|
||||
doors.register_door(name, def)
|
||||
^ name: "Door name"
|
||||
^ def: See [#Door definition]
|
||||
|
||||
#Door definition
|
||||
----------------
|
||||
{
|
||||
description = "Door description",
|
||||
inventory_image = "mod_door_inv.png",
|
||||
groups = {group = 1},
|
||||
tiles_bottom: [Tile definition],
|
||||
^ the tiles of the bottom part of the door {front, side}
|
||||
tiles_top: [Tile definition],
|
||||
^ the tiles of the bottom part of the door {front, side}
|
||||
node_box_bottom = regular nodebox, see [Node boxes], OPTIONAL,
|
||||
node_box_top = regular nodebox, see [Node boxes], OPTIONAL,
|
||||
selection_box_bottom = regular nodebox, see [Node boxes], OPTIONAL,
|
||||
selection_box_top = regular nodebox, see [Node boxes], OPTIONAL,
|
||||
sound_open_door = sound play for open door, OPTIONAL,
|
||||
sound_close_door = sound play for close door, OPTIONAL,
|
||||
only_placer_can_open = true/false,
|
||||
^ If true, only placer can open the door (locked for others)
|
||||
}
|
||||
|
||||
Farming API
|
||||
-----------
|
||||
The farming API allows you to easily register plants and hoes.
|
||||
|
||||
farming.register_hoe(name, hoe definition)
|
||||
-> Register a new hoe, see [#hoe definition]
|
||||
|
||||
farming.register_plant(name, Plant definition)
|
||||
-> Register a new growing plant, see [#Plant definition]
|
||||
|
||||
#Hoe Definition
|
||||
---------------
|
||||
{
|
||||
description = "", -- Description for tooltip
|
||||
inventory_image = "unknown_item.png", -- Image to be used as wield- and inventory image
|
||||
max_uses = 30, -- Uses until destroyed
|
||||
recipe = { -- Craft recipe
|
||||
{"air", "air", "air"},
|
||||
{"", "group:stick"},
|
||||
{"", "group:stick"},
|
||||
}
|
||||
}
|
||||
|
||||
#Plant definition
|
||||
-----------------
|
||||
{
|
||||
description = "", -- Description of seed item
|
||||
inventory_image = "unknown_item.png", -- Image to be used as seed's wield- and inventory image
|
||||
steps = 8, -- How many steps the plant has to grow, until it can be harvested
|
||||
^ Always provide a plant texture for ech step, format: modname_plantname_i.png (i = stepnumber)
|
||||
minlight = 13, -- Minimum light to grow
|
||||
maxlight = LIGHT_MAX -- Maximum light to grow
|
||||
}
|
||||
|
||||
Stairs API
|
||||
----------
|
||||
The stairs API lets you register stairs and slabs and ensures that they are registered the same way as those
|
||||
delivered with minetest_game, to keep them compatible with other mods.
|
||||
|
||||
stairs.register_stair(subname, recipeitem, groups, images, description, sounds)
|
||||
-> Registers a stair.
|
||||
-> subname: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname"
|
||||
-> recipeitem: Item used in the craft recipe, e.g. "default:cobble"
|
||||
-> groups: see [Known damage and digging time defining groups]
|
||||
-> images: see [Tile definition]
|
||||
-> description: used for the description field in the stair's definition
|
||||
-> sounds: see [#Default sounds]
|
||||
|
||||
stairs.register_slab(subname, recipeitem, groups, images, description, sounds)
|
||||
-> Registers a slabs
|
||||
-> subname: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname"
|
||||
-> recipeitem: Item used in the craft recipe, e.g. "default:cobble"
|
||||
-> groups: see [Known damage and digging time defining groups]
|
||||
-> images: see [Tile definition]
|
||||
-> description: used for the description field in the stair's definition
|
||||
-> sounds: see [#Default sounds]
|
||||
|
||||
stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds)
|
||||
-> A wrapper for stairs.register_stair and stairs.register_slab
|
||||
-> Uses almost the same arguments as stairs.register_stair
|
||||
-> desc_stair: Description for stair node
|
||||
-> desc_slab: Description for slab node
|
||||
|
||||
Xpanes API
|
||||
----------
|
||||
Creates panes that automatically connect to each other
|
||||
|
||||
xpanes.register_pane(subname, def)
|
||||
-> subname: used for nodename. Result: "xpanes:subname" and "xpanes:subname_{2..15}"
|
||||
-> def: See [#Pane definition]
|
||||
|
||||
#Pane definition
|
||||
----------------
|
||||
{
|
||||
textures = {"texture_Bottom_top", "texture_left_right", "texture_front_back"},
|
||||
^ More tiles aren't supported
|
||||
groups = {group = rating},
|
||||
^ Uses the known node groups, see [Known damage and digging time defining groups]
|
||||
sounds = SoundSpec,
|
||||
^ See [#Default sounds]
|
||||
recipe = {{"","","","","","","","",""}},
|
||||
^ Recipe field only
|
||||
}
|
||||
|
||||
Default sounds
|
||||
--------------
|
||||
Sounds inside the default table can be used within the sounds field of node definitions.
|
||||
|
||||
default.node_sound_defaults()
|
||||
default.node_sound_stone_defaults()
|
||||
default.node_sound_dirt_defaults()
|
||||
default.node_sound_sand_defaults()
|
||||
default.node_sound_wood_defaults()
|
||||
default.node_sound_leaves_defaults()
|
||||
default.node_sound_glass_defaults()
|
||||
|
||||
Player API
|
||||
----------
|
||||
The player API can register player models and update the player's appearence
|
||||
|
||||
default.player_register_model(name, def)
|
||||
^ Register a new model to be used by players.
|
||||
-> name: model filename such as "character.x", "foo.b3d", etc.
|
||||
-> def: See [#Model definition]
|
||||
|
||||
default.registered_player_models[name]
|
||||
^ Get a model's definition
|
||||
-> see [#Model definition]
|
||||
|
||||
default.player_set_model(player, model_name)
|
||||
^ Change a player's model
|
||||
-> player: PlayerRef
|
||||
-> model_name: model registered with player_register_model()
|
||||
|
||||
default.player_set_animation(player, anim_name [, speed])
|
||||
^ Applies an animation to a player
|
||||
-> anim_name: name of the animation.
|
||||
-> speed: frames per second. If nil, default from the model is used
|
||||
|
||||
default.player_set_textures(player, textures)
|
||||
^ Sets player textures
|
||||
-> player: PlayerRef
|
||||
-> textures: array of textures
|
||||
^ If <textures> is nil, the default textures from the model def are used
|
||||
|
||||
default.player_get_animation(player)
|
||||
^ Returns a table containing fields "model", "textures" and "animation".
|
||||
^ Any of the fields of the returned table may be nil.
|
||||
-> player: PlayerRef
|
||||
|
||||
Model Definition
|
||||
----------------
|
||||
{
|
||||
animation_speed = 30, -- Default animation speed, in FPS.
|
||||
textures = {"character.png", }, -- Default array of textures.
|
||||
visual_size = {x=1, y=1,}, -- Used to scale the model.
|
||||
animations = {
|
||||
-- <anim_name> = { x=<start_frame>, y=<end_frame>, },
|
||||
foo = { x= 0, y=19, },
|
||||
bar = { x=20, y=39, },
|
||||
-- ...
|
||||
},
|
||||
}
|
||||
|
||||
Leafdecay
|
||||
---------
|
||||
To enable leaf decay for a node, add it to the "leafdecay" group.
|
||||
|
||||
The rating of the group determines how far from a node in the group "tree"
|
||||
the node can be without decaying.
|
||||
|
||||
If param2 of the node is ~= 0, the node will always be preserved. Thus, if
|
||||
the player places a node of that kind, you will want to set param2=1 or so.
|
||||
|
||||
The function default.after_place_leaves can be set as after_place_node of a node
|
||||
to set param2 to 1 if the player places the node (should not be used for nodes
|
||||
that use param2 otherwise (e.g. facedir)).
|
||||
|
||||
If the node is in the leafdecay_drop group then it will always be dropped as an
|
||||
item.
|
||||
|
||||
Dyes
|
||||
----
|
||||
To make recipes that will work with any dye ever made by anybody, define
|
||||
them based on groups. You can select any group of groups, based on your need for
|
||||
amount of colors.
|
||||
|
||||
#Color groups
|
||||
-------------
|
||||
Base color groups:
|
||||
- basecolor_white
|
||||
- basecolor_grey
|
||||
- basecolor_black
|
||||
- basecolor_red
|
||||
- basecolor_yellow
|
||||
- basecolor_green
|
||||
- basecolor_cyan
|
||||
- basecolor_blue
|
||||
- basecolor_magenta
|
||||
|
||||
Extended color groups (* = equal to a base color):
|
||||
* excolor_white
|
||||
- excolor_lightgrey
|
||||
* excolor_grey
|
||||
- excolor_darkgrey
|
||||
* excolor_black
|
||||
* excolor_red
|
||||
- excolor_orange
|
||||
* excolor_yellow
|
||||
- excolor_lime
|
||||
* excolor_green
|
||||
- excolor_aqua
|
||||
* excolor_cyan
|
||||
- excolor_sky_blue
|
||||
* excolor_blue
|
||||
- excolor_violet
|
||||
* excolor_magenta
|
||||
- excolor_red_violet
|
||||
|
||||
The whole unifieddyes palette as groups:
|
||||
- unicolor_<excolor>
|
||||
For the following, no white/grey/black is allowed:
|
||||
- unicolor_medium_<excolor>
|
||||
- unicolor_dark_<excolor>
|
||||
- unicolor_light_<excolor>
|
||||
- unicolor_<excolor>_s50
|
||||
- unicolor_medium_<excolor>_s50
|
||||
- unicolor_dark_<excolor>_s50
|
||||
|
||||
Example of one shapeless recipe using a color group:
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = '<mod>:item_yellow',
|
||||
recipe = {'<mod>:item_no_color', 'group:basecolor_yellow'},
|
||||
})
|
||||
|
||||
#Color lists
|
||||
------------
|
||||
dye.basecolors
|
||||
^ Array containing the names of available base colors
|
||||
|
||||
dye.excolors
|
||||
^ Array containing the names of the available extended colors
|
After Width: | Height: | Size: 152 KiB |
|
@ -0,0 +1,24 @@
|
|||
# This file contains settings of minetest_game that can be changed in
|
||||
# minetest.conf
|
||||
#
|
||||
# By default, all the settings are commented and not functional.
|
||||
# Uncomment settings by removing the preceding #.
|
||||
|
||||
# Whether creative mode (fast digging of all blocks, unlimited resources) should be enabled
|
||||
#creative_mode = false
|
||||
|
||||
# The time in seconds after which the bones of a dead player can be looted by everyone
|
||||
# 0 to disable
|
||||
#share_bones_time = 1200
|
||||
|
||||
# Whether fire should be disabled (all fire nodes will instantly disappear)
|
||||
#disable_fire = false
|
||||
|
||||
# Whether steel tools, torches and cobblestone should be given to new players
|
||||
#give_initial_stuff = false
|
||||
|
||||
# Whether the TNT mod should be enabled
|
||||
#enable_tnt = <true in singleplayer, false in multiplayer>
|
||||
|
||||
# The radius of a TNT explosion
|
||||
#tnt_radius = 3
|
|
@ -1,6 +1,6 @@
|
|||
Minetest 0.4 mod: boats
|
||||
=======================
|
||||
by PilzAdam
|
||||
by PilzAdam, slightly modified for NeXt
|
||||
|
||||
License of source code:
|
||||
-----------------------
|
||||
|
@ -13,4 +13,4 @@ WTFPL
|
|||
Authors of media files:
|
||||
-----------------------
|
||||
textures: Zeg9
|
||||
model: thetoon and Zeg9
|
||||
model: thetoon and Zeg9, modified by PavelS(SokolovPavel)
|
||||
|
|
|
@ -12,139 +12,184 @@ local function get_sign(i)
|
|||
if i == 0 then
|
||||
return 0
|
||||
else
|
||||
return i/math.abs(i)
|
||||
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}
|
||||
local x = -math.sin(yaw) * v
|
||||
local z = math.cos(yaw) * v
|
||||
return {x = x, y = y, z = z}
|
||||
end
|
||||
|
||||
local function get_v(v)
|
||||
return math.sqrt(v.x^2+v.z^2)
|
||||
return math.sqrt(v.x ^ 2 + v.z ^ 2)
|
||||
end
|
||||
|
||||
--
|
||||
-- Cart entity
|
||||
-- Boat entity
|
||||
--
|
||||
|
||||
local boat = {
|
||||
physical = true,
|
||||
collisionbox = {-0.6,-0.4,-0.6, 0.6,0.3,0.6},
|
||||
collisionbox = {-0.5, -0.4, -0.5, 0.5, 0.3, 0.5},
|
||||
visual = "mesh",
|
||||
mesh = "boat.x",
|
||||
textures = {"default_wood.png"},
|
||||
|
||||
|
||||
driver = nil,
|
||||
v = 0,
|
||||
last_v = 0,
|
||||
removed = false
|
||||
}
|
||||
|
||||
function boat:on_rightclick(clicker)
|
||||
function boat.on_rightclick(self, clicker)
|
||||
if not clicker or not clicker:is_player() then
|
||||
return
|
||||
end
|
||||
local name = clicker:get_player_name()
|
||||
if self.driver and clicker == self.driver then
|
||||
self.driver = nil
|
||||
clicker:set_detach()
|
||||
default.player_attached[name] = false
|
||||
default.player_set_animation(clicker, "stand" , 30)
|
||||
elseif not self.driver then
|
||||
self.driver = clicker
|
||||
clicker:set_attach(self.object, "", {x=0,y=5,z=0}, {x=0,y=0,z=0})
|
||||
self.object:setyaw(clicker:get_look_yaw())
|
||||
clicker:set_attach(self.object, "", {x = 0, y = 11, z = -3}, {x = 0, y = 0, z = 0})
|
||||
default.player_attached[name] = true
|
||||
minetest.after(0.2, function()
|
||||
default.player_set_animation(clicker, "sit" , 30)
|
||||
end)
|
||||
self.object:setyaw(clicker:get_look_yaw() - math.pi / 2)
|
||||
end
|
||||
end
|
||||
|
||||
function boat:on_activate(staticdata, dtime_s)
|
||||
self.object:set_armor_groups({immortal=1})
|
||||
function boat.on_activate(self, staticdata, dtime_s)
|
||||
self.object:set_armor_groups({immortal = 1})
|
||||
if staticdata then
|
||||
self.v = tonumber(staticdata)
|
||||
end
|
||||
self.last_v = self.v
|
||||
end
|
||||
|
||||
function boat:get_staticdata()
|
||||
return tostring(v)
|
||||
function boat.get_staticdata(self)
|
||||
return tostring(self.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")
|
||||
function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, direction)
|
||||
if not puncher or not puncher:is_player() or self.removed then
|
||||
return
|
||||
end
|
||||
if self.driver and puncher == self.driver then
|
||||
self.driver = nil
|
||||
puncher:set_detach()
|
||||
default.player_attached[puncher:get_player_name()] = false
|
||||
end
|
||||
if not self.driver then
|
||||
self.removed = true
|
||||
-- delay remove to ensure player is detached
|
||||
minetest.after(0.1, function()
|
||||
self.object:remove()
|
||||
end)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
puncher:get_inventory():add_item("main", "boats:boat")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function boat:on_step(dtime)
|
||||
self.v = get_v(self.object:getvelocity())*get_sign(self.v)
|
||||
function boat.on_step(self, dtime)
|
||||
self.v = get_v(self.object:getvelocity()) * get_sign(self.v)
|
||||
if self.driver then
|
||||
local ctrl = self.driver:get_player_control()
|
||||
local yaw = self.object:getyaw()
|
||||
if ctrl.up then
|
||||
self.v = self.v+0.1
|
||||
end
|
||||
if ctrl.down then
|
||||
self.v = self.v-0.08
|
||||
self.v = self.v + 0.1
|
||||
elseif ctrl.down then
|
||||
self.v = self.v - 0.1
|
||||
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)
|
||||
if self.v < 0 then
|
||||
self.object:setyaw(yaw - (1 + dtime) * 0.03)
|
||||
else
|
||||
self.object:setyaw(yaw + (1 + dtime) * 0.03)
|
||||
end
|
||||
elseif ctrl.right then
|
||||
if self.v < 0 then
|
||||
self.object:setyaw(yaw + (1 + dtime) * 0.03)
|
||||
else
|
||||
self.object:setyaw(yaw - (1 + dtime) * 0.03)
|
||||
end
|
||||
end
|
||||
end
|
||||
local velo = self.object:getvelocity()
|
||||
if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then
|
||||
self.object:setpos(self.object:getpos())
|
||||
return
|
||||
end
|
||||
local s = get_sign(self.v)
|
||||
self.v = self.v - 0.02*s
|
||||
self.v = self.v - 0.02 * s
|
||||
if s ~= get_sign(self.v) then
|
||||
self.object:setvelocity({x=0, y=0, z=0})
|
||||
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)
|
||||
self.v = 4.5 * get_sign(self.v)
|
||||
end
|
||||
|
||||
|
||||
local p = self.object:getpos()
|
||||
p.y = p.y-0.5
|
||||
p.y = p.y - 0.5
|
||||
local new_velo = {x = 0, y = 0, z = 0}
|
||||
local new_acce = {x = 0, y = 0, z = 0}
|
||||
if not is_water(p) then
|
||||
if minetest.registered_nodes[minetest.get_node(p).name].walkable then
|
||||
local nodedef = minetest.registered_nodes[minetest.get_node(p).name]
|
||||
if (not nodedef) or nodedef.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=3, z=0})
|
||||
local y = self.object:getvelocity().y
|
||||
if y > 2 then
|
||||
y = 2
|
||||
end
|
||||
if y < 0 then
|
||||
self.object:setacceleration({x=0, y=10, z=0})
|
||||
end
|
||||
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), y))
|
||||
new_acce = {x = 0, y = 1, z = 0}
|
||||
else
|
||||
self.object:setacceleration({x=0, y=0, z=0})
|
||||
new_acce = {x = 0, y = -9.8, z = 0}
|
||||
end
|
||||
new_velo = get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y)
|
||||
self.object:setpos(self.object:getpos())
|
||||
else
|
||||
p.y = p.y + 1
|
||||
if is_water(p) then
|
||||
local y = self.object:getvelocity().y
|
||||
if y >= 4.5 then
|
||||
y = 4.5
|
||||
elseif y < 0 then
|
||||
new_acce = {x = 0, y = 20, z = 0}
|
||||
else
|
||||
new_acce = {x = 0, y = 5, z = 0}
|
||||
end
|
||||
new_velo = get_velocity(self.v, self.object:getyaw(), y)
|
||||
self.object:setpos(self.object:getpos())
|
||||
else
|
||||
new_acce = {x = 0, y = 0, z = 0}
|
||||
if math.abs(self.object:getvelocity().y) < 1 then
|
||||
local pos = self.object:getpos()
|
||||
pos.y = math.floor(pos.y)+0.5
|
||||
pos.y = math.floor(pos.y) + 0.5
|
||||
self.object:setpos(pos)
|
||||
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), 0))
|
||||
new_velo = get_velocity(self.v, self.object:getyaw(), 0)
|
||||
else
|
||||
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y))
|
||||
new_velo = get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y)
|
||||
self.object:setpos(self.object:getpos())
|
||||
end
|
||||
end
|
||||
end
|
||||
self.object:setvelocity(new_velo)
|
||||
self.object:setacceleration(new_acce)
|
||||
end
|
||||
|
||||
minetest.register_entity("boats:boat", boat)
|
||||
|
||||
|
||||
minetest.register_craftitem("boats:boat", {
|
||||
description = "Boat",
|
||||
inventory_image = "boat_inventory.png",
|
||||
wield_image = "boat_wield.png",
|
||||
wield_scale = {x=2, y=2, z=1},
|
||||
wield_scale = {x = 2, y = 2, z = 1},
|
||||
liquids_pointable = true,
|
||||
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
|
@ -152,9 +197,11 @@ minetest.register_craftitem("boats:boat", {
|
|||
if not is_water(pointed_thing.under) then
|
||||
return
|
||||
end
|
||||
pointed_thing.under.y = pointed_thing.under.y+0.5
|
||||
pointed_thing.under.y = pointed_thing.under.y + 0.5
|
||||
minetest.add_entity(pointed_thing.under, "boats:boat")
|
||||
itemstack:take_item()
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
@ -162,8 +209,9 @@ minetest.register_craftitem("boats:boat", {
|
|||
minetest.register_craft({
|
||||
output = "boats:boat",
|
||||
recipe = {
|
||||
{"", "", ""},
|
||||
{"group:wood", "", "group:wood"},
|
||||
{"", "", "" },
|
||||
{"group:wood", "", "group:wood"},
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
},
|
||||
})
|
||||
|
||||
|
|
22220
mods/boats/models/boat.x
|
@ -1,8 +1,6 @@
|
|||
-- 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")
|
||||
|
@ -51,7 +49,6 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, 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
|
||||
|
@ -72,40 +69,20 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
|
|||
itemstack) or itemstack
|
||||
end
|
||||
|
||||
local place_liquid = function(pos, node, source, flowing, fullness)
|
||||
local place_liquid = function(pos, node, source, flowing)
|
||||
if check_protection(pos,
|
||||
user and user:get_player_name() or "",
|
||||
"place "..source) then
|
||||
return
|
||||
end
|
||||
if math.floor(fullness/128) == 1 or
|
||||
not minetest.setting_getbool("liquid_finite") then
|
||||
minetest.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.add_node(pos, {name=source,
|
||||
param2=LIQUID_MAX})
|
||||
else
|
||||
minetest.add_node(pos, {name=flowing,
|
||||
param2=fullness})
|
||||
end
|
||||
minetest.add_node(pos, {name=source})
|
||||
end
|
||||
|
||||
-- Check if pointing to a buildable node
|
||||
local fullness = tonumber(itemstack:get_metadata())
|
||||
if not fullness then fullness = LIQUID_MAX end
|
||||
|
||||
if ndef and ndef.buildable_to then
|
||||
-- buildable; replace the node
|
||||
place_liquid(pointed_thing.under, node,
|
||||
source, flowing, fullness)
|
||||
source, flowing)
|
||||
else
|
||||
-- not buildable to; place the liquid above
|
||||
-- check if the node above can be replaced
|
||||
|
@ -113,7 +90,7 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
|
|||
if node and minetest.registered_nodes[node.name].buildable_to then
|
||||
place_liquid(pointed_thing.above,
|
||||
node, source,
|
||||
flowing, fullness)
|
||||
flowing)
|
||||
else
|
||||
-- do not remove the bucket with the liquid
|
||||
return
|
||||
|
@ -139,9 +116,7 @@ minetest.register_craftitem("bucket:bucket_empty", {
|
|||
local node = minetest.get_node(pointed_thing.under)
|
||||
local 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
|
||||
node.name == liquiddef.source then
|
||||
if check_protection(pointed_thing.under,
|
||||
user:get_player_name(),
|
||||
"take ".. node.name) then
|
||||
|
@ -150,11 +125,7 @@ minetest.register_craftitem("bucket:bucket_empty", {
|
|||
|
||||
minetest.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)})
|
||||
return ItemStack(liquiddef.itemname)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -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.
|
||||
|
|
@ -0,0 +1 @@
|
|||
default
|
|
@ -0,0 +1,172 @@
|
|||
-- minetest/creative/init.lua
|
||||
|
||||
creative_inventory = {}
|
||||
creative_inventory.creative_inventory_size = 0
|
||||
|
||||
-- Create detached creative inventory after loading all mods
|
||||
minetest.after(0, function()
|
||||
local inv = minetest.create_detached_inventory("creative", {
|
||||
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||
if minetest.setting_getbool("creative_mode") then
|
||||
return count
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
allow_put = function(inv, listname, index, stack, player)
|
||||
return 0
|
||||
end,
|
||||
allow_take = function(inv, listname, index, stack, player)
|
||||
if minetest.setting_getbool("creative_mode") then
|
||||
return -1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||
end,
|
||||
on_put = function(inv, listname, index, stack, player)
|
||||
end,
|
||||
on_take = function(inv, listname, index, stack, player)
|
||||
--print(player:get_player_name().." takes item from creative inventory; listname="..dump(listname)..", index="..dump(index)..", stack="..dump(stack))
|
||||
if stack then
|
||||
minetest.log("action", player:get_player_name().." takes "..dump(stack:get_name()).." from creative inventory")
|
||||
--print("stack:get_name()="..dump(stack:get_name())..", stack:get_count()="..dump(stack:get_count()))
|
||||
end
|
||||
end,
|
||||
})
|
||||
local creative_list = {}
|
||||
for name,def in pairs(minetest.registered_items) do
|
||||
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0)
|
||||
and def.description and def.description ~= "" then
|
||||
table.insert(creative_list, name)
|
||||
end
|
||||
end
|
||||
table.sort(creative_list)
|
||||
inv:set_size("main", #creative_list)
|
||||
for _,itemstring in ipairs(creative_list) do
|
||||
inv:add_item("main", ItemStack(itemstring))
|
||||
end
|
||||
creative_inventory.creative_inventory_size = #creative_list
|
||||
--print("creative inventory size: "..dump(creative_inventory.creative_inventory_size))
|
||||
end)
|
||||
|
||||
-- Create the trash field
|
||||
local trash = minetest.create_detached_inventory("creative_trash", {
|
||||
-- Allow the stack to be placed and remove it in on_put()
|
||||
-- This allows the creative inventory to restore the stack
|
||||
allow_put = function(inv, listname, index, stack, player)
|
||||
if minetest.setting_getbool("creative_mode") then
|
||||
return stack:get_count()
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
on_put = function(inv, listname, index, stack, player)
|
||||
inv:set_stack(listname, index, "")
|
||||
end,
|
||||
})
|
||||
trash:set_size("main", 1)
|
||||
|
||||
|
||||
creative_inventory.set_creative_formspec = function(player, start_i, pagenum)
|
||||
pagenum = math.floor(pagenum)
|
||||
local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (6*4) + 1)
|
||||
player:set_inventory_formspec(
|
||||
"size[13,7.5]"..
|
||||
--"image[6,0.6;1,2;player.png]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"list[current_player;main;5,3.5;8,1;]"..
|
||||
"list[current_player;main;5,4.75;8,3;8]"..
|
||||
"list[current_player;craft;8,0;3,3;]"..
|
||||
"list[current_player;craftpreview;12,1;1,1;]"..
|
||||
"list[detached:creative;main;0.3,0.5;4,6;"..tostring(start_i).."]"..
|
||||
"label[2.0,6.55;"..tostring(pagenum).."/"..tostring(pagemax).."]"..
|
||||
"button[0.3,6.5;1.6,1;creative_prev;<<]"..
|
||||
"button[2.7,6.5;1.6,1;creative_next;>>]"..
|
||||
"label[5,1.5;Trash:]"..
|
||||
"list[detached:creative_trash;main;5,2;1,1;]"..
|
||||
default.get_hotbar_bg(5,3.5)
|
||||
)
|
||||
end
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
-- If in creative mode, modify player's inventory forms
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
return
|
||||
end
|
||||
creative_inventory.set_creative_formspec(player, 0, 1)
|
||||
end)
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
return
|
||||
end
|
||||
-- Figure out current page from formspec
|
||||
local current_page = 0
|
||||
local formspec = player:get_inventory_formspec()
|
||||
local start_i = string.match(formspec, "list%[detached:creative;main;[%d.]+,[%d.]+;[%d.]+,[%d.]+;(%d+)%]")
|
||||
start_i = tonumber(start_i) or 0
|
||||
|
||||
if fields.creative_prev then
|
||||
start_i = start_i - 4*6
|
||||
end
|
||||
if fields.creative_next then
|
||||
start_i = start_i + 4*6
|
||||
end
|
||||
|
||||
if start_i < 0 then
|
||||
start_i = start_i + 4*6
|
||||
end
|
||||
if start_i >= creative_inventory.creative_inventory_size then
|
||||
start_i = start_i - 4*6
|
||||
end
|
||||
|
||||
if start_i < 0 or start_i >= creative_inventory.creative_inventory_size then
|
||||
start_i = 0
|
||||
end
|
||||
|
||||
creative_inventory.set_creative_formspec(player, start_i, start_i / (6*4) + 1)
|
||||
end)
|
||||
|
||||
if minetest.setting_getbool("creative_mode") then
|
||||
local digtime = 0.5
|
||||
minetest.register_item(":", {
|
||||
type = "none",
|
||||
wield_image = "wieldhand.png",
|
||||
wield_scale = {x=1,y=1,z=2.5},
|
||||
range = 10,
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.5,
|
||||
max_drop_level = 3,
|
||||
groupcaps = {
|
||||
crumbly = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
|
||||
cracky = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
|
||||
snappy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
|
||||
choppy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
|
||||
oddly_breakable_by_hand = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
|
||||
},
|
||||
damage_groups = {fleshy = 10},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
|
||||
return true
|
||||
end)
|
||||
|
||||
function minetest.handle_node_drops(pos, drops, digger)
|
||||
if not digger or not digger:is_player() then
|
||||
return
|
||||
end
|
||||
local inv = digger:get_inventory()
|
||||
if inv then
|
||||
for _,item in ipairs(drops) do
|
||||
item = ItemStack(item):get_name()
|
||||
if not inv:contains_item("main", item) then
|
||||
inv:add_item("main", item)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -23,14 +23,6 @@ Everything not listed in here:
|
|||
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
|
||||
Cisoun's WTFPL texture pack:
|
||||
default_chest_front.png
|
||||
default_chest_lock.png
|
||||
default_chest_side.png
|
||||
default_chest_top.png
|
||||
default_stone_brick.png
|
||||
default_dirt.png
|
||||
default_grass.png
|
||||
default_grass_side.png
|
||||
default_jungletree.png
|
||||
default_jungletree_top.png
|
||||
default_lava.png
|
||||
|
@ -38,23 +30,17 @@ Cisoun's WTFPL texture pack:
|
|||
default_sapling.png
|
||||
default_sign_wall.png
|
||||
default_stone.png
|
||||
default_tool_mesepick.png
|
||||
default_tool_steelpick.png
|
||||
default_tool_steelshovel.png
|
||||
default_tool_stonepick.png
|
||||
default_tool_stoneshovel.png
|
||||
default_tool_woodpick.png
|
||||
default_tool_woodshovel.png
|
||||
default_tree.png
|
||||
default_tree_top.png
|
||||
default_water.png
|
||||
|
||||
Cisoun's conifers mod (WTFPL):
|
||||
default_pine_needles.png
|
||||
|
||||
Originating from G4JC's Almost MC Texture Pack:
|
||||
default_wood.png
|
||||
default_torch.png
|
||||
default_torch_on_ceiling.png
|
||||
default_torch_on_floor.png
|
||||
default_cobble.png
|
||||
|
||||
VanessaE's animated torches (WTFPL):
|
||||
default_torch_animated.png
|
||||
|
@ -80,13 +66,10 @@ VanessaE (WTFPL):
|
|||
|
||||
Calinou (CC BY-SA):
|
||||
default_brick.png
|
||||
default_clay_brick.png
|
||||
default_papyrus.png
|
||||
default_tool_steelsword.png
|
||||
default_bronze_ingot.png
|
||||
default_copper_ingot.png
|
||||
default_copper_lump.png
|
||||
default_mineral_copper.png
|
||||
default_glass_detail.png
|
||||
|
||||
MirceaKitsune (WTFPL):
|
||||
character.x
|
||||
|
@ -100,22 +83,8 @@ PilzAdam (WTFPL):
|
|||
default_junglewood.png
|
||||
default_obsidian_glass.png
|
||||
default_obsidian_shard.png
|
||||
default_mossycobble.png
|
||||
default_gold_ingot.png
|
||||
default_gold_lump.png
|
||||
default_mineral_gold.png
|
||||
default_diamond.png
|
||||
default_tool_diamondpick.png
|
||||
default_tool_diamondsword.png
|
||||
default_tool_diamondshovel.png
|
||||
default_tool_diamondaxe.png
|
||||
default_tool_meseaxe.png
|
||||
default_tool_meseshovel.png
|
||||
default_tool_mesesword.png
|
||||
default_tool_bronzeaxe.png
|
||||
default_tool_bronzepick.png
|
||||
default_tool_bronzeshovel.png
|
||||
default_tool_bronzesword.png
|
||||
default_snowball.png
|
||||
|
||||
jojoa1997 (WTFPL):
|
||||
|
@ -128,6 +97,7 @@ Splizard (CC BY-SA 3.0):
|
|||
default_snow.png
|
||||
default_snow_side.png
|
||||
default_ice.png
|
||||
default_pine_sapling.png
|
||||
|
||||
Zeg9 (CC BY-SA 3.0):
|
||||
default_coal_block.png
|
||||
|
@ -135,10 +105,50 @@ Zeg9 (CC BY-SA 3.0):
|
|||
default_copper_block.png
|
||||
default_bronze_block.png
|
||||
default_gold_block.png
|
||||
default_diamond_block.png
|
||||
|
||||
kaeza (WTFPL):
|
||||
paramat (CC BY-SA 3.0):
|
||||
wieldhand.png, based on character.png by Jordach (CC BY-SA 3.0)
|
||||
default_pinetree.png
|
||||
default_pinetree_top.png
|
||||
default_pinewood.png
|
||||
|
||||
brunob.santos (CC BY-SA 4.0):
|
||||
default_desert_cobble.png
|
||||
|
||||
BlockMen (CC BY-SA 3.0):
|
||||
default_stone_brick.png
|
||||
default_wood.png
|
||||
default_clay_brick.png
|
||||
default_tool_steelsword.png
|
||||
default_bronze_ingot.png
|
||||
default_copper_ingot.png
|
||||
default_gold_ingot.png
|
||||
default_diamond.png
|
||||
default_diamond_block.png
|
||||
default_tool_*.png
|
||||
default_lava_source_animated.png
|
||||
default_lava_flowing_animated.png
|
||||
default_book.png
|
||||
default_paper.png
|
||||
default_stick.png
|
||||
default_chest_front.png
|
||||
default_chest_lock.png
|
||||
default_chest_side.png
|
||||
default_chest_top.png
|
||||
bubble.png
|
||||
heart.png
|
||||
gui_*.png
|
||||
|
||||
Neuromancer (CC BY-SA 2.0):
|
||||
default_cobble.png, based on texture by Brane praefect
|
||||
default_mossycobble.png, based on texture by Brane praefect
|
||||
Neuromancer (CC BY-SA 3.0):
|
||||
default_dirt.png
|
||||
default_furnace_*.png
|
||||
|
||||
Philipbenr (CC BY-SA 3.0):
|
||||
default_grass.png
|
||||
default_grass_side.png
|
||||
|
||||
Glass breaking sounds (CC BY 3.0):
|
||||
1: http://www.freesound.org/people/cmusounddesign/sounds/71947/
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
-- aliases (Minetest 0.4 mod)
|
||||
-- Provides alias for most default items
|
||||
|
||||
minetest.register_alias("stone", "default:stone")
|
||||
minetest.register_alias("stone_with_coal", "default:stone_with_coal")
|
||||
minetest.register_alias("stone_with_iron", "default:stone_with_iron")
|
||||
minetest.register_alias("dirt_with_grass", "default:dirt_with_grass")
|
||||
minetest.register_alias("dirt_with_grass_footsteps", "default:dirt_with_grass_footsteps")
|
||||
minetest.register_alias("dirt", "default:dirt")
|
||||
minetest.register_alias("sand", "default:sand")
|
||||
minetest.register_alias("gravel", "default:gravel")
|
||||
minetest.register_alias("sandstone", "default:sandstone")
|
||||
minetest.register_alias("clay", "default:clay")
|
||||
minetest.register_alias("brick", "default:brick")
|
||||
minetest.register_alias("tree", "default:tree")
|
||||
minetest.register_alias("jungletree", "default:jungletree")
|
||||
minetest.register_alias("junglegrass", "default:junglegrass")
|
||||
minetest.register_alias("leaves", "default:leaves")
|
||||
minetest.register_alias("cactus", "default:cactus")
|
||||
minetest.register_alias("papyrus", "default:papyrus")
|
||||
minetest.register_alias("bookshelf", "default:bookshelf")
|
||||
minetest.register_alias("glass", "default:glass")
|
||||
minetest.register_alias("wooden_fence", "default:fence_wood")
|
||||
minetest.register_alias("rail", "default:rail")
|
||||
minetest.register_alias("ladder", "default:ladder")
|
||||
minetest.register_alias("wood", "default:wood")
|
||||
minetest.register_alias("mese", "default:mese")
|
||||
minetest.register_alias("cloud", "default:cloud")
|
||||
minetest.register_alias("water_flowing", "default:water_flowing")
|
||||
minetest.register_alias("water_source", "default:water_source")
|
||||
minetest.register_alias("lava_flowing", "default:lava_flowing")
|
||||
minetest.register_alias("lava_source", "default:lava_source")
|
||||
minetest.register_alias("torch", "default:torch")
|
||||
minetest.register_alias("sign_wall", "default:sign_wall")
|
||||
minetest.register_alias("furnace", "default:furnace")
|
||||
minetest.register_alias("chest", "default:chest")
|
||||
minetest.register_alias("locked_chest", "default:chest_locked")
|
||||
minetest.register_alias("cobble", "default:cobble")
|
||||
minetest.register_alias("mossycobble", "default:mossycobble")
|
||||
minetest.register_alias("steelblock", "default:steelblock")
|
||||
minetest.register_alias("nyancat", "default:nyancat")
|
||||
minetest.register_alias("nyancat_rainbow", "default:nyancat_rainbow")
|
||||
minetest.register_alias("sapling", "default:sapling")
|
||||
minetest.register_alias("apple", "default:apple")
|
||||
|
||||
minetest.register_alias("WPick", "default:pick_wood")
|
||||
minetest.register_alias("STPick", "default:pick_stone")
|
||||
minetest.register_alias("SteelPick", "default:pick_steel")
|
||||
minetest.register_alias("MesePick", "default:pick_mese")
|
||||
minetest.register_alias("WShovel", "default:shovel_wood")
|
||||
minetest.register_alias("STShovel", "default:shovel_stone")
|
||||
minetest.register_alias("SteelShovel", "default:shovel_steel")
|
||||
minetest.register_alias("WAxe", "default:axe_wood")
|
||||
minetest.register_alias("STAxe", "default:axe_stone")
|
||||
minetest.register_alias("SteelAxe", "default:axe_steel")
|
||||
minetest.register_alias("WSword", "default:sword_wood")
|
||||
minetest.register_alias("STSword", "default:sword_stone")
|
||||
minetest.register_alias("SteelSword", "default:sword_steel")
|
||||
|
||||
minetest.register_alias("Stick", "default:stick")
|
||||
minetest.register_alias("paper", "default:paper")
|
||||
minetest.register_alias("book", "default:book")
|
||||
minetest.register_alias("lump_of_coal", "default:coal_lump")
|
||||
minetest.register_alias("lump_of_iron", "default:iron_lump")
|
||||
minetest.register_alias("lump_of_clay", "default:clay_lump")
|
||||
minetest.register_alias("steel_ingot", "default:steel_ingot")
|
||||
minetest.register_alias("clay_brick", "default:clay_brick")
|
|
@ -14,6 +14,13 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:pinewood 4',
|
||||
recipe = {
|
||||
{'default:pinetree'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:stick 4',
|
||||
recipe = {
|
||||
|
@ -208,6 +215,60 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:axe_wood',
|
||||
recipe = {
|
||||
{'group:wood', 'group:wood'},
|
||||
{'group:stick', 'group:wood'},
|
||||
{'group:stick',''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:axe_stone',
|
||||
recipe = {
|
||||
{'group:stone', 'group:stone'},
|
||||
{'group:stick', 'group:stone'},
|
||||
{'group:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:axe_steel',
|
||||
recipe = {
|
||||
{'default:steel_ingot', 'default:steel_ingot'},
|
||||
{'group:stick', 'default:steel_ingot'},
|
||||
{'group:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:axe_bronze',
|
||||
recipe = {
|
||||
{'default:bronze_ingot', 'default:bronze_ingot'},
|
||||
{'group:stick', 'default:bronze_ingot'},
|
||||
{'group:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:axe_mese',
|
||||
recipe = {
|
||||
{'default:mese_crystal', 'default:mese_crystal'},
|
||||
{'group:stick', 'default:mese_crystal'},
|
||||
{'group:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:axe_diamond',
|
||||
recipe = {
|
||||
{'default:diamond', 'default:diamond'},
|
||||
{'group:stick', 'default:diamond'},
|
||||
{'group:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:sword_wood',
|
||||
recipe = {
|
||||
|
@ -263,7 +324,7 @@ minetest.register_craft({
|
|||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:rail 24',
|
||||
output = 'default:rail 15',
|
||||
recipe = {
|
||||
{'default:steel_ingot', '', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'group:stick', 'default:steel_ingot'},
|
||||
|
@ -416,7 +477,7 @@ minetest.register_craft({
|
|||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:sandstonebrick',
|
||||
output = 'default:sandstonebrick 4',
|
||||
recipe = {
|
||||
{'default:sandstone', 'default:sandstone'},
|
||||
{'default:sandstone', 'default:sandstone'},
|
||||
|
@ -520,7 +581,15 @@ minetest.register_craft({
|
|||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:stonebrick',
|
||||
output = 'default:obsidianbrick 4',
|
||||
recipe = {
|
||||
{'default:obsidian', 'default:obsidian'},
|
||||
{'default:obsidian', 'default:obsidian'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:stonebrick 4',
|
||||
recipe = {
|
||||
{'default:stone', 'default:stone'},
|
||||
{'default:stone', 'default:stone'},
|
||||
|
@ -528,7 +597,7 @@ minetest.register_craft({
|
|||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:desert_stonebrick',
|
||||
output = 'default:desert_stonebrick 4',
|
||||
recipe = {
|
||||
{'default:desert_stone', 'default:desert_stone'},
|
||||
{'default:desert_stone', 'default:desert_stone'},
|
||||
|
@ -746,3 +815,10 @@ minetest.register_craft({
|
|||
recipe = "default:grass_1",
|
||||
burntime = 2,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:pine_sapling",
|
||||
burntime = 10,
|
||||
})
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ minetest.register_craftitem("default:paper", {
|
|||
minetest.register_craftitem("default:book", {
|
||||
description = "Book",
|
||||
inventory_image = "default_book.png",
|
||||
groups = {book=1},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:coal_lump", {
|
||||
|
@ -82,11 +83,6 @@ minetest.register_craftitem("default:clay_brick", {
|
|||
inventory_image = "default_clay_brick.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:scorched_stuff", {
|
||||
description = "Scorched Stuff",
|
||||
inventory_image = "default_scorched_stuff.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:obsidian_shard", {
|
||||
description = "Obsidian Shard",
|
||||
inventory_image = "default_obsidian_shard.png",
|
||||
|
|
|
@ -40,9 +40,9 @@ end
|
|||
function default.node_sound_sand_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_sand_footstep", gain=0.5}
|
||||
{name="default_sand_footstep", gain=0.2}
|
||||
table.dug = table.dug or
|
||||
{name="default_sand_footstep", gain=1.0}
|
||||
{name="default_sand_footstep", gain=0.4}
|
||||
table.place = table.place or
|
||||
{name="default_place_node", gain=1.0}
|
||||
default.node_sound_defaults(table)
|
||||
|
@ -64,7 +64,7 @@ function default.node_sound_leaves_defaults(table)
|
|||
table.footstep = table.footstep or
|
||||
{name="default_grass_footstep", gain=0.35}
|
||||
table.dug = table.dug or
|
||||
{name="default_grass_footstep", gain=0.85}
|
||||
{name="default_grass_footstep", gain=0.7}
|
||||
table.dig = table.dig or
|
||||
{name="default_dig_crumbly", gain=0.4}
|
||||
table.place = table.place or
|
||||
|
@ -127,71 +127,25 @@ end
|
|||
minetest.register_on_punchnode(on_punchnode)
|
||||
|
||||
|
||||
--
|
||||
-- Grow trees
|
||||
--
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:sapling"},
|
||||
interval = 10,
|
||||
chance = 50,
|
||||
action = function(pos, node)
|
||||
local nu = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
||||
local is_soil = minetest.get_item_group(nu, "soil")
|
||||
if is_soil == 0 then
|
||||
return
|
||||
end
|
||||
minetest.remove_node(pos)
|
||||
minetest.log("action", "A sapling grows into a tree at "..minetest.pos_to_string(pos))
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local minp, maxp = vm:read_from_map({x=pos.x-16, y=pos.y, z=pos.z-16}, {x=pos.x+16, y=pos.y+16, z=pos.z+16})
|
||||
local a = VoxelArea:new{MinEdge=minp, MaxEdge=maxp}
|
||||
local data = vm:get_data()
|
||||
default.grow_tree(data, a, pos, math.random(1, 4) == 1, math.random(1,100000))
|
||||
vm:set_data(data)
|
||||
vm:write_to_map(data)
|
||||
vm:update_map()
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:junglesapling"},
|
||||
interval = 10,
|
||||
chance = 50,
|
||||
action = function(pos, node)
|
||||
local nu = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
||||
local is_soil = minetest.get_item_group(nu, "soil")
|
||||
if is_soil == 0 then
|
||||
return
|
||||
end
|
||||
minetest.remove_node(pos)
|
||||
minetest.log("action", "A jungle sapling grows into a tree at "..minetest.pos_to_string(pos))
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local minp, maxp = vm:read_from_map({x=pos.x-16, y=pos.y-1, z=pos.z-16}, {x=pos.x+16, y=pos.y+16, z=pos.z+16})
|
||||
local a = VoxelArea:new{MinEdge=minp, MaxEdge=maxp}
|
||||
local data = vm:get_data()
|
||||
default.grow_jungletree(data, a, pos, math.random(1,100000))
|
||||
vm:set_data(data)
|
||||
vm:write_to_map(data)
|
||||
vm:update_map()
|
||||
end
|
||||
})
|
||||
|
||||
--
|
||||
-- Lavacooling
|
||||
--
|
||||
|
||||
default.cool_lava_source = function(pos)
|
||||
minetest.set_node(pos, {name="default:obsidian"})
|
||||
minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.25})
|
||||
end
|
||||
|
||||
default.cool_lava_flowing = function(pos)
|
||||
minetest.set_node(pos, {name="default:stone"})
|
||||
minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.25})
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:lava_flowing"},
|
||||
neighbors = {"group:water"},
|
||||
interval = 5,
|
||||
chance = 15,
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
default.cool_lava_flowing(pos, node, active_object_count, active_object_count_wider)
|
||||
end,
|
||||
|
@ -200,8 +154,8 @@ minetest.register_abm({
|
|||
minetest.register_abm({
|
||||
nodenames = {"default:lava_source"},
|
||||
neighbors = {"group:water"},
|
||||
interval = 5,
|
||||
chance = 15,
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
default.cool_lava_source(pos, node, active_object_count, active_object_count_wider)
|
||||
end,
|
||||
|
@ -263,19 +217,21 @@ minetest.register_abm({
|
|||
})
|
||||
|
||||
--
|
||||
-- Leafdecay
|
||||
-- dig upwards
|
||||
--
|
||||
|
||||
-- To enable leaf decay for a node, add it to the "leafdecay" group.
|
||||
function default.dig_up(pos, node, digger)
|
||||
if digger == nil then return end
|
||||
local np = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
local nn = minetest.get_node(np)
|
||||
if nn.name == node.name then
|
||||
minetest.node_dig(np, nn, digger)
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- The rating of the group determines how far from a node in the group "tree"
|
||||
-- the node can be without decaying.
|
||||
-- Leafdecay
|
||||
--
|
||||
-- If param2 of the node is ~= 0, the node will always be preserved. Thus, if
|
||||
-- the player places a node of that kind, you will want to set param2=1 or so.
|
||||
--
|
||||
-- If the node is in the leafdecay_drop group then the it will always be dropped
|
||||
-- as an item
|
||||
|
||||
default.leafdecay_trunk_cache = {}
|
||||
default.leafdecay_enable_cache = true
|
||||
|
@ -288,6 +244,12 @@ minetest.register_globalstep(function(dtime)
|
|||
math.floor(dtime * finds_per_second)
|
||||
end)
|
||||
|
||||
default.after_place_leaves = function(pos, placer, itemstack, pointed_thing)
|
||||
local node = minetest.get_node(pos)
|
||||
node.param2 = 1
|
||||
minetest.set_node(pos, node)
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"group:leafdecay"},
|
||||
neighbors = {"air", "group:liquid"},
|
||||
|
|
|
@ -133,7 +133,7 @@ minetest.register_node("default:furnace_active", {
|
|||
|
||||
can_dig = can_dig,
|
||||
|
||||
aallow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||
})
|
||||
|
|
|
@ -12,8 +12,8 @@ LIGHT_MAX = 14
|
|||
default = {}
|
||||
|
||||
-- GUI related stuff
|
||||
default.gui_bg = "bgcolor[#08080899;false]"
|
||||
default.gui_bg_img = "background[5,5;1,1;ui_form_bg.png;true]"
|
||||
default.gui_bg = "bgcolor[#080808BB;true]"
|
||||
default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]"
|
||||
default.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]"
|
||||
|
||||
function default.get_hotbar_bg(x,y)
|
||||
|
@ -45,14 +45,4 @@ dofile(minetest.get_modpath("default").."/crafting.lua")
|
|||
dofile(minetest.get_modpath("default").."/mapgen.lua")
|
||||
dofile(minetest.get_modpath("default").."/player.lua")
|
||||
dofile(minetest.get_modpath("default").."/trees.lua")
|
||||
dofile(minetest.get_modpath("default").."/commands.lua")
|
||||
|
||||
hotbar_size = minetest.setting_get("hotbar_size") or 16
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
player:hud_set_hotbar_itemcount(hotbar_size)
|
||||
minetest.after(0.5,function()
|
||||
-- player:hud_set_hotbar_image("dreambuilder_hotbar.png")
|
||||
player:hud_set_hotbar_selected_image("dreambuilder_hotbar_selected.png")
|
||||
end)
|
||||
end)
|
||||
dofile(minetest.get_modpath("default").."/aliases.lua")
|
||||
|
|
|
@ -31,266 +31,182 @@ minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble")
|
|||
-- Ore generation
|
||||
--
|
||||
|
||||
local coal_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 42, octaves = 3, persist = 0.7}
|
||||
local coal_threshhold = 0.2
|
||||
|
||||
local iron_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 43, octaves = 3, persist = 0.7}
|
||||
local iron_threshhold = 0.4
|
||||
|
||||
local mese_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 44, octaves = 3, persist = 0.7}
|
||||
local mese_threshhold = 0.7
|
||||
local mese_block_threshhold = 1.0
|
||||
|
||||
local gold_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 45, octaves = 3, persist = 0.7}
|
||||
local gold_threshhold = 0.6
|
||||
|
||||
local diamond_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 46, octaves = 3, persist = 0.7}
|
||||
local diamond_threshhold = 0.8
|
||||
|
||||
local copper_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 47, octaves = 3, persist = 0.7}
|
||||
local copper_threshhold = 0.5
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_coal",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 6*6*6,
|
||||
clust_num_ores = 8,
|
||||
clust_size = 3,
|
||||
height_min = -31000,
|
||||
height_max = 64,
|
||||
noise_params = coal_params,
|
||||
noise_threshhold = coal_threshhold,
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_coal",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 8*8*8,
|
||||
clust_num_ores = 8,
|
||||
clust_size = 3,
|
||||
height_min = -31000,
|
||||
height_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_iron",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 8*8*8,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
height_min = -15,
|
||||
height_max = 2,
|
||||
noise_params = iron_params,
|
||||
noise_threshhold = iron_threshhold,
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_coal",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 24*24*24,
|
||||
clust_num_ores = 27,
|
||||
clust_size = 6,
|
||||
height_min = -31000,
|
||||
height_max = 0,
|
||||
flags = "absheight",
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_iron",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 7*7*7,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
height_min = -63,
|
||||
height_max = -16,
|
||||
noise_params = iron_params,
|
||||
noise_threshhold = iron_threshhold,
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_iron",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 12*12*12,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
height_min = -15,
|
||||
height_max = 2,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_iron",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 6*6*6,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
height_min = -31000,
|
||||
height_max = -64,
|
||||
flags = "absheight",
|
||||
noise_params = iron_params,
|
||||
noise_threshhold = iron_threshhold,
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_iron",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 9*9*9,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
height_min = -63,
|
||||
height_max = -16,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_mese",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 9*9*9,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
height_min = -255,
|
||||
height_max = -64,
|
||||
flags = "absheight",
|
||||
noise_params = mese_params,
|
||||
noise_threshhold = mese_threshhold,
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_iron",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 7*7*7,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
height_min = -31000,
|
||||
height_max = -64,
|
||||
flags = "absheight",
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_mese",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 7*7*7,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
height_min = -31000,
|
||||
height_max = -256,
|
||||
flags = "absheight",
|
||||
noise_params = mese_params,
|
||||
noise_threshhold = mese_threshhold,
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_iron",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 24*24*24,
|
||||
clust_num_ores = 27,
|
||||
clust_size = 6,
|
||||
height_min = -31000,
|
||||
height_max = -64,
|
||||
flags = "absheight",
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:mese",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 9*9*9,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
height_min = -31000,
|
||||
height_max = -1024,
|
||||
flags = "absheight",
|
||||
noise_params = mese_params,
|
||||
noise_threshhold = mese_block_threshhold,
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_mese",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 18*18*18,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
height_min = -255,
|
||||
height_max = -64,
|
||||
flags = "absheight",
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_gold",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 9*9*9,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
height_min = -255,
|
||||
height_max = -64,
|
||||
flags = "absheight",
|
||||
noise_params = gold_params,
|
||||
noise_threshhold = gold_threshhold,
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_mese",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 14*14*14,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
height_min = -31000,
|
||||
height_max = -256,
|
||||
flags = "absheight",
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_gold",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 7*7*7,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
height_min = -31000,
|
||||
height_max = -256,
|
||||
flags = "absheight",
|
||||
noise_params = gold_params,
|
||||
noise_threshhold = gold_threshhold,
|
||||
ore_type = "scatter",
|
||||
ore = "default:mese",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 36*36*36,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
height_min = -31000,
|
||||
height_max = -1024,
|
||||
flags = "absheight",
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_diamond",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 10*10*10,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 3,
|
||||
height_min = -255,
|
||||
height_max = -128,
|
||||
flags = "absheight",
|
||||
noise_params = diamond_params,
|
||||
noise_threshhold = diamond_threshhold,
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_gold",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 15*15*15,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
height_min = -255,
|
||||
height_max = -64,
|
||||
flags = "absheight",
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_gold",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 13*13*13,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
height_min = -31000,
|
||||
height_max = -256,
|
||||
flags = "absheight",
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_diamond",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 8*8*8,
|
||||
clust_scarcity = 17*17*17,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 3,
|
||||
height_min = -255,
|
||||
height_max = -128,
|
||||
flags = "absheight",
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_diamond",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 15*15*15,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 3,
|
||||
height_min = -31000,
|
||||
height_max = -256,
|
||||
flags = "absheight",
|
||||
noise_params = diamond_params,
|
||||
noise_threshhold = diamond_threshhold,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_copper",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 8*8*8,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 3,
|
||||
height_min = -63,
|
||||
height_max = -16,
|
||||
noise_params = copper_params,
|
||||
noise_threshhold = copper_threshhold,
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_copper",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 12*12*12,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 3,
|
||||
height_min = -63,
|
||||
height_max = -16,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_copper",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 6*6*6,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
height_min = -31000,
|
||||
height_max = -64,
|
||||
flags = "absheight",
|
||||
noise_params = copper_params,
|
||||
noise_threshhold = copper_threshhold,
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_copper",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 9*9*9,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
height_min = -31000,
|
||||
height_max = -64,
|
||||
flags = "absheight",
|
||||
})
|
||||
|
||||
if minetest.setting_get("mg_name") == "indev" then
|
||||
-- Floatlands and high mountains springs
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:water_source",
|
||||
ore_param2 = 128,
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 40*40*40,
|
||||
clust_num_ores = 8,
|
||||
clust_size = 3,
|
||||
height_min = 100,
|
||||
height_max = 31000,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:lava_source",
|
||||
ore_param2 = 128,
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 50*50*50,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 2,
|
||||
height_min = 10000,
|
||||
height_max = 31000,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:sand",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 20*20*20,
|
||||
clust_num_ores = 5*5*3,
|
||||
clust_size = 5,
|
||||
height_min = 500,
|
||||
height_max = 31000,
|
||||
})
|
||||
|
||||
-- Underground springs
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:water_source",
|
||||
ore_param2 = 128,
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 25*25*25,
|
||||
clust_num_ores = 8,
|
||||
clust_size = 3,
|
||||
height_min = -10000,
|
||||
height_max = -10,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:lava_source",
|
||||
ore_param2 = 128,
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 35*35*35,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 2,
|
||||
height_min = -31000,
|
||||
height_max = -100,
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:clay",
|
||||
|
@ -344,81 +260,38 @@ function default.generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume
|
|||
--print("generate_ore done")
|
||||
end
|
||||
|
||||
function default.make_papyrus(pos, size)
|
||||
for y=0,size-1 do
|
||||
local p = {x=pos.x, y=pos.y+y, z=pos.z}
|
||||
local nn = minetest.get_node(p).name
|
||||
if minetest.registered_nodes[nn] and
|
||||
minetest.registered_nodes[nn].buildable_to then
|
||||
minetest.set_node(p, {name="default:papyrus"})
|
||||
else
|
||||
return
|
||||
--
|
||||
-- Mgv6 papyrus, cactus, long grasses
|
||||
--
|
||||
|
||||
function default.mgv6_ongen(minp, maxp, seed)
|
||||
|
||||
function default.make_papyrus(pos, size)
|
||||
for y=0,size-1 do
|
||||
local p = {x=pos.x, y=pos.y+y, z=pos.z}
|
||||
local nn = minetest.get_node(p).name
|
||||
if minetest.registered_nodes[nn] and
|
||||
minetest.registered_nodes[nn].buildable_to then
|
||||
minetest.set_node(p, {name="default:papyrus"})
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function default.make_cactus(pos, size)
|
||||
for y=0,size-1 do
|
||||
local p = {x=pos.x, y=pos.y+y, z=pos.z}
|
||||
local nn = minetest.get_node(p).name
|
||||
if minetest.registered_nodes[nn] and
|
||||
minetest.registered_nodes[nn].buildable_to then
|
||||
minetest.set_node(p, {name="default:cactus"})
|
||||
else
|
||||
return
|
||||
function default.make_cactus(pos, size)
|
||||
for y=0,size-1 do
|
||||
local p = {x=pos.x, y=pos.y+y, z=pos.z}
|
||||
local nn = minetest.get_node(p).name
|
||||
if minetest.registered_nodes[nn] and
|
||||
minetest.registered_nodes[nn].buildable_to then
|
||||
minetest.set_node(p, {name="default:cactus"})
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- facedir: 0/1/2/3 (head node facedir value)
|
||||
-- length: length of rainbow tail
|
||||
function default.make_nyancat(pos, facedir, length)
|
||||
local tailvec = {x=0, y=0, z=0}
|
||||
if facedir == 0 then
|
||||
tailvec.z = 1
|
||||
elseif facedir == 1 then
|
||||
tailvec.x = 1
|
||||
elseif facedir == 2 then
|
||||
tailvec.z = -1
|
||||
elseif facedir == 3 then
|
||||
tailvec.x = -1
|
||||
else
|
||||
--print("default.make_nyancat(): Invalid facedir: "+dump(facedir))
|
||||
facedir = 0
|
||||
tailvec.z = 1
|
||||
end
|
||||
local p = {x=pos.x, y=pos.y, z=pos.z}
|
||||
minetest.set_node(p, {name="default:nyancat", param2=facedir})
|
||||
for i=1,length do
|
||||
p.x = p.x + tailvec.x
|
||||
p.z = p.z + tailvec.z
|
||||
minetest.set_node(p, {name="default:nyancat_rainbow", param2=facedir})
|
||||
end
|
||||
end
|
||||
|
||||
function generate_nyancats(seed, minp, maxp)
|
||||
local height_min = -31000
|
||||
local height_max = -32
|
||||
if maxp.y < height_min or minp.y > height_max then
|
||||
return
|
||||
end
|
||||
local y_min = math.max(minp.y, height_min)
|
||||
local y_max = math.min(maxp.y, height_max)
|
||||
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
|
||||
local pr = PseudoRandom(seed + 9324342)
|
||||
local max_num_nyancats = math.floor(volume / (16*16*16))
|
||||
for i=1,max_num_nyancats do
|
||||
if pr:next(0, 1000) == 0 then
|
||||
local x0 = pr:next(minp.x, maxp.x)
|
||||
local y0 = pr:next(minp.y, maxp.y)
|
||||
local z0 = pr:next(minp.z, maxp.z)
|
||||
local p0 = {x=x0, y=y0, z=z0}
|
||||
default.make_nyancat(p0, pr:next(0,3), pr:next(3,15))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
if maxp.y >= 2 and minp.y <= 0 then
|
||||
-- Generate papyrus
|
||||
local perlin1 = minetest.get_perlin(354, 3, 0.7, 100)
|
||||
|
@ -504,7 +377,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
break
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if ground_y then
|
||||
local p = {x=x,y=ground_y+1,z=z}
|
||||
local nn = minetest.get_node(p).name
|
||||
|
@ -515,20 +388,80 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
-- If desert sand, add dry shrub
|
||||
if nn == "default:desert_sand" then
|
||||
minetest.set_node(p,{name="default:dry_shrub"})
|
||||
|
||||
|
||||
-- If dirt with grass, add grass
|
||||
elseif nn == "default:dirt_with_grass" then
|
||||
minetest.set_node(p,{name="default:grass_"..pr:next(1, 5)})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Generate nyan cats
|
||||
generate_nyancats(seed, minp, maxp)
|
||||
--
|
||||
-- Detect mapgen and register suitable on-generated function
|
||||
--
|
||||
|
||||
minetest.register_on_mapgen_init(function(mg_params)
|
||||
if mg_params.mgname == "v6" then
|
||||
minetest.register_on_generated(default.mgv6_ongen)
|
||||
end
|
||||
end)
|
||||
|
||||
--
|
||||
-- Generate nyan cats in all mapgens
|
||||
--
|
||||
|
||||
-- facedir: 0/1/2/3 (head node facedir value)
|
||||
-- length: length of rainbow tail
|
||||
function default.make_nyancat(pos, facedir, length)
|
||||
local tailvec = {x=0, y=0, z=0}
|
||||
if facedir == 0 then
|
||||
tailvec.z = 1
|
||||
elseif facedir == 1 then
|
||||
tailvec.x = 1
|
||||
elseif facedir == 2 then
|
||||
tailvec.z = -1
|
||||
elseif facedir == 3 then
|
||||
tailvec.x = -1
|
||||
else
|
||||
--print("default.make_nyancat(): Invalid facedir: "+dump(facedir))
|
||||
facedir = 0
|
||||
tailvec.z = 1
|
||||
end
|
||||
local p = {x=pos.x, y=pos.y, z=pos.z}
|
||||
minetest.set_node(p, {name="default:nyancat", param2=facedir})
|
||||
for i=1,length do
|
||||
p.x = p.x + tailvec.x
|
||||
p.z = p.z + tailvec.z
|
||||
minetest.set_node(p, {name="default:nyancat_rainbow", param2=facedir})
|
||||
end
|
||||
end
|
||||
|
||||
function default.generate_nyancats(minp, maxp, seed)
|
||||
local height_min = -31000
|
||||
local height_max = -32
|
||||
if maxp.y < height_min or minp.y > height_max then
|
||||
return
|
||||
end
|
||||
local y_min = math.max(minp.y, height_min)
|
||||
local y_max = math.min(maxp.y, height_max)
|
||||
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
|
||||
local pr = PseudoRandom(seed + 9324342)
|
||||
local max_num_nyancats = math.floor(volume / (16*16*16))
|
||||
for i=1,max_num_nyancats do
|
||||
if pr:next(0, 1000) == 0 then
|
||||
local x0 = pr:next(minp.x, maxp.x)
|
||||
local y0 = pr:next(minp.y, maxp.y)
|
||||
local z0 = pr:next(minp.z, maxp.z)
|
||||
local p0 = {x=x0, y=y0, z=z0}
|
||||
default.make_nyancat(p0, pr:next(0,3), pr:next(3,15))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_on_generated(default.generate_nyancats)
|
||||
|
|
|
@ -64,7 +64,7 @@ minetest.register_node("default:stone_with_gold", {
|
|||
drop = "default:gold_lump",
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("default:stone_with_diamond", {
|
||||
description = "Diamond Ore",
|
||||
tiles = {"default_stone.png^default_mineral_diamond.png"},
|
||||
|
@ -114,7 +114,7 @@ minetest.register_node("default:dirt_with_snow", {
|
|||
description = "Dirt with Snow",
|
||||
tiles = {"default_snow.png", "default_dirt.png", "default_dirt.png^default_snow_side.png"},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3},
|
||||
groups = {crumbly=3,soil=1},
|
||||
drop = 'default:dirt',
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_snow_footstep", gain=0.25},
|
||||
|
@ -255,10 +255,10 @@ minetest.register_node("default:junglewood", {
|
|||
minetest.register_node("default:jungleleaves", {
|
||||
description = "Jungle Leaves",
|
||||
drawtype = "allfaces_optional",
|
||||
waving = 1,
|
||||
visual_scale = 1.3,
|
||||
tiles = {"default_jungleleaves.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
is_ground_content = false,
|
||||
groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
|
||||
drop = {
|
||||
|
@ -277,6 +277,7 @@ minetest.register_node("default:jungleleaves", {
|
|||
}
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
after_place_node = default.after_place_leaves,
|
||||
})
|
||||
|
||||
minetest.register_node("default:junglesapling", {
|
||||
|
@ -299,6 +300,7 @@ minetest.register_node("default:junglesapling", {
|
|||
minetest.register_node("default:junglegrass", {
|
||||
description = "Jungle Grass",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
visual_scale = 1.3,
|
||||
tiles = {"default_junglegrass.png"},
|
||||
inventory_image = "default_junglegrass.png",
|
||||
|
@ -318,10 +320,10 @@ minetest.register_node("default:junglegrass", {
|
|||
minetest.register_node("default:leaves", {
|
||||
description = "Leaves",
|
||||
drawtype = "allfaces_optional",
|
||||
waving = 1,
|
||||
visual_scale = 1.3,
|
||||
tiles = {"default_leaves.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
is_ground_content = false,
|
||||
groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
|
||||
drop = {
|
||||
|
@ -340,6 +342,7 @@ minetest.register_node("default:leaves", {
|
|||
}
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
after_place_node = default.after_place_leaves,
|
||||
})
|
||||
|
||||
minetest.register_node("default:cactus", {
|
||||
|
@ -349,7 +352,10 @@ minetest.register_node("default:cactus", {
|
|||
is_ground_content = true,
|
||||
groups = {snappy=1,choppy=3,flammable=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_place = minetest.rotate_node
|
||||
on_place = minetest.rotate_node,
|
||||
after_dig_node = function(pos, node, metadata, digger)
|
||||
default.dig_up(pos, node, digger)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("default:papyrus", {
|
||||
|
@ -367,20 +373,85 @@ minetest.register_node("default:papyrus", {
|
|||
},
|
||||
groups = {snappy=3,flammable=2},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
after_dig_node = function(pos, node, metadata, digger)
|
||||
default.dig_up(pos, node, digger)
|
||||
end,
|
||||
})
|
||||
|
||||
default.bookshelf_formspec =
|
||||
"size[8,7;]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"list[context;books;0,0.3;8,2;]"..
|
||||
"list[current_player;main;0,2.85;8,1;]"..
|
||||
"list[current_player;main;0,4.08;8,3;8]"..
|
||||
default.get_hotbar_bg(0,2.85)
|
||||
|
||||
minetest.register_node("default:bookshelf", {
|
||||
description = "Bookshelf",
|
||||
tiles = {"default_wood.png", "default_wood.png", "default_bookshelf.png"},
|
||||
is_ground_content = false,
|
||||
groups = {choppy=3,oddly_breakable_by_hand=2,flammable=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", default.bookshelf_formspec)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("books", 8*2)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("books")
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local to_stack = inv:get_stack(listname, index)
|
||||
if listname == "books" then
|
||||
if minetest.get_item_group(stack:get_name(), "book") ~= 0
|
||||
and to_stack:is_empty() then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack = inv:get_stack(from_list, from_index)
|
||||
local to_stack = inv:get_stack(to_list, to_index)
|
||||
if to_list == "books" then
|
||||
if stack:get_name() == "default:book" and to_stack:is_empty() then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
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 bookshelf 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 bookshelf 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 bookshelf at "..minetest.pos_to_string(pos))
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("default:glass", {
|
||||
description = "Glass",
|
||||
drawtype = "glasslike",
|
||||
tiles = {"default_glass.png"},
|
||||
drawtype = "glasslike_framed_optional",
|
||||
tiles = {"default_glass.png", "default_glass_detail.png"},
|
||||
inventory_image = minetest.inventorycube("default_glass.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
|
@ -389,12 +460,13 @@ minetest.register_node("default:glass", {
|
|||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
local fence_texture = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126"
|
||||
minetest.register_node("default:fence_wood", {
|
||||
description = "Wooden Fence",
|
||||
drawtype = "fencelike",
|
||||
tiles = {"default_wood.png"},
|
||||
inventory_image = "default_fence.png",
|
||||
wield_image = "default_fence.png",
|
||||
inventory_image = fence_texture,
|
||||
wield_image = fence_texture,
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
selection_box = {
|
||||
|
@ -488,9 +560,8 @@ minetest.register_node("default:water_flowing", {
|
|||
liquid_alternative_flowing = "default:water_flowing",
|
||||
liquid_alternative_source = "default:water_source",
|
||||
liquid_viscosity = WATER_VISC,
|
||||
freezemelt = "default:snow",
|
||||
post_effect_color = {a=64, r=100, g=100, b=200},
|
||||
groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1, freezes=1, melt_around=1},
|
||||
groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
minetest.register_node("default:water_source", {
|
||||
|
@ -520,9 +591,8 @@ minetest.register_node("default:water_source", {
|
|||
liquid_alternative_flowing = "default:water_flowing",
|
||||
liquid_alternative_source = "default:water_source",
|
||||
liquid_viscosity = WATER_VISC,
|
||||
freezemelt = "default:ice",
|
||||
post_effect_color = {a=64, r=100, g=100, b=200},
|
||||
groups = {water=3, liquid=3, puts_out_fire=1, freezes=1},
|
||||
groups = {water=3, liquid=3, puts_out_fire=1},
|
||||
})
|
||||
|
||||
minetest.register_node("default:lava_flowing", {
|
||||
|
@ -617,15 +687,15 @@ minetest.register_node("default:torch", {
|
|||
wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1},
|
||||
wall_side = {-0.5, -0.3, -0.1, -0.5+0.3, 0.3, 0.1},
|
||||
},
|
||||
groups = {choppy=2,dig_immediate=3,flammable=1,attached_node=1,hot=2},
|
||||
groups = {choppy=2,dig_immediate=3,flammable=1,attached_node=1},
|
||||
legacy_wallmounted = true,
|
||||
sounds = default.node_sound_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("default:sign_wall", {
|
||||
description = "Sign",
|
||||
drawtype = "signlike",
|
||||
tiles = {"default_sign_wall.png"},
|
||||
drawtype = "nodebox",
|
||||
tiles = {"default_sign.png"},
|
||||
inventory_image = "default_sign_wall.png",
|
||||
wield_image = "default_sign_wall.png",
|
||||
paramtype = "light",
|
||||
|
@ -633,11 +703,11 @@ minetest.register_node("default:sign_wall", {
|
|||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
node_box = {
|
||||
type = "wallmounted",
|
||||
--wall_top = <default>
|
||||
--wall_bottom = <default>
|
||||
--wall_side = <default>
|
||||
wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125},
|
||||
wall_bottom = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125},
|
||||
wall_side = {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375},
|
||||
},
|
||||
groups = {choppy=2,dig_immediate=2,attached_node=1},
|
||||
legacy_wallmounted = true,
|
||||
|
@ -655,7 +725,7 @@ minetest.register_node("default:sign_wall", {
|
|||
return
|
||||
end
|
||||
local meta = minetest.get_meta(pos)
|
||||
fields.text = fields.text or ""
|
||||
if not fields.text then return end
|
||||
minetest.log("action", (sender:get_player_name() or "").." wrote \""..fields.text..
|
||||
"\" to sign at "..minetest.pos_to_string(pos))
|
||||
meta:set_string("text", fields.text)
|
||||
|
@ -663,20 +733,28 @@ minetest.register_node("default:sign_wall", {
|
|||
end,
|
||||
})
|
||||
|
||||
default.chest_formspec =
|
||||
default.chest_formspec =
|
||||
"size[8,9]"..
|
||||
"list[current_name;main;0,0;8,4;]"..
|
||||
"list[current_player;main;0,5;8,4;]"..
|
||||
"background[-0.5,-0.65;9,10.35;bg_chest.jpg]"
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"list[current_name;main;0,0.3;8,4;]"..
|
||||
"list[current_player;main;0,4.85;8,1;]"..
|
||||
"list[current_player;main;0,6.08;8,3;8]"..
|
||||
default.get_hotbar_bg(0,4.85)
|
||||
|
||||
function default.get_locked_chest_formspec(pos)
|
||||
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
|
||||
local formspec =
|
||||
"size[8,9]"..
|
||||
"list[nodemeta:".. spos .. ";main;0,0;8,4;]"..
|
||||
"list[current_player;main;0,5;8,4;]"..
|
||||
"background[-0.5,-0.65;9,10.35;bg_chest.jpg]"
|
||||
return formspec
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"list[nodemeta:".. spos .. ";main;0,0.3;8,4;]"..
|
||||
"list[current_player;main;0,4.85;8,1;]"..
|
||||
"list[current_player;main;0,6.08;8,3;8]"..
|
||||
default.get_hotbar_bg(0,4.85)
|
||||
return formspec
|
||||
end
|
||||
|
||||
|
||||
|
@ -752,10 +830,6 @@ minetest.register_node("default:chest_locked", {
|
|||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if not has_locked_chest_privilege(meta, player) then
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" tried to access a locked chest belonging to "..
|
||||
meta:get_string("owner").." at "..
|
||||
minetest.pos_to_string(pos))
|
||||
return 0
|
||||
end
|
||||
return count
|
||||
|
@ -763,10 +837,6 @@ minetest.register_node("default:chest_locked", {
|
|||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if not has_locked_chest_privilege(meta, player) then
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" tried to access a locked chest belonging to "..
|
||||
meta:get_string("owner").." at "..
|
||||
minetest.pos_to_string(pos))
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
|
@ -774,18 +844,10 @@ minetest.register_node("default:chest_locked", {
|
|||
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if not has_locked_chest_privilege(meta, player) then
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" tried to access a locked chest belonging to "..
|
||||
meta:get_string("owner").." at "..
|
||||
minetest.pos_to_string(pos))
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
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 locked chest 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 locked chest at "..minetest.pos_to_string(pos))
|
||||
|
@ -906,6 +968,13 @@ minetest.register_node("default:obsidian", {
|
|||
groups = {cracky=1,level=2},
|
||||
})
|
||||
|
||||
minetest.register_node("default:obsidianbrick", {
|
||||
description = "Obsidian Brick",
|
||||
tiles = {"default_obsidian_brick.png"},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
groups = {cracky=1,level=2},
|
||||
})
|
||||
|
||||
minetest.register_node("default:nyancat", {
|
||||
description = "Nyan Cat",
|
||||
tiles = {"default_nc_side.png", "default_nc_side.png", "default_nc_side.png",
|
||||
|
@ -947,9 +1016,9 @@ minetest.register_node("default:sapling", {
|
|||
|
||||
minetest.register_node("default:apple", {
|
||||
description = "Apple",
|
||||
drawtype = "mesh",
|
||||
mesh = "default_apple_3d.obj",
|
||||
tiles = {"default_apple_3d.png"},
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 1.0,
|
||||
tiles = {"default_apple.png"},
|
||||
inventory_image = "default_apple.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
|
@ -972,12 +1041,12 @@ minetest.register_node("default:apple", {
|
|||
minetest.register_node("default:dry_shrub", {
|
||||
description = "Dry Shrub",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
visual_scale = 1.0,
|
||||
tiles = {"default_dry_shrub.png"},
|
||||
inventory_image = "default_dry_shrub.png",
|
||||
wield_image = "default_dry_shrub.png",
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
is_ground_content = true,
|
||||
buildable_to = true,
|
||||
|
@ -992,6 +1061,7 @@ minetest.register_node("default:dry_shrub", {
|
|||
minetest.register_node("default:grass_1", {
|
||||
description = "Grass",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
tiles = {"default_grass_1.png"},
|
||||
-- use a bigger inventory image
|
||||
inventory_image = "default_grass_3.png",
|
||||
|
@ -1014,88 +1084,34 @@ minetest.register_node("default:grass_1", {
|
|||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("default:grass_2", {
|
||||
description = "Grass",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"default_grass_2.png"},
|
||||
inventory_image = "default_grass_2.png",
|
||||
wield_image = "default_grass_2.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
drop = "default:grass_1",
|
||||
groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
},
|
||||
})
|
||||
minetest.register_node("default:grass_3", {
|
||||
description = "Grass",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"default_grass_3.png"},
|
||||
inventory_image = "default_grass_3.png",
|
||||
wield_image = "default_grass_3.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
drop = "default:grass_1",
|
||||
groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("default:grass_4", {
|
||||
description = "Grass",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"default_grass_4.png"},
|
||||
inventory_image = "default_grass_4.png",
|
||||
wield_image = "default_grass_4.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
drop = "default:grass_1",
|
||||
groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("default:grass_5", {
|
||||
description = "Grass",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"default_grass_5.png"},
|
||||
inventory_image = "default_grass_5.png",
|
||||
wield_image = "default_grass_5.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
drop = "default:grass_1",
|
||||
groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
},
|
||||
})
|
||||
for i=2,5 do
|
||||
minetest.register_node("default:grass_"..i, {
|
||||
description = "Grass",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
tiles = {"default_grass_"..i..".png"},
|
||||
inventory_image = "default_grass_"..i..".png",
|
||||
wield_image = "default_grass_"..i..".png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
drop = "default:grass_1",
|
||||
groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_node("default:ice", {
|
||||
description = "Ice",
|
||||
tiles = {"default_ice.png"},
|
||||
is_ground_content = true,
|
||||
paramtype = "light",
|
||||
freezemelt = "default:water_source",
|
||||
groups = {cracky=3, melts=1},
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
|
@ -1107,16 +1123,14 @@ minetest.register_node("default:snow", {
|
|||
is_ground_content = true,
|
||||
paramtype = "light",
|
||||
buildable_to = true,
|
||||
leveled = 7,
|
||||
drawtype = "nodebox",
|
||||
freezemelt = "default:water_flowing",
|
||||
node_box = {
|
||||
type = "leveled",
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.5+2/16, 0.5},
|
||||
},
|
||||
},
|
||||
groups = {crumbly=3,falling_node=1, melts=1, float=1},
|
||||
groups = {crumbly=3,falling_node=1},
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_snow_footstep", gain=0.25},
|
||||
dug = {name="default_snow_footstep", gain=0.75},
|
||||
|
@ -1134,10 +1148,73 @@ minetest.register_node("default:snowblock", {
|
|||
description = "Snow Block",
|
||||
tiles = {"default_snow.png"},
|
||||
is_ground_content = true,
|
||||
freezemelt = "default:water_source",
|
||||
groups = {crumbly=3, melts=1},
|
||||
groups = {crumbly=3},
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_snow_footstep", gain=0.25},
|
||||
dug = {name="default_snow_footstep", gain=0.75},
|
||||
}),
|
||||
})
|
||||
|
||||
minetest.register_node("default:pine_needles",{
|
||||
description = "Pine Needles",
|
||||
drawtype = "allfaces_optional",
|
||||
visual_scale = 1.3,
|
||||
tiles = {"default_pine_needles.png"},
|
||||
waving = 1,
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{
|
||||
-- player will get sapling with 1/20 chance
|
||||
items = {"default:pine_sapling"},
|
||||
rarity = 20,
|
||||
},
|
||||
{
|
||||
-- player will get leaves only if he get no saplings,
|
||||
-- this is because max_items is 1
|
||||
items = {"default:pine_needles"},
|
||||
}
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
after_place_node = default.after_place_leaves,
|
||||
})
|
||||
|
||||
minetest.register_node("default:pine_sapling", {
|
||||
description = "Pine Sapling",
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 1.0,
|
||||
tiles = {"default_pine_sapling.png"},
|
||||
inventory_image = "default_pine_sapling.png",
|
||||
wield_image = "default_pine_sapling.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
is_ground_content = true,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||
},
|
||||
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("default:pinetree", {
|
||||
description = "Pine Tree",
|
||||
tiles = {"default_pinetree_top.png", "default_pinetree_top.png", "default_pinetree.png"},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_place = minetest.rotate_node
|
||||
})
|
||||
|
||||
minetest.register_node("default:pinewood", {
|
||||
description = "Pinewood Planks",
|
||||
tiles = {"default_pinewood.png"},
|
||||
groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
|
|
|
@ -1,55 +1,6 @@
|
|||
-- Minetest 0.4 mod: player
|
||||
-- See README.txt for licensing and other information.
|
||||
|
||||
--[[
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
default.player_register_model(name, def)
|
||||
^ Register a new model to be used by players.
|
||||
^ <name> is the model filename such as "character.x", "foo.b3d", etc.
|
||||
^ See Model Definition below for format of <def>.
|
||||
|
||||
default.registered_player_models[name]
|
||||
^ See Model Definition below for format.
|
||||
|
||||
default.player_set_model(player, model_name)
|
||||
^ <player> is a PlayerRef.
|
||||
^ <model_name> is a model registered with player_register_model.
|
||||
|
||||
default.player_set_animation(player, anim_name [, speed])
|
||||
^ <player> is a PlayerRef.
|
||||
^ <anim_name> is the name of the animation.
|
||||
^ <speed> is in frames per second. If nil, default from the model is used
|
||||
|
||||
default.player_set_textures(player, textures)
|
||||
^ <player> is a PlayerRef.
|
||||
^ <textures> is an array of textures
|
||||
^ If <textures> is nil, the default textures from the model def are used
|
||||
|
||||
default.player_get_animation(player)
|
||||
^ <player> is a PlayerRef.
|
||||
^ Returns a table containing fields "model", "textures" and "animation".
|
||||
^ Any of the fields of the returned table may be nil.
|
||||
|
||||
Model Definition
|
||||
----------------
|
||||
|
||||
model_def = {
|
||||
animation_speed = 30, -- Default animation speed, in FPS.
|
||||
textures = {"character.png", }, -- Default array of textures.
|
||||
visual_size = {x=1, y=1,}, -- Used to scale the model.
|
||||
animations = {
|
||||
-- <anim_name> = { x=<start_frame>, y=<end_frame>, },
|
||||
foo = { x= 0, y=19, },
|
||||
bar = { x=20, y=39, },
|
||||
-- ...
|
||||
},
|
||||
}
|
||||
|
||||
]]
|
||||
|
||||
-- Player animation blending
|
||||
-- Note: This is currently broken due to a bug in Irrlicht, leave at 0
|
||||
local animation_blend = 0
|
||||
|
@ -84,6 +35,7 @@ local player_model = {}
|
|||
local player_textures = {}
|
||||
local player_anim = {}
|
||||
local player_sneak = {}
|
||||
default.player_attached = {}
|
||||
|
||||
function default.player_get_animation(player)
|
||||
local name = player:get_player_name()
|
||||
|
@ -140,8 +92,16 @@ end
|
|||
|
||||
-- Update appearance when the player joins
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
default.player_attached[player:get_player_name()] = false
|
||||
default.player_set_model(player, "character.x")
|
||||
player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
|
||||
|
||||
-- set GUI
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
player:set_inventory_formspec(default.gui_suvival_form)
|
||||
end
|
||||
player:hud_set_hotbar_image("gui_hotbar.png")
|
||||
player:hud_set_hotbar_selected_image("gui_hotbar_selected.png")
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
|
@ -153,6 +113,7 @@ end)
|
|||
|
||||
-- Localize for better performance.
|
||||
local player_set_animation = default.player_set_animation
|
||||
local player_attached = default.player_attached
|
||||
|
||||
-- Check each player and apply animations
|
||||
minetest.register_globalstep(function(dtime)
|
||||
|
@ -160,7 +121,7 @@ minetest.register_globalstep(function(dtime)
|
|||
local name = player:get_player_name()
|
||||
local model_name = player_model[name]
|
||||
local model = model_name and models[model_name]
|
||||
if model then
|
||||
if model and not player_attached[name] then
|
||||
local controls = player:get_player_control()
|
||||
local walking = false
|
||||
local animation_speed_mod = model.animation_speed or 30
|
||||
|
|
After Width: | Height: | Size: 240 B |
After Width: | Height: | Size: 183 B |
After Width: | Height: | Size: 418 B |
After Width: | Height: | Size: 512 B |
After Width: | Height: | Size: 406 B |
After Width: | Height: | Size: 693 B |
After Width: | Height: | Size: 802 B |
After Width: | Height: | Size: 455 B |
After Width: | Height: | Size: 699 B |
After Width: | Height: | Size: 111 B |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 306 B |
After Width: | Height: | Size: 1.8 KiB |
|
@ -1,72 +1,344 @@
|
|||
local c_air = minetest.get_content_id("air")
|
||||
local c_ignore = minetest.get_content_id("ignore")
|
||||
local c_tree = minetest.get_content_id("default:tree")
|
||||
local c_leaves = minetest.get_content_id("default:leaves")
|
||||
--
|
||||
-- Grow trees
|
||||
--
|
||||
|
||||
function default.grow_tree(data, a, pos, is_apple_tree, seed)
|
||||
--[[
|
||||
NOTE: Tree-placing code is currently duplicated in the engine
|
||||
and in games that have saplings; both are deprecated but not
|
||||
replaced yet
|
||||
]]--
|
||||
local hight = math.random(4, 5)
|
||||
for x_area = -2, 2 do
|
||||
for y_area = -1, 2 do
|
||||
for z_area = -2, 2 do
|
||||
if math.random(1,30) < 23 then --randomize leaves
|
||||
local area_l = a:index(pos.x+x_area, pos.y+hight+y_area-1, pos.z+z_area) --sets area for leaves
|
||||
if data[area_l] == c_air or data[area_l] == c_ignore then --sets if it's air or ignore
|
||||
data[area_l] = c_leaves --add leaves now
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for tree_h = 0, hight-1 do -- add the trunk
|
||||
local area_t = a:index(pos.x, pos.y+tree_h, pos.z) --set area for tree
|
||||
if data[area_t] == c_air or data[area_t] == c_leaves then --sets if air
|
||||
data[area_t] = c_tree --add tree now
|
||||
end
|
||||
local random = math.random
|
||||
|
||||
local function can_grow(pos)
|
||||
local node_under = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||
if not node_under then
|
||||
return false
|
||||
end
|
||||
local name_under = node_under.name
|
||||
local is_soil = minetest.get_item_group(name_under, "soil")
|
||||
if is_soil == 0 then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
-- Sapling ABMs
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:sapling"},
|
||||
interval = 10,
|
||||
chance = 50,
|
||||
action = function(pos, node)
|
||||
if not can_grow(pos) then
|
||||
return
|
||||
end
|
||||
|
||||
minetest.log("action", "A sapling grows into a tree at "..
|
||||
minetest.pos_to_string(pos))
|
||||
default.grow_tree(pos, random(1, 4) == 1)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:junglesapling"},
|
||||
interval = 11,
|
||||
chance = 50,
|
||||
action = function(pos, node)
|
||||
if not can_grow(pos) then
|
||||
return
|
||||
end
|
||||
|
||||
minetest.log("action", "A jungle sapling grows into a tree at "..
|
||||
minetest.pos_to_string(pos))
|
||||
default.grow_jungletree(pos)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:pine_sapling"},
|
||||
interval = 12,
|
||||
chance = 50,
|
||||
action = function(pos, node)
|
||||
if not can_grow(pos) then
|
||||
return
|
||||
end
|
||||
|
||||
minetest.log("action", "A pine sapling grows into a tree at "..
|
||||
minetest.pos_to_string(pos))
|
||||
default.grow_pinetree(pos)
|
||||
end
|
||||
})
|
||||
|
||||
-- Appletree, jungletree function
|
||||
|
||||
local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid,
|
||||
height, size, iters, is_apple_tree)
|
||||
local x, y, z = pos.x, pos.y, pos.z
|
||||
local c_air = minetest.get_content_id("air")
|
||||
local c_ignore = minetest.get_content_id("ignore")
|
||||
local c_apple = minetest.get_content_id("default:apple")
|
||||
|
||||
-- Trunk
|
||||
for y_dist = 0, height - 1 do
|
||||
local vi = a:index(x, y + y_dist, z)
|
||||
local node_id = data[vi]
|
||||
if y_dist == 0 or node_id == c_air or node_id == c_ignore
|
||||
or node_id == leaves_cid then
|
||||
data[vi] = tree_cid
|
||||
end
|
||||
end
|
||||
|
||||
-- Force leaves near the trunk
|
||||
for z_dist = -1, 1 do
|
||||
for y_dist = -size, 1 do
|
||||
local vi = a:index(x - 1, y + height + y_dist, z + z_dist)
|
||||
for x_dist = -1, 1 do
|
||||
if data[vi] == c_air or data[vi] == c_ignore then
|
||||
if is_apple_tree and random(1, 8) == 1 then
|
||||
data[vi] = c_apple
|
||||
else
|
||||
data[vi] = leaves_cid
|
||||
end
|
||||
end
|
||||
vi = vi + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Randomly add leaves in 2x2x2 clusters.
|
||||
for i = 1, iters do
|
||||
local clust_x = x + random(-size, size - 1)
|
||||
local clust_y = y + height + random(-size, 0)
|
||||
local clust_z = z + random(-size, size - 1)
|
||||
|
||||
for xi = 0, 1 do
|
||||
for yi = 0, 1 do
|
||||
for zi = 0, 1 do
|
||||
local vi = a:index(clust_x + xi, clust_y + yi, clust_z + zi)
|
||||
if data[vi] == c_air or data[vi] == c_ignore then
|
||||
if is_apple_tree and random(1, 8) == 1 then
|
||||
data[vi] = c_apple
|
||||
else
|
||||
data[vi] = leaves_cid
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local c_jungletree = minetest.get_content_id("default:jungletree")
|
||||
local c_jungleleaves = minetest.get_content_id("default:jungleleaves")
|
||||
-- Appletree
|
||||
|
||||
function default.grow_jungletree(data, a, pos, seed)
|
||||
--[[
|
||||
NOTE: Tree-placing code is currently duplicated in the engine
|
||||
and in games that have saplings; both are deprecated but not
|
||||
replaced yet
|
||||
]]--
|
||||
local hight = math.random(8, 12)
|
||||
for x_area = -3, 3 do
|
||||
for y_area = -2, 2 do
|
||||
for z_area = -3, 3 do
|
||||
if math.random(1,30) < 23 then --randomize leaves
|
||||
local area_l = a:index(pos.x+x_area, pos.y+hight+y_area-1, pos.z+z_area) --sets area for leaves
|
||||
if data[area_l] == c_air or data[area_l] == c_ignore then --sets if it's air or ignore
|
||||
data[area_l] = c_jungleleaves --add leaves now
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for tree_h = 0, hight-1 do -- add the trunk
|
||||
local area_t = a:index(pos.x, pos.y+tree_h, pos.z) --set area for tree
|
||||
if data[area_t] == c_air or data[area_t] == c_jungleleaves then --sets if air
|
||||
data[area_t] = c_jungletree --add tree now
|
||||
end
|
||||
end
|
||||
for roots_x = -1, 1 do
|
||||
for roots_z = -1, 1 do
|
||||
if math.random(1, 3) >= 2 then --randomize roots
|
||||
if a:contains(pos.x+roots_x, pos.y-1, pos.z+roots_z) and data[a:index(pos.x+roots_x, pos.y-1, pos.z+roots_z)] == c_air then
|
||||
data[a:index(pos.x+roots_x, pos.y-1, pos.z+roots_z)] = c_jungletree
|
||||
elseif a:contains(pos.x+roots_x, pos.y, pos.z+roots_z) and data[a:index(pos.x+roots_x, pos.y, pos.z+roots_z)] == c_air then
|
||||
data[a:index(pos.x+roots_x, pos.y, pos.z+roots_z)] = c_jungletree
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function default.grow_tree(pos, is_apple_tree, bad)
|
||||
--[[
|
||||
NOTE: Tree-placing code is currently duplicated in the engine
|
||||
and in games that have saplings; both are deprecated but not
|
||||
replaced yet
|
||||
--]]
|
||||
if bad then
|
||||
error("Deprecated use of default.grow_tree")
|
||||
end
|
||||
|
||||
local x, y, z = pos.x, pos.y, pos.z
|
||||
local height = random(4, 5)
|
||||
local c_tree = minetest.get_content_id("default:tree")
|
||||
local c_leaves = minetest.get_content_id("default:leaves")
|
||||
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local minp, maxp = vm:read_from_map(
|
||||
{x = pos.x - 2, y = pos.y, z = pos.z - 2},
|
||||
{x = pos.x + 2, y = pos.y + height + 1, z = pos.z + 2}
|
||||
)
|
||||
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
|
||||
local data = vm:get_data()
|
||||
|
||||
add_trunk_and_leaves(data, a, pos, c_tree, c_leaves, height, 2, 8, is_apple_tree)
|
||||
|
||||
vm:set_data(data)
|
||||
vm:write_to_map()
|
||||
vm:update_map()
|
||||
end
|
||||
|
||||
-- Jungletree
|
||||
|
||||
function default.grow_jungletree(pos, bad)
|
||||
--[[
|
||||
NOTE: Jungletree-placing code is currently duplicated in the engine
|
||||
and in games that have saplings; both are deprecated but not
|
||||
replaced yet
|
||||
--]]
|
||||
if bad then
|
||||
error("Deprecated use of default.grow_jungletree")
|
||||
end
|
||||
|
||||
local x, y, z = pos.x, pos.y, pos.z
|
||||
local height = random(8, 12)
|
||||
local c_air = minetest.get_content_id("air")
|
||||
local c_ignore = minetest.get_content_id("ignore")
|
||||
local c_jungletree = minetest.get_content_id("default:jungletree")
|
||||
local c_jungleleaves = minetest.get_content_id("default:jungleleaves")
|
||||
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local minp, maxp = vm:read_from_map(
|
||||
{x = pos.x - 3, y = pos.y - 1, z = pos.z - 3},
|
||||
{x = pos.x + 3, y = pos.y + height + 1, z = pos.z + 3}
|
||||
)
|
||||
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
|
||||
local data = vm:get_data()
|
||||
|
||||
add_trunk_and_leaves(data, a, pos, c_jungletree, c_jungleleaves, height, 3, 30, false)
|
||||
|
||||
-- Roots
|
||||
for z_dist = -1, 1 do
|
||||
local vi_1 = a:index(x - 1, y - 1, z + z_dist)
|
||||
local vi_2 = a:index(x - 1, y, z + z_dist)
|
||||
for x_dist = -1, 1 do
|
||||
if random(1, 3) >= 2 then
|
||||
if data[vi_1] == c_air or data[vi_1] == c_ignore then
|
||||
data[vi_1] = c_jungletree
|
||||
elseif data[vi_2] == c_air or data[vi_2] == c_ignore then
|
||||
data[vi_2] = c_jungletree
|
||||
end
|
||||
end
|
||||
vi_1 = vi_1 + 1
|
||||
vi_2 = vi_2 + 1
|
||||
end
|
||||
end
|
||||
|
||||
vm:set_data(data)
|
||||
vm:write_to_map()
|
||||
vm:update_map()
|
||||
end
|
||||
|
||||
-- Pinetree from mg mapgen mod, design by sfan5, pointy top added by paramat
|
||||
|
||||
local function add_pine_needles(data, vi, c_air, c_ignore, c_snow, c_pine_needles)
|
||||
if data[vi] == c_air or data[vi] == c_ignore or data[vi] == c_snow then
|
||||
data[vi] = c_pine_needles
|
||||
end
|
||||
end
|
||||
|
||||
local function add_snow(data, vi, c_air, c_ignore, c_snow)
|
||||
if data[vi] == c_air or data[vi] == c_ignore then
|
||||
data[vi] = c_snow
|
||||
end
|
||||
end
|
||||
|
||||
function default.grow_pinetree(pos)
|
||||
local x, y, z = pos.x, pos.y, pos.z
|
||||
local maxy = y + random(9, 13) -- Trunk top
|
||||
|
||||
local c_air = minetest.get_content_id("air")
|
||||
local c_ignore = minetest.get_content_id("ignore")
|
||||
local c_pinetree = minetest.get_content_id("default:pinetree")
|
||||
local c_pine_needles = minetest.get_content_id("default:pine_needles")
|
||||
local c_snow = minetest.get_content_id("default:snow")
|
||||
local c_snowblock = minetest.get_content_id("default:snowblock")
|
||||
local c_dirtsnow = minetest.get_content_id("default:dirt_with_snow")
|
||||
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local minp, maxp = vm:read_from_map(
|
||||
{x = x - 3, y = y - 1, z = z - 3},
|
||||
{x = x + 3, y = maxy + 3, z = z + 3}
|
||||
)
|
||||
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
|
||||
local data = vm:get_data()
|
||||
|
||||
-- Scan for snow nodes near sapling
|
||||
local snow = false
|
||||
for yy = y - 1, y + 1 do
|
||||
for zz = z - 1, z + 1 do
|
||||
local vi = a:index(x - 1, yy, zz)
|
||||
for xx = x - 1, x + 1 do
|
||||
local nodid = data[vi]
|
||||
if nodid == c_snow
|
||||
or nodid == c_snowblock
|
||||
or nodid == c_dirtsnow then
|
||||
snow = true
|
||||
end
|
||||
vi = vi + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Upper branches layer
|
||||
local dev = 3
|
||||
for yy = maxy - 1, maxy + 1 do
|
||||
for zz = z - dev, z + dev do
|
||||
local vi = a:index(x - dev, yy, zz)
|
||||
local via = a:index(x - dev, yy + 1, zz)
|
||||
for xx = x - dev, x + dev do
|
||||
if random() < 0.95 - dev * 0.05 then
|
||||
add_pine_needles(data, vi, c_air, c_ignore, c_snow,
|
||||
c_pine_needles)
|
||||
if snow then
|
||||
add_snow(data, via, c_air, c_ignore, c_snow)
|
||||
end
|
||||
end
|
||||
vi = vi + 1
|
||||
via = via + 1
|
||||
end
|
||||
end
|
||||
dev = dev - 1
|
||||
end
|
||||
|
||||
-- Centre top nodes
|
||||
add_pine_needles(data, a:index(x, maxy + 1, z), c_air, c_ignore, c_snow,
|
||||
c_pine_needles)
|
||||
add_pine_needles(data, a:index(x, maxy + 2, z), c_air, c_ignore, c_snow,
|
||||
c_pine_needles) -- Paramat added a pointy top node
|
||||
if snow then
|
||||
add_snow(data, a:index(x, maxy + 3, z), c_air, c_ignore, c_snow)
|
||||
end
|
||||
|
||||
-- Lower branches layer
|
||||
local my = 0
|
||||
for i = 1, 20 do -- Random 2x2 squares of needles
|
||||
local xi = x + random(-3, 2)
|
||||
local yy = maxy + random(-6, -5)
|
||||
local zi = z + random(-3, 2)
|
||||
if yy > my then
|
||||
my = yy
|
||||
end
|
||||
for zz = zi, zi+1 do
|
||||
local vi = a:index(xi, yy, zz)
|
||||
local via = a:index(xi, yy + 1, zz)
|
||||
for xx = xi, xi + 1 do
|
||||
add_pine_needles(data, vi, c_air, c_ignore, c_snow,
|
||||
c_pine_needles)
|
||||
if snow then
|
||||
add_snow(data, via, c_air, c_ignore, c_snow)
|
||||
end
|
||||
vi = vi + 1
|
||||
via = via + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local dev = 2
|
||||
for yy = my + 1, my + 2 do
|
||||
for zz = z - dev, z + dev do
|
||||
local vi = a:index(x - dev, yy, zz)
|
||||
local via = a:index(x - dev, yy + 1, zz)
|
||||
for xx = x - dev, x + dev do
|
||||
if random() < 0.95 - dev * 0.05 then
|
||||
add_pine_needles(data, vi, c_air, c_ignore, c_snow,
|
||||
c_pine_needles)
|
||||
if snow then
|
||||
add_snow(data, via, c_air, c_ignore, c_snow)
|
||||
end
|
||||
end
|
||||
vi = vi + 1
|
||||
via = via + 1
|
||||
end
|
||||
end
|
||||
dev = dev - 1
|
||||
end
|
||||
|
||||
-- Trunk
|
||||
for yy = y, maxy do
|
||||
local vi = a:index(x, yy, z)
|
||||
data[vi] = c_pinetree
|
||||
end
|
||||
|
||||
vm:set_data(data)
|
||||
vm:write_to_map()
|
||||
vm:update_map()
|
||||
end
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
Minetest 0.4 mod: doors
|
||||
=======================
|
||||
version: 1.3
|
||||
|
||||
License of source code:
|
||||
-----------------------
|
||||
Copyright (C) 2012 PilzAdam
|
||||
modified by BlockMen (added sounds, glassdoors[glass, obsidian glass], trapdoor)
|
||||
|
||||
This program is free software. It comes without any warranty, to
|
||||
the extent permitted by applicable law. You can redistribute it
|
||||
|
@ -11,13 +13,34 @@ 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.
|
||||
|
||||
License of media (textures and sounds)
|
||||
License of textures
|
||||
--------------------------------------
|
||||
Textures created by Fernando Zapata (CC BY-SA 3.0):
|
||||
following Textures created by Fernando Zapata (CC BY-SA 3.0):
|
||||
door_wood.png
|
||||
door_wood_a.png
|
||||
door_wood_a_r.png
|
||||
door_wood_b.png
|
||||
door_wood_b_r.png
|
||||
|
||||
following Textures created by BlockMen (WTFPL):
|
||||
door_trapdoor.png
|
||||
door_obsidian_glass_side.png
|
||||
|
||||
following textures created by celeron55 (CC BY-SA 3.0):
|
||||
door_trapdoor_side.png
|
||||
door_glass_a.png
|
||||
door_glass_b.png
|
||||
|
||||
following Textures created by PenguinDad (CC BY-SA 4.0):
|
||||
door_glass.png
|
||||
door_obsidian_glass.png
|
||||
|
||||
All other textures (created by PilzAdam): WTFPL
|
||||
|
||||
|
||||
License of sounds
|
||||
--------------------------------------
|
||||
Opening-Sound created by CGEffex (CC BY 3.0), modified by BlockMen
|
||||
door_open.ogg
|
||||
Closing-Sound created by bennstir (CC BY 3.0)
|
||||
door_close.ogg
|
||||
|
|
|
@ -15,10 +15,12 @@ doors = {}
|
|||
-- selection_box_top
|
||||
-- only_placer_can_open: if true only the player who placed the door can
|
||||
-- open it
|
||||
function doors:register_door(name, def)
|
||||
|
||||
|
||||
function doors.register_door(name, def)
|
||||
def.groups.not_in_creative_inventory = 1
|
||||
|
||||
local box = {{-0.5, -0.5, -0.5, 0.5, 0.5, -0.5+1.5/16}}
|
||||
local box = {{-0.5, -0.5, -0.5, 0.5, 0.5, -0.5+1.5/16}}
|
||||
|
||||
if not def.node_box_bottom then
|
||||
def.node_box_bottom = box
|
||||
|
@ -33,6 +35,14 @@ function doors:register_door(name, def)
|
|||
def.selection_box_top = box
|
||||
end
|
||||
|
||||
if not def.sound_close_door then
|
||||
def.sound_close_door = "door_close"
|
||||
end
|
||||
if not def.sound_open_door then
|
||||
def.sound_open_door = "door_open"
|
||||
end
|
||||
|
||||
|
||||
minetest.register_craftitem(name, {
|
||||
description = def.description,
|
||||
inventory_image = def.inventory_image,
|
||||
|
@ -77,12 +87,14 @@ function doors:register_door(name, def)
|
|||
elseif p2 == 3 then
|
||||
pt3.z = pt3.z-1
|
||||
end
|
||||
if not string.find(minetest.get_node(pt3).name, name.."_b_") then
|
||||
if minetest.get_item_group(minetest.get_node(pt3).name, "door") == 0 then
|
||||
minetest.set_node(pt, {name=name.."_b_1", param2=p2})
|
||||
minetest.set_node(pt2, {name=name.."_t_1", param2=p2})
|
||||
else
|
||||
minetest.set_node(pt, {name=name.."_b_2", param2=p2})
|
||||
minetest.set_node(pt2, {name=name.."_t_2", param2=p2})
|
||||
minetest.get_meta(pt):set_int("right", 1)
|
||||
minetest.get_meta(pt2):set_int("right", 1)
|
||||
end
|
||||
|
||||
if def.only_placer_can_open then
|
||||
|
@ -104,10 +116,11 @@ function doors:register_door(name, def)
|
|||
|
||||
local tt = def.tiles_top
|
||||
local tb = def.tiles_bottom
|
||||
|
||||
local function after_dig_node(pos, name)
|
||||
if minetest.get_node(pos).name == name then
|
||||
minetest.remove_node(pos)
|
||||
|
||||
local function after_dig_node(pos, name, digger)
|
||||
local node = minetest.get_node(pos)
|
||||
if node.name == name then
|
||||
minetest.node_dig(pos, node, digger)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -118,11 +131,24 @@ function doors:register_door(name, def)
|
|||
end
|
||||
local p2 = minetest.get_node(pos).param2
|
||||
p2 = params[p2+1]
|
||||
|
||||
|
||||
minetest.swap_node(pos, {name=replace_dir, param2=p2})
|
||||
|
||||
|
||||
pos.y = pos.y-dir
|
||||
minetest.swap_node(pos, {name=replace, param2=p2})
|
||||
|
||||
local snd_1 = def.sound_close_door
|
||||
local snd_2 = def.sound_open_door
|
||||
if params[1] == 3 then
|
||||
snd_1 = def.sound_open_door
|
||||
snd_2 = def.sound_close_door
|
||||
end
|
||||
|
||||
if minetest.get_meta(pos):get_int("right") ~= 0 then
|
||||
minetest.sound_play(snd_1, {pos = pos, gain = 0.3, max_hear_distance = 10})
|
||||
else
|
||||
minetest.sound_play(snd_2, {pos = pos, gain = 0.3, max_hear_distance = 10})
|
||||
end
|
||||
end
|
||||
|
||||
local function check_player_priv(pos, player)
|
||||
|
@ -149,26 +175,28 @@ function doors:register_door(name, def)
|
|||
fixed = def.selection_box_bottom
|
||||
},
|
||||
groups = def.groups,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
pos.y = pos.y+1
|
||||
after_dig_node(pos, name.."_t_1")
|
||||
after_dig_node(pos, name.."_t_1", digger)
|
||||
end,
|
||||
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
if check_player_priv(pos, clicker) then
|
||||
on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0})
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
can_dig = check_player_priv,
|
||||
sounds = def.sounds,
|
||||
sunlight_propagates = def.sunlight
|
||||
})
|
||||
|
||||
minetest.register_node(name.."_t_1", {
|
||||
tiles = {tt[2], tt[2], tt[2], tt[2], tt[1], tt[1].."^[transformfx"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
drop = name,
|
||||
drop = "",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -179,19 +207,21 @@ function doors:register_door(name, def)
|
|||
fixed = def.selection_box_top
|
||||
},
|
||||
groups = def.groups,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
pos.y = pos.y-1
|
||||
after_dig_node(pos, name.."_b_1")
|
||||
after_dig_node(pos, name.."_b_1", digger)
|
||||
end,
|
||||
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
if check_player_priv(pos, clicker) then
|
||||
on_rightclick(pos, -1, name.."_b_1", name.."_t_2", name.."_b_2", {1,2,3,0})
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
can_dig = check_player_priv,
|
||||
sounds = def.sounds,
|
||||
sunlight_propagates = def.sunlight,
|
||||
})
|
||||
|
||||
minetest.register_node(name.."_b_2", {
|
||||
|
@ -209,26 +239,28 @@ function doors:register_door(name, def)
|
|||
fixed = def.selection_box_bottom
|
||||
},
|
||||
groups = def.groups,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
pos.y = pos.y+1
|
||||
after_dig_node(pos, name.."_t_2")
|
||||
after_dig_node(pos, name.."_t_2", digger)
|
||||
end,
|
||||
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
if check_player_priv(pos, clicker) then
|
||||
on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
can_dig = check_player_priv,
|
||||
sounds = def.sounds,
|
||||
sunlight_propagates = def.sunlight
|
||||
})
|
||||
|
||||
minetest.register_node(name.."_t_2", {
|
||||
tiles = {tt[2], tt[2], tt[2], tt[2], tt[1].."^[transformfx", tt[1]},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
drop = name,
|
||||
drop = "",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -239,28 +271,33 @@ function doors:register_door(name, def)
|
|||
fixed = def.selection_box_top
|
||||
},
|
||||
groups = def.groups,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
pos.y = pos.y-1
|
||||
after_dig_node(pos, name.."_b_2")
|
||||
after_dig_node(pos, name.."_b_2", digger)
|
||||
end,
|
||||
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
if check_player_priv(pos, clicker) then
|
||||
on_rightclick(pos, -1, name.."_b_2", name.."_t_1", name.."_b_1", {3,0,1,2})
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
can_dig = check_player_priv,
|
||||
sounds = def.sounds,
|
||||
sunlight_propagates = def.sunlight
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
doors:register_door("doors:door_wood", {
|
||||
doors.register_door("doors:door_wood", {
|
||||
description = "Wooden Door",
|
||||
inventory_image = "door_wood.png",
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,door=1},
|
||||
tiles_bottom = {"door_wood_b.png", "door_brown.png"},
|
||||
tiles_top = {"door_wood_a.png", "door_brown.png"},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
sunlight = false,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
|
@ -272,13 +309,15 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
doors:register_door("doors:door_steel", {
|
||||
doors.register_door("doors:door_steel", {
|
||||
description = "Steel Door",
|
||||
inventory_image = "door_steel.png",
|
||||
groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2,door=1},
|
||||
tiles_bottom = {"door_steel_b.png", "door_grey.png"},
|
||||
tiles_top = {"door_steel_a.png", "door_grey.png"},
|
||||
only_placer_can_open = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
sunlight = false,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
|
@ -290,7 +329,125 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_alias("doors:door_wood_a_c", "doors:door_wood_t_1")
|
||||
minetest.register_alias("doors:door_wood_a_o", "doors:door_wood_t_1")
|
||||
minetest.register_alias("doors:door_wood_b_c", "doors:door_wood_b_1")
|
||||
minetest.register_alias("doors:door_wood_b_o", "doors:door_wood_b_1")
|
||||
doors.register_door("doors:door_glass", {
|
||||
description = "Glass Door",
|
||||
inventory_image = "door_glass.png",
|
||||
groups = {snappy=1,cracky=1,oddly_breakable_by_hand=3,door=1},
|
||||
tiles_bottom = {"door_glass_b.png", "door_glass_side.png"},
|
||||
tiles_top = {"door_glass_a.png", "door_glass_side.png"},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
sunlight = true,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "doors:door_glass",
|
||||
recipe = {
|
||||
{"default:glass", "default:glass"},
|
||||
{"default:glass", "default:glass"},
|
||||
{"default:glass", "default:glass"}
|
||||
}
|
||||
})
|
||||
|
||||
doors.register_door("doors:door_obsidian_glass", {
|
||||
description = "Obsidian Glass Door",
|
||||
inventory_image = "door_obsidian_glass.png",
|
||||
groups = {snappy=1,cracky=1,oddly_breakable_by_hand=3,door=1},
|
||||
tiles_bottom = {"door_obsidian_glass_b.png", "door_obsidian_glass_side.png"},
|
||||
tiles_top = {"door_obsidian_glass_b.png", "door_obsidian_glass_side.png"},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
sunlight = true,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "doors:door_obsidian_glass",
|
||||
recipe = {
|
||||
{"default:obsidian_glass", "default:obsidian_glass"},
|
||||
{"default:obsidian_glass", "default:obsidian_glass"},
|
||||
{"default:obsidian_glass", "default:obsidian_glass"}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
----trapdoor----
|
||||
|
||||
local function update_door(pos, node)
|
||||
minetest.set_node(pos, node)
|
||||
end
|
||||
|
||||
local function punch(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local state = meta:get_int("state")
|
||||
local me = minetest.get_node(pos)
|
||||
local tmp_node
|
||||
local tmp_node2
|
||||
if state == 1 then
|
||||
state = 0
|
||||
minetest.sound_play("door_close", {pos = pos, gain = 0.3, max_hear_distance = 10})
|
||||
tmp_node = {name="doors:trapdoor", param1=me.param1, param2=me.param2}
|
||||
else
|
||||
state = 1
|
||||
minetest.sound_play("door_open", {pos = pos, gain = 0.3, max_hear_distance = 10})
|
||||
tmp_node = {name="doors:trapdoor_open", param1=me.param1, param2=me.param2}
|
||||
end
|
||||
update_door(pos, tmp_node)
|
||||
meta:set_int("state", state)
|
||||
end
|
||||
|
||||
minetest.register_node("doors:trapdoor", {
|
||||
description = "Trapdoor",
|
||||
inventory_image = "door_trapdoor.png",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"door_trapdoor.png", "door_trapdoor.png", "door_trapdoor_side.png", "door_trapdoor_side.png", "door_trapdoor_side.png", "door_trapdoor_side.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,door=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
drop = "doors:trapdoor",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5}
|
||||
},
|
||||
on_creation = function(pos)
|
||||
state = 0
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
punch(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("doors:trapdoor_open", {
|
||||
drawtype = "nodebox",
|
||||
tiles = {"door_trapdoor_side.png", "door_trapdoor_side.png", "door_trapdoor_side.png", "door_trapdoor_side.png", "door_trapdoor.png", "door_trapdoor.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
pointable = true,
|
||||
stack_max = 0,
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,door=1},
|
||||
climbable = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
drop = "doors:trapdoor",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0.4, 0.5, 0.5, 0.5}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0.4, 0.5, 0.5, 0.5}
|
||||
},
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
punch(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'doors:trapdoor 2',
|
||||
recipe = {
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
{'', '', ''},
|
||||
}
|
||||
})
|
||||
|
|
After Width: | Height: | Size: 128 B |
After Width: | Height: | Size: 204 B |
After Width: | Height: | Size: 204 B |
After Width: | Height: | Size: 82 B |
After Width: | Height: | Size: 130 B |
After Width: | Height: | Size: 217 B |
After Width: | Height: | Size: 217 B |
After Width: | Height: | Size: 88 B |
After Width: | Height: | Size: 350 B |
After Width: | Height: | Size: 173 B |
|
@ -1,63 +1,10 @@
|
|||
-- minetest/dye/init.lua
|
||||
|
||||
-- To make recipes that will work with any dye ever made by anybody, define
|
||||
-- them based on groups.
|
||||
-- You can select any group of groups, based on your need for amount of colors.
|
||||
-- basecolor: 9, excolor: 17, unicolor: 89
|
||||
--
|
||||
-- Example of one shapeless recipe using a color group:
|
||||
-- Note: As this uses basecolor_*, you'd need 9 of these.
|
||||
-- minetest.register_craft({
|
||||
-- type = "shapeless",
|
||||
-- output = '<mod>:item_yellow',
|
||||
-- recipe = {'<mod>:item_no_color', 'group:basecolor_yellow'},
|
||||
-- })
|
||||
|
||||
-- Other mods can use these for looping through available colors
|
||||
local dye = {}
|
||||
dye = {}
|
||||
dye.basecolors = {"white", "grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta"}
|
||||
dye.excolors = {"white", "lightgrey", "grey", "darkgrey", "black", "red", "orange", "yellow", "lime", "green", "aqua", "cyan", "sky_blue", "blue", "violet", "magenta", "red_violet"}
|
||||
|
||||
-- Base color groups:
|
||||
-- - basecolor_white
|
||||
-- - basecolor_grey
|
||||
-- - basecolor_black
|
||||
-- - basecolor_red
|
||||
-- - basecolor_yellow
|
||||
-- - basecolor_green
|
||||
-- - basecolor_cyan
|
||||
-- - basecolor_blue
|
||||
-- - basecolor_magenta
|
||||
|
||||
-- Extended color groups (* = equal to a base color):
|
||||
-- * excolor_white
|
||||
-- - excolor_lightgrey
|
||||
-- * excolor_grey
|
||||
-- - excolor_darkgrey
|
||||
-- * excolor_black
|
||||
-- * excolor_red
|
||||
-- - excolor_orange
|
||||
-- * excolor_yellow
|
||||
-- - excolor_lime
|
||||
-- * excolor_green
|
||||
-- - excolor_aqua
|
||||
-- * excolor_cyan
|
||||
-- - excolor_sky_blue
|
||||
-- * excolor_blue
|
||||
-- - excolor_violet
|
||||
-- * excolor_magenta
|
||||
-- - excolor_red_violet
|
||||
|
||||
-- The whole unifieddyes palette as groups:
|
||||
-- - unicolor_<excolor>
|
||||
-- For the following, no white/grey/black is allowed:
|
||||
-- - unicolor_medium_<excolor>
|
||||
-- - unicolor_dark_<excolor>
|
||||
-- - unicolor_light_<excolor>
|
||||
-- - unicolor_<excolor>_s50
|
||||
-- - unicolor_medium_<excolor>_s50
|
||||
-- - unicolor_dark_<excolor>_s50
|
||||
|
||||
-- Local stuff
|
||||
local dyelocal = {}
|
||||
|
||||
|
@ -73,7 +20,7 @@ dyelocal.dyes = {
|
|||
{"dark_green", "Dark green dye",{dye=1, basecolor_green=1, excolor_green=1, unicolor_dark_green=1}},
|
||||
{"green", "Green dye", {dye=1, basecolor_green=1, excolor_green=1, unicolor_green=1}},
|
||||
{"yellow", "Yellow dye", {dye=1, basecolor_yellow=1, excolor_yellow=1, unicolor_yellow=1}},
|
||||
{"brown", "Brown dye", {dye=1, basecolor_brown=1, excolor_orange=1, unicolor_dark_orange=1}},
|
||||
{"brown", "Brown dye", {dye=1, basecolor_brown=1, excolor_orange=1, unicolor_dark_orange=1}},
|
||||
{"orange", "Orange dye", {dye=1, basecolor_orange=1, excolor_orange=1, unicolor_orange=1}},
|
||||
{"red", "Red dye", {dye=1, basecolor_red=1, excolor_red=1, unicolor_red=1}},
|
||||
{"magenta", "Magenta dye", {dye=1, basecolor_magenta=1, excolor_red_violet=1,unicolor_red_violet=1}},
|
||||
|
@ -98,6 +45,12 @@ for _, row in ipairs(dyelocal.dyes) do
|
|||
recipe = {"group:flower,color_"..name},
|
||||
})
|
||||
end
|
||||
-- manually add coal->black dye
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "dye:black 4",
|
||||
recipe = {"group:coal"},
|
||||
})
|
||||
|
||||
-- Mix recipes
|
||||
-- Just mix everything to everything somehow sanely
|
||||
|
@ -132,8 +85,3 @@ for one,results in pairs(dyelocal.mixes) do
|
|||
})
|
||||
end
|
||||
end
|
||||
|
||||
-- Hide dyelocal
|
||||
dyelocal = nil
|
||||
|
||||
-- EOF
|
||||
|
|
|
@ -1,30 +1,31 @@
|
|||
-- minetest/fire/init.lua
|
||||
|
||||
fire = {}
|
||||
|
||||
minetest.register_node("fire:basic_flame", {
|
||||
description = "Fire",
|
||||
drawtype = "plantlike",
|
||||
drawtype = "firelike",
|
||||
tiles = {{
|
||||
name="fire_basic_flame_animated.png",
|
||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1},
|
||||
}},
|
||||
inventory_image = "fire_basic_flame.png",
|
||||
light_source = 14,
|
||||
groups = {igniter=2,dig_immediate=3,hot=3},
|
||||
groups = {igniter=2,dig_immediate=3},
|
||||
drop = '',
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
damage_per_second = 4,
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
fire.on_flame_add_at(pos)
|
||||
|
||||
on_construct = function(pos)
|
||||
minetest.after(0, fire.on_flame_add_at, pos)
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
fire.on_flame_remove_at(pos)
|
||||
|
||||
on_destruct = function(pos)
|
||||
minetest.after(0, fire.on_flame_remove_at, pos)
|
||||
end,
|
||||
})
|
||||
|
||||
fire = {}
|
||||
fire.D = 6
|
||||
-- key: position hash of low corner of area
|
||||
-- value: {handle=sound handle, name=sound name}
|
||||
|
@ -81,12 +82,10 @@ function fire.update_sounds_around(pos)
|
|||
end
|
||||
|
||||
function fire.on_flame_add_at(pos)
|
||||
--print("flame added at "..minetest.pos_to_string(pos))
|
||||
fire.update_sounds_around(pos)
|
||||
end
|
||||
|
||||
function fire.on_flame_remove_at(pos)
|
||||
--print("flame removed at "..minetest.pos_to_string(pos))
|
||||
fire.update_sounds_around(pos)
|
||||
end
|
||||
|
||||
|
@ -117,7 +116,6 @@ minetest.register_abm({
|
|||
local p = fire.find_pos_for_flame_around(p0)
|
||||
if p then
|
||||
minetest.set_node(p, {name="fire:basic_flame"})
|
||||
fire.on_flame_add_at(p)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
@ -143,7 +141,6 @@ minetest.register_abm({
|
|||
local p2 = fire.find_pos_for_flame_around(p)
|
||||
if p2 then
|
||||
minetest.set_node(p2, {name="fire:basic_flame"})
|
||||
fire.on_flame_add_at(p2)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
@ -158,7 +155,6 @@ minetest.register_abm({
|
|||
-- If there is water or stuff like that around flame, remove flame
|
||||
if fire.flame_should_extinguish(p0) then
|
||||
minetest.remove_node(p0)
|
||||
fire.on_flame_remove_at(p0)
|
||||
return
|
||||
end
|
||||
-- Make the following things rarer
|
||||
|
@ -168,7 +164,6 @@ minetest.register_abm({
|
|||
-- If there are no flammable nodes around flame, remove flame
|
||||
if not minetest.find_node_near(p0, 1, {"group:flammable"}) then
|
||||
minetest.remove_node(p0)
|
||||
fire.on_flame_remove_at(p0)
|
||||
return
|
||||
end
|
||||
if math.random(1,4) == 1 then
|
||||
|
@ -185,7 +180,6 @@ minetest.register_abm({
|
|||
else
|
||||
-- remove flame
|
||||
minetest.remove_node(p0)
|
||||
fire.on_flame_remove_at(p0)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
-- Minetest 0.4 mod: default
|
||||
-- See README.txt for licensing and other information.
|
||||
|
||||
-- Namespace for functions
|
||||
flowers = {}
|
||||
|
||||
-- Map Generation
|
||||
dofile(minetest.get_modpath("flowers").."/mapgen.lua")
|
||||
|
||||
|
@ -26,7 +29,7 @@ minetest.register_node("flowers:dandelion_white", {
|
|||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 },
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.2, 0.5 },
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -80,7 +83,7 @@ minetest.register_node("flowers:rose", {
|
|||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 },
|
||||
fixed = { -0.15, -0.5, -0.15, 0.15, 0.3, 0.15 },
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -116,7 +119,7 @@ minetest.register_node("flowers:viola", {
|
|||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 },
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.2, 0.5 },
|
||||
},
|
||||
})
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
function flowers.mgv6ongen(minp, maxp, seed)
|
||||
if maxp.y >= 2 and minp.y <= 0 then
|
||||
-- Generate flowers
|
||||
local perlin1 = minetest.get_perlin(436, 3, 0.6, 100)
|
||||
|
@ -26,7 +26,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
break
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if ground_y then
|
||||
local p = {x=x,y=ground_y+1,z=z}
|
||||
local nn = minetest.get_node(p).name
|
||||
|
@ -54,9 +54,17 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Enable in mapgen v6 only
|
||||
|
||||
minetest.register_on_mapgen_init(function(mg_params)
|
||||
if mg_params.mgname == "v6" then
|
||||
minetest.register_on_generated(flowers.mgv6ongen)
|
||||
end
|
||||
end)
|
||||
|
|
|
@ -60,7 +60,7 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
|
|||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'stairs:stair_' .. subname .. ' 4',
|
||||
output = 'stairs:stair_' .. subname .. ' 6',
|
||||
recipe = {
|
||||
{recipeitem, "", ""},
|
||||
{recipeitem, recipeitem, ""},
|
||||
|
@ -70,7 +70,7 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
|
|||
|
||||
-- Flipped recipe for the silly minecrafters
|
||||
minetest.register_craft({
|
||||
output = 'stairs:stair_' .. subname .. ' 4',
|
||||
output = 'stairs:stair_' .. subname .. ' 6',
|
||||
recipe = {
|
||||
{"", "", recipeitem},
|
||||
{"", recipeitem, recipeitem},
|
||||
|
@ -229,8 +229,29 @@ stairs.register_stair_and_slab("stone", "default:stone",
|
|||
stairs.register_stair_and_slab("cobble", "default:cobble",
|
||||
{cracky=3},
|
||||
{"default_cobble.png"},
|
||||
"Cobble Stair",
|
||||
"Cobble Slab",
|
||||
"Cobblestone Stair",
|
||||
"Cobblestone Slab",
|
||||
default.node_sound_stone_defaults())
|
||||
|
||||
stairs.register_stair_and_slab("desert_stone", "default:desert_stone",
|
||||
{cracky=3},
|
||||
{"default_desert_stone.png"},
|
||||
"Desertstone Stair",
|
||||
"Desertstone Slab",
|
||||
default.node_sound_stone_defaults())
|
||||
|
||||
stairs.register_stair_and_slab("desert_cobble", "default:desert_cobble",
|
||||
{cracky=3},
|
||||
{"default_desert_cobble.png"},
|
||||
"Desert Cobblestone Stair",
|
||||
"Desert Cobblestone Slab",
|
||||
default.node_sound_stone_defaults())
|
||||
|
||||
stairs.register_stair_and_slab("desert_stonebrick", "default:desert_stonebrick",
|
||||
{cracky=3},
|
||||
{"default_desert_stone_brick.png"},
|
||||
"Desert Stone Brick Stair",
|
||||
"Desert Stone Brick Slab",
|
||||
default.node_sound_stone_defaults())
|
||||
|
||||
stairs.register_stair_and_slab("brick", "default:brick",
|
||||
|
@ -246,6 +267,13 @@ stairs.register_stair_and_slab("sandstone", "default:sandstone",
|
|||
"Sandstone Stair",
|
||||
"Sandstone Slab",
|
||||
default.node_sound_stone_defaults())
|
||||
|
||||
stairs.register_stair_and_slab("sandstonebrick", "default:sandstonebrick",
|
||||
{crumbly=2,cracky=2},
|
||||
{"default_sandstone_brick.png"},
|
||||
"Sandstone Brick Stair",
|
||||
"Sandstone Brick Slab",
|
||||
default.node_sound_stone_defaults())
|
||||
|
||||
stairs.register_stair_and_slab("junglewood", "default:junglewood",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
||||
|
@ -260,3 +288,11 @@ stairs.register_stair_and_slab("stonebrick", "default:stonebrick",
|
|||
"Stone Brick Stair",
|
||||
"Stone Brick Slab",
|
||||
default.node_sound_stone_defaults())
|
||||
|
||||
stairs.register_stair_and_slab("pinewood", "default:pinewood",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
||||
{"default_pinewood.png"},
|
||||
"Pinewood Stair",
|
||||
"Pinewood Slab",
|
||||
default.node_sound_wood_defaults())
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@ minetest.register_node("vessels:glass_bottle", {
|
|||
description = "Glass Bottle (empty)",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"vessels_glass_bottle.png"},
|
||||
inventory_image = "vessels_glass_bottle.png",
|
||||
inventory_image = "vessels_glass_bottle_inv.png",
|
||||
wield_image = "vessels_glass_bottle.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
|
@ -29,7 +30,8 @@ minetest.register_node("vessels:drinking_glass", {
|
|||
description = "Drinking Glass (empty)",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"vessels_drinking_glass.png"},
|
||||
inventory_image = "vessels_drinking_glass.png",
|
||||
inventory_image = "vessels_drinking_glass_inv.png",
|
||||
wield_image = "vessels_drinking_glass.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
|
@ -53,7 +55,8 @@ minetest.register_node("vessels:steel_bottle", {
|
|||
description = "Heavy Steel Bottle (empty)",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"vessels_steel_bottle.png"},
|
||||
inventory_image = "vessels_steel_bottle.png",
|
||||
inventory_image = "vessels_steel_bottle_inv.png",
|
||||
wield_image = "vessels_steel_bottle.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
|
|
After Width: | Height: | Size: 167 B |
After Width: | Height: | Size: 166 B |
After Width: | Height: | Size: 238 B |