1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-25 02:00:37 +01:00

Update minetestforfun_game with minetest_game

- I hope there is no problem. I see a lot of new stuff in the vanilla
  game. I keep a backup on another computer to restore the state of the
  repository if there is a problem.
This commit is contained in:
LeMagnesium 2014-12-08 22:44:21 +01:00
parent 7845fd5f1f
commit b8a1cac0cb
32 changed files with 820 additions and 858 deletions

View File

@ -1 +1 @@
name = minetestforfun_game
name = Minetest

View File

@ -46,6 +46,8 @@ The doors mod allows modders to register custom doors.
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)
}
@ -118,7 +120,7 @@ Xpanes API
Creates panes that automatically connect to each other
xpanes.register_pane(subname, def)
-> subname: used for nodename. Result: "xpanes:subname_{1..16}"
-> subname: used for nodename. Result: "xpanes:subname" and "xpanes:subname_{2..15}"
-> def: See [#Pane definition]
#Pane definition
@ -132,10 +134,6 @@ xpanes.register_pane(subname, def)
^ See [#Default sounds]
recipe = {{"","","","","","","","",""}},
^ Recipe field only
on_construct = function(pos)
update_pane(pos, "pane")
end,
^ Required to handle rotation correctly
}
Default sounds
@ -197,3 +195,83 @@ Model Definition
-- ...
},
}
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

View File

@ -1,3 +1,4 @@
mg_flags = dungeons
mgv6_spflags = biomeblend, jungles
movement_liquid_sink = 25

View File

@ -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

View File

@ -32,7 +32,7 @@ end
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"},
@ -80,9 +80,12 @@ function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, d
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()
@ -91,6 +94,7 @@ function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, d
if not minetest.setting_getbool("creative_mode") then
puncher:get_inventory():add_item("main", "boats:boat")
end
end
end
function boat.on_step(self, dtime)
@ -100,19 +104,17 @@ function boat.on_step(self, dtime)
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
elseif ctrl.down then
self.v = self.v - 0.1
end
if ctrl.left then
if ctrl.down 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
if ctrl.right then
if ctrl.down then
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)
@ -121,6 +123,7 @@ function boat.on_step(self, dtime)
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)
@ -144,30 +147,33 @@ function boat.on_step(self, dtime)
self.v = 0
new_acce = {x = 0, y = 1, z = 0}
else
new_acce = {x = 0, y = -9.8, z = 0} -- freefall in air -9.81
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
new_acce = {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})
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) <= 2 then
if math.abs(self.object:getvelocity().y) < 1 then
local pos = self.object:getpos()
pos.y = math.floor(pos.y) + 0.5
self.object:setpos(pos)
new_velo = get_velocity(self.v, self.object:getyaw(), 0)
else
new_velo = get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y)
self.object:setpos(self.object:getpos())
end
end
end
@ -177,7 +183,6 @@ end
minetest.register_entity("boats:boat", boat)
minetest.register_craftitem("boats:boat", {
description = "Boat",
inventory_image = "boat_inventory.png",
@ -209,3 +214,4 @@ minetest.register_craft({
{"group:wood", "group:wood", "group:wood"},
},
})

View File

@ -23,13 +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_dirt.png
default_grass.png
default_grass_side.png
default_jungletree.png
default_jungletree_top.png
default_lava.png
@ -41,6 +34,9 @@ Cisoun's WTFPL texture pack:
default_tree_top.png
default_water.png
Cisoun's conifers mod (WTFPL):
default_pine_needles.png
Originating from G4JC's Almost MC Texture Pack:
default_torch.png
default_torch_on_ceiling.png
@ -68,12 +64,12 @@ VanessaE (WTFPL):
default_sand.png
default_sandstone_brick.png
Calinou (CC BY-SA 3.0):
crack_anylength.png
Calinou (CC BY-SA):
default_brick.png
default_papyrus.png
default_copper_lump.png
default_mineral_copper.png
default_glass_detail.png
MirceaKitsune (WTFPL):
character.x
@ -87,7 +83,6 @@ PilzAdam (WTFPL):
default_junglewood.png
default_obsidian_glass.png
default_obsidian_shard.png
default_mossycobble.png
default_gold_lump.png
default_mineral_gold.png
default_snowball.png
@ -102,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
@ -112,6 +108,9 @@ Zeg9 (CC BY-SA 3.0):
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
@ -119,7 +118,6 @@ brunob.santos (CC BY-SA 4.0):
BlockMen (CC BY-SA 3.0):
default_stone_brick.png
default_wood.png
default_cobble.png
default_clay_brick.png
default_tool_steelsword.png
default_bronze_ingot.png
@ -133,10 +131,25 @@ BlockMen (CC BY-SA 3.0):
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/
2: http://www.freesound.org/people/Tomlija/sounds/97669/

View File

@ -2,41 +2,35 @@
minetest.register_craftitem("default:stick", {
description = "Stick",
stack_max = 1000,
inventory_image = "default_stick.png",
wield_image = "default_stick.png^[transformR90",
groups = {stick = 1},
groups = {stick=1},
})
minetest.register_craftitem("default:paper", {
description = "Paper",
wield_scale = {x = 1, y = 1, z = 0.25},
inventory_image = "default_paper.png",
})
minetest.register_craftitem("default:book", {
description = "Book",
inventory_image = "default_book.png",
groups = {book=1},
})
minetest.register_craftitem("default:coal_lump", {
description = "Coal Lump",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_coal_lump.png",
groups = {coal = 1}
})
minetest.register_craftitem("default:iron_lump", {
description = "Iron Lump",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_iron_lump.png",
groups = {ingot_lump = 1},
})
minetest.register_craftitem("default:copper_lump", {
description = "Copper Lump",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_copper_lump.png",
groups = {ingot_lump = 1},
})
minetest.register_craftitem("default:mese_crystal", {
@ -46,9 +40,7 @@ minetest.register_craftitem("default:mese_crystal", {
minetest.register_craftitem("default:gold_lump", {
description = "Gold Lump",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_gold_lump.png",
groups = {ingot_lump = 1},
})
minetest.register_craftitem("default:diamond", {
@ -58,37 +50,27 @@ minetest.register_craftitem("default:diamond", {
minetest.register_craftitem("default:clay_lump", {
description = "Clay Lump",
stack_max = 200,
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_clay_lump.png",
})
minetest.register_craftitem("default:steel_ingot", {
description = "Steel Ingot",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_steel_ingot.png",
groups = {ingot = 1},
})
minetest.register_craftitem("default:copper_ingot", {
description = "Copper Ingot",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_copper_ingot.png",
groups = {ingot = 1},
})
minetest.register_craftitem("default:bronze_ingot", {
description = "Bronze Ingot",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_bronze_ingot.png",
groups = {ingot = 1},
})
minetest.register_craftitem("default:gold_ingot", {
description = "Gold Ingot",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_gold_ingot.png",
groups = {ingot = 1},
inventory_image = "default_gold_ingot.png"
})
minetest.register_craftitem("default:mese_crystal_fragment", {
@ -98,15 +80,9 @@ minetest.register_craftitem("default:mese_crystal_fragment", {
minetest.register_craftitem("default:clay_brick", {
description = "Clay Brick",
wield_scale = {x = 1, y = 1, z = 2},
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",

View File

@ -7,40 +7,20 @@
function default.node_sound_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_hard_footstep", gain = 0.6}
table.dig = table.dig or
{name = "default_hard_footstep", gain = 0.7}
{name="", gain=1.0}
table.dug = table.dug or
{name = "default_hard_footstep", gain = 0.8}
{name="default_dug_node", gain=0.25}
table.place = table.place or
{name = "default_hard_footstep", gain = 0.8}
{name="default_place_node_hard", gain=1.0}
return table
end
function default.node_sound_stone_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_hard_footstep", gain = 0.6}
table.dig = table.dig or
{name = "default_hard_footstep", gain = 0.7}
{name="default_hard_footstep", gain=0.5}
table.dug = table.dug or
{name = "default_hard_footstep", gain = 0.8}
table.place = table.place or
{name = "default_hard_footstep", gain = 0.8}
default.node_sound_defaults(table)
return table
end
function default.node_sound_metal_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_metal_footstep", gain = 0.575}
table.dig = table.dig or
{name = "default_metal_footstep", gain = 0.65}
table.dug = table.dug or
{name = "default_metal_footstep", gain = 0.8}
table.place = table.place or
{name = "default_metal_footstep", gain = 0.8}
{name="default_hard_footstep", gain=1.0}
default.node_sound_defaults(table)
return table
end
@ -48,27 +28,11 @@ end
function default.node_sound_dirt_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_dirt_footstep", gain = 0.8}
table.dig = table.dig or
{name = "default_dirt_footstep", gain = 0.9}
{name="default_dirt_footstep", gain=1.0}
table.dug = table.dug or
{name = "default_dirt_footstep", gain = 1.0}
{name="default_dirt_footstep", gain=1.5}
table.place = table.place or
{name = "default_dirt_footstep", gain = 1.0}
default.node_sound_defaults(table)
return table
end
function default.node_sound_gravel_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_dirt_footstep", gain = 0.8}
table.dig = table.dig or
{name = "default_dirt_footstep", gain = 0.9}
table.dug = table.dug or
{name = "default_dirt_footstep", gain = 1.0}
table.place = table.place or
{name = "default_dirt_footstep", gain = 1.0}
{name="default_place_node", gain=1.0}
default.node_sound_defaults(table)
return table
end
@ -76,13 +40,11 @@ end
function default.node_sound_sand_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_sand_footstep", gain = 0.6}
table.dig = table.dig or
{name = "default_sand_footstep", gain = 0.7}
{name="default_sand_footstep", gain=0.2}
table.dug = table.dug or
{name = "default_sand_footstep", gain = 0.8}
{name="default_sand_footstep", gain=0.4}
table.place = table.place or
{name = "default_sand_footstep", gain = 0.8}
{name="default_place_node", gain=1.0}
default.node_sound_defaults(table)
return table
end
@ -90,13 +52,9 @@ end
function default.node_sound_wood_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_wood_footstep", gain = 0.625}
table.dig = table.dig or
{name = "default_wood_footstep", gain = 0.7}
{name="default_wood_footstep", gain=0.5}
table.dug = table.dug or
{name = "default_wood_footstep", gain = 0.8}
table.place = table.place or
{name = "default_wood_footstep", gain = 0.8}
{name="default_wood_footstep", gain=1.0}
default.node_sound_defaults(table)
return table
end
@ -104,13 +62,13 @@ end
function default.node_sound_leaves_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_grass_footstep", gain = 0.6}
table.dig = table.dig or
{name = "default_grass_footstep", gain = 0.7}
{name="default_grass_footstep", gain=0.35}
table.dug = table.dug or
{name = "default_snow_footstep", gain = 0.8}
{name="default_grass_footstep", gain=0.7}
table.dig = table.dig or
{name="default_dig_crumbly", gain=0.4}
table.place = table.place or
{name = "default_snow_footstep", gain = 0.8}
{name="default_place_node", gain=1.0}
default.node_sound_defaults(table)
return table
end
@ -118,28 +76,27 @@ end
function default.node_sound_glass_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_hard_footstep", gain = 0.55}
table.dig = table.dig or
{name = "default_hard_footstep", gain = 0.65}
{name="default_glass_footstep", gain=0.5}
table.dug = table.dug or
{name = "default_break_glass", gain = 0.8}
table.place = table.place or
{name = "default_hard_footstep", gain = 0.75}
{name="default_break_glass", gain=1.0}
default.node_sound_defaults(table)
return table
end
-- Legacy:
--
-- Legacy
--
function default.spawn_falling_node(p, nodename)
spawn_falling_node(p, nodename)
end
-- Horrible crap to support old code,
-- don't use this and never do what this does, it's completely wrong!
-- (more specifically, the client and the C++ code doesn't get the group).
-- Horrible crap to support old code
-- Don't use this and never do what this does, it's completely wrong!
-- (More specifically, the client and the C++ code doesn't get the group)
function default.register_falling_node(nodename, texture)
minetest.log("error", debug.traceback())
minetest.log("error", "WARNING: default.register_falling_node is deprecated.")
minetest.log('error', "WARNING: default.register_falling_node is deprecated")
if minetest.registered_nodes[nodename] then
minetest.registered_nodes[nodename].groups.falling_node = 1
end
@ -151,95 +108,43 @@ end
-- Global environment step function
function on_step(dtime)
-- print("on_step, " .. p .. ", " .. node)
-- print("on_step")
end
minetest.register_globalstep(on_step)
function on_placenode(p, node)
-- print("on_placenode, " .. p .. ", " .. node)
--print("on_placenode")
end
minetest.register_on_placenode(on_placenode)
function on_dignode(p, node)
-- print("on_dignode, " .. p .. ", " .. node)
--print("on_dignode")
end
minetest.register_on_dignode(on_dignode)
function on_punchnode(p, node)
-- print("on_punchnode, " .. p .. ", " .. node)
end
minetest.register_on_punchnode(on_punchnode)
--
-- Lava cooling
-- Lavacooling
--
local function cool_wf_vm(pos, node1, node2)
local t1 = os.clock()
local minp = vector.subtract(pos, 10)
local maxp = vector.add(pos, 10)
local manip = minetest.get_voxel_manip()
local emerged_pos1, emerged_pos2 = manip:read_from_map(minp, maxp)
local area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2})
local nodes = manip:get_data()
local stone = minetest.get_content_id(node2)
local lava = minetest.get_content_id(node1)
for i in area:iterp(minp, maxp) do
local p = area:position(i)
if nodes[i] == lava and minetest.find_node_near(p, 1, {"group:water"}) then
nodes[i] = stone
end
end
manip:set_data(nodes)
manip:write_to_map()
-- minetest.log("action", "Lava cooling happened at (" .. pos.x .. "," .. pos.y .. "," .. pos.z .. ").")
local t1 = os.clock()
manip:update_map()
-- minetest.log("action", string.format("Lava cooling updated the map after ca. %.2fs.", os.clock() - t1))
end
local del1 = 0
local count = 0
default.cool_lava_source = function(pos)
local del2 = tonumber(os.clock())
if del2-del1 < 0.1
and count > 1 then
cool_wf_vm(pos, "default:lava_source", "default:obsidian_cooled")
count = 0
else
minetest.set_node(pos, {name = "default:obsidian_cooled"})
minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.2})
if del2-del1 < 0.1 then
count = count + 1
end
end
del1 = del2
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)
local del2 = tonumber(os.clock())
if del2-del1 < 0.1
and count > 1 then
cool_wf_vm(pos, "default:lava_flowing", "default:cobble_cooled")
count = 0
else
minetest.set_node(pos, {name = "default:cobble_cooled"})
minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.2})
if del2-del1 < 0.1 then
count = count + 1
end
end
del1 = del2
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 = 2,
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)
@ -249,7 +154,7 @@ minetest.register_abm({
minetest.register_abm({
nodenames = {"default:lava_source"},
neighbors = {"group:water"},
interval = 2,
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)
@ -263,21 +168,21 @@ minetest.register_abm({
minetest.register_abm({
nodenames = {"default:cactus"},
neighbors = {"group:sand"},
interval = 30,
chance = 50,
interval = 50,
chance = 20,
action = function(pos, node)
pos.y = pos.y - 1
pos.y = pos.y-1
local name = minetest.get_node(pos).name
if minetest.get_item_group(name, "sand") ~= 0 then
pos.y = pos.y + 1
pos.y = pos.y+1
local height = 0
while minetest.get_node(pos).name == "default:cactus" and height < 4 do
height = height + 1
pos.y = pos.y + 1
height = height+1
pos.y = pos.y+1
end
if height < 4 then
if minetest.get_node(pos).name == "air" then
minetest.set_node(pos, {name = "default:cactus"})
minetest.set_node(pos, {name="default:cactus"})
end
end
end
@ -286,35 +191,35 @@ minetest.register_abm({
minetest.register_abm({
nodenames = {"default:papyrus"},
neighbors = {"default:dirt", "default:dirt_with_grass", "default:dirt_with_snow", "default:sand", "default:desert_sand"},
interval = 30,
chance = 30,
neighbors = {"default:dirt", "default:dirt_with_grass"},
interval = 50,
chance = 20,
action = function(pos, node)
pos.y = pos.y - 1
pos.y = pos.y-1
local name = minetest.get_node(pos).name
if name == "default:dirt"
or name == "default:dirt_with_grass"
or name == "default:dirt_with_snow"
or name == "default:sand"
or name == "default:desert_sand" then
if name == "default:dirt" or name == "default:dirt_with_grass" then
if minetest.find_node_near(pos, 3, {"group:water"}) == nil then
return
end
pos.y = pos.y + 1
pos.y = pos.y+1
local height = 0
while minetest.get_node(pos).name == "default:papyrus" and height < 4 do
height = height + 1
pos.y = pos.y + 1
height = height+1
pos.y = pos.y+1
end
if height < 4 then
if minetest.get_node(pos).name == "air" then
minetest.set_node(pos, {name = "default:papyrus"})
minetest.set_node(pos, {name="default:papyrus"})
end
end
end
end,
})
--
-- dig upwards
--
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}
@ -328,19 +233,6 @@ end
-- 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.
--
-- If the node is in the leafdecay_drop group then the it will always be dropped
-- as an item
if minetest.setting_getbool("leaf_decay") ~= false then -- “If not defined or set to true then”
default.leafdecay_trunk_cache = {}
default.leafdecay_enable_cache = true
-- Spread the load of finding trunks
@ -352,23 +244,30 @@ 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"},
interval = 1, -- A low interval and a high inverse chance spreads the load.
chance = 2,
-- A low interval and a high inverse chance spreads the load
interval = 2,
chance = 5,
action = function(p0, node, _, _)
-- print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")")
--print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")")
local do_preserve = false
local d = minetest.registered_nodes[node.name].groups.leafdecay
if not d or d == 0 then
-- print("not groups.leafdecay")
--print("not groups.leafdecay")
return
end
local n0 = minetest.get_node(p0)
if n0.param2 ~= 0 then
-- print("param2 ~= 0")
--print("param2 ~= 0")
return
end
local p0_hash = nil
@ -378,13 +277,13 @@ minetest.register_abm({
if trunkp then
local n = minetest.get_node(trunkp)
local reg = minetest.registered_nodes[n.name]
-- Assume ignore is a trunk, to make the thing work at the border of the active area:
-- Assume ignore is a trunk, to make the thing work at the border of the active area
if n.name == "ignore" or (reg and reg.groups.tree and reg.groups.tree ~= 0) then
-- print("Cached trunk still exists.")
--print("cached trunk still exists")
return
end
-- print("Cached trunk is invalid.")
-- Cache is invalid:
--print("cached trunk is invalid")
-- Cache is invalid
table.remove(default.leafdecay_trunk_cache, p0_hash)
end
end
@ -393,30 +292,34 @@ minetest.register_abm({
end
default.leafdecay_trunk_find_allow_accumulator =
default.leafdecay_trunk_find_allow_accumulator - 1
-- Assume ignore is a trunk, to make the thing work at the border of the active area:
-- Assume ignore is a trunk, to make the thing work at the border of the active area
local p1 = minetest.find_node_near(p0, d, {"ignore", "group:tree"})
if p1 then
do_preserve = true
if default.leafdecay_enable_cache then
-- print("Caching trunk.")
-- Cache the trunk:
--print("caching trunk")
-- Cache the trunk
default.leafdecay_trunk_cache[p0_hash] = p1
end
end
if not do_preserve then
-- Drop stuff other than the node itself:
itemstacks = minetest.get_node_drops(n0.name)
-- Drop stuff other than the node itself
local itemstacks = minetest.get_node_drops(n0.name)
for _, itemname in ipairs(itemstacks) do
if minetest.get_item_group(n0.name, "leafdecay_drop") ~= 0
or itemname ~= n0.name then
minetest.add_item(p0, itemname)
if minetest.get_item_group(n0.name, "leafdecay_drop") ~= 0 or
itemname ~= n0.name then
local p_drop = {
x = p0.x - 0.5 + math.random(),
y = p0.y - 0.5 + math.random(),
z = p0.z - 0.5 + math.random(),
}
minetest.add_item(p_drop, itemname)
end
end
-- Remove node
minetest.remove_node(p0)
-- minetest.log("action", n0.name .. " decayed at " .. minetest.pos_to_string(p0) .. ".")
nodeupdate(p0)
end
end
})
end -- Ends: if minetest.setting_getbool("leaf_decay") ~= false

View File

@ -0,0 +1,283 @@
--
-- Formspecs
--
local function active_formspec(fuel_percent, item_percent)
local formspec =
"size[8,8.5]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_name;src;2.75,0.5;1,1;]"..
"list[current_name;fuel;2.75,2.5;1,1;]"..
"image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
(100-fuel_percent)..":default_furnace_fire_fg.png]"..
"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
(item_percent)..":gui_furnace_arrow_fg.png^[transformR270]"..
"list[current_name;dst;4.75,0.96;2,2;]"..
"list[current_player;main;0,4.25;8,1;]"..
"list[current_player;main;0,5.5;8,3;8]"..
default.get_hotbar_bg(0, 4.25)
return formspec
end
local inactive_formspec =
"size[8,8.5]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_name;src;2.75,0.5;1,1;]"..
"list[current_name;fuel;2.75,2.5;1,1;]"..
"image[2.75,1.5;1,1;default_furnace_fire_bg.png]"..
"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
"list[current_name;dst;4.75,0.96;2,2;]"..
"list[current_player;main;0,4.25;8,1;]"..
"list[current_player;main;0,5.5;8,3;8]"..
default.get_hotbar_bg(0, 4.25)
--
-- Node callback functions that are the same for active and inactive furnace
--
local function can_dig(pos, player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("fuel") and inv:is_empty("dst") and inv:is_empty("src")
end
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if listname == "fuel" then
if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext", "Furnace is empty")
end
return stack:get_count()
else
return 0
end
elseif listname == "src" then
return stack:get_count()
elseif listname == "dst" then
return 0
end
end
local function allow_metadata_inventory_move(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)
return allow_metadata_inventory_put(pos, to_list, to_index, stack, player)
end
local function allow_metadata_inventory_take(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
return stack:get_count()
end
--
-- Node definitions
--
minetest.register_node("default:furnace", {
description = "Furnace",
tiles = {
"default_furnace_top.png", "default_furnace_bottom.png",
"default_furnace_side.png", "default_furnace_side.png",
"default_furnace_side.png", "default_furnace_front.png"
},
paramtype2 = "facedir",
groups = {cracky=2},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
can_dig = can_dig,
allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take,
})
minetest.register_node("default:furnace_active", {
description = "Furnace",
tiles = {
"default_furnace_top.png", "default_furnace_bottom.png",
"default_furnace_side.png", "default_furnace_side.png",
"default_furnace_side.png",
{
image = "default_furnace_front_active.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1.5
},
}
},
paramtype2 = "facedir",
light_source = 8,
drop = "default:furnace",
groups = {cracky=2, not_in_creative_inventory=1},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
can_dig = can_dig,
aallow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take,
})
--
-- ABM
--
local function swap_node(pos, name)
local node = minetest.get_node(pos)
if node.name == name then
return
end
node.name = name
minetest.swap_node(pos, node)
end
minetest.register_abm({
nodenames = {"default:furnace", "default:furnace_active"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
--
-- Inizialize metadata
--
local meta = minetest.get_meta(pos)
local fuel_time = meta:get_float("fuel_time") or 0
local src_time = meta:get_float("src_time") or 0
local fuel_totaltime = meta:get_float("fuel_totaltime") or 0
--
-- Inizialize inventory
--
local inv = meta:get_inventory()
for listname, size in pairs({
src = 1,
fuel = 1,
dst = 4,
}) do
if inv:get_size(listname) ~= size then
inv:set_size(listname, size)
end
end
local srclist = inv:get_list("src")
local fuellist = inv:get_list("fuel")
local dstlist = inv:get_list("dst")
--
-- Cooking
--
-- Check if we have cookable content
local cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
local cookable = true
if cooked.time == 0 then
cookable = false
end
-- Check if we have enough fuel to burn
if fuel_time < fuel_totaltime then
-- The furnace is currently active and has enough fuel
fuel_time = fuel_time + 1
-- If there is a cookable item then check if it is ready yet
if cookable then
src_time = src_time + 1
if src_time >= cooked.time then
-- Place result in dst list if possible
if inv:room_for_item("dst", cooked.item) then
inv:add_item("dst", cooked.item)
inv:set_stack("src", 1, aftercooked.items[1])
src_time = 0
end
end
end
else
-- Furnace ran out of fuel
if cookable then
-- We need to get new fuel
local fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
if fuel.time == 0 then
-- No valid fuel in fuel list
fuel_totaltime = 0
fuel_time = 0
src_time = 0
else
-- Take fuel from fuel list
inv:set_stack("fuel", 1, afterfuel.items[1])
fuel_totaltime = fuel.time
fuel_time = 0
end
else
-- We don't need to get new fuel since there is no cookable item
fuel_totaltime = 0
fuel_time = 0
src_time = 0
end
end
--
-- Update formspec, infotext and node
--
local formspec = inactive_formspec
local item_state = ""
local item_percent = 0
if cookable then
item_percent = math.floor(src_time / cooked.time * 100)
item_state = item_percent .. "%"
else
if srclist[1]:is_empty() then
item_state = "Empty"
else
item_state = "Not cookable"
end
end
local fuel_state = "Empty"
local active = "inactive "
if fuel_time <= fuel_totaltime and fuel_totaltime ~= 0 then
active = "active "
local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100)
fuel_state = fuel_percent .. "%"
formspec = active_formspec(fuel_percent, item_percent)
swap_node(pos, "default:furnace_active")
else
if not fuellist[1]:is_empty() then
fuel_state = "0%"
end
swap_node(pos, "default:furnace")
end
local infotext = "Furnace " .. active .. "(Item: " .. item_state .. "; Fuel: " .. fuel_state .. ")"
--
-- Set meta values
--
meta:set_float("fuel_totaltime", fuel_totaltime)
meta:set_float("fuel_time", fuel_time)
meta:set_float("src_time", src_time)
meta:set_string("formspec", formspec)
meta:set_string("infotext", infotext)
end,
})

View File

@ -1,39 +1,44 @@
-- Minetest 0.4 mod: default
-- See README.txt for licensing and other information.
default = {} -- Definitions made by this mod are usable by all mods.
-- The API documentation in here was moved into doc/lua_api.txt.
-- The API documentation in here was moved into doc/lua_api.txt
WATER_ALPHA = 160
WATER_VISC = 1
LAVA_VISC = 3 -- Slower movement in lava.
LIGHT_MAX = 14 -- 15 is reserved for sunlight.
LAVA_VISC = 7
LIGHT_MAX = 14
-- GUI related stuff:
-- Definitions made by this mod that other mods can use too
default = {}
gui_slots = "listcolors[#606060AA;#808080;#101010;#202020;#FFF]"
-- GUI related stuff
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)
local out = ""
for i= 0, 7, 1 do
out = out .."image[" .. x + i .. "," .. y .. ";1,1;gui_hb_bg.png]"
for i=0,7,1 do
out = out .."image["..x+i..","..y..";1,1;gui_hb_bg.png]"
end
return out
end
gui_suvival_form = "size[8,8.5]"..
gui_slots ..
"list[current_player;main; 0, 4.25; 8, 4; ]" ..
"list[current_player;craft; 1.75, 0.5; 3, 3; ]" ..
"list[current_player;craftpreview; 5.75, 1.5; 1, 1; ]" ..
default.get_hotbar_bg(0, 4.25) ..
default.get_hotbar_bg(0, 5.25)
default.gui_suvival_form = "size[8,8.5]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_player;main;0,4.25;8,1;]"..
"list[current_player;main;0,5.5;8,3;8]"..
"list[current_player;craft;1.75,0.5;3,3;]"..
"list[current_player;craftpreview;5.75,1.5;1,1;]"..
"image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
default.get_hotbar_bg(0,4.25)
-- Load files:
-- Load files
dofile(minetest.get_modpath("default").."/functions.lua")
dofile(minetest.get_modpath("default").."/commands.lua")
dofile(minetest.get_modpath("default").."/nodes.lua")
dofile(minetest.get_modpath("default").."/furnace.lua")
dofile(minetest.get_modpath("default").."/tools.lua")
dofile(minetest.get_modpath("default").."/craftitems.lua")
dofile(minetest.get_modpath("default").."/crafting.lua")
@ -41,102 +46,3 @@ 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").."/aliases.lua")
-- Code below by Casimir.
local function count_items()
local i = 0
local number = 0
for name, item in pairs(minetest.registered_items) do
if (name and name ~= "") then
number = number + 1
end
i = i + 1
end
minetest.log("action", "There are " .. number .. " registered nodes, items and tools.")
end
local function player_join_sounds()
minetest.register_on_joinplayer(function()
minetest.sound_play("player_join", {gain = 0.75})
end)
end
local function player_leave_sounds()
minetest.register_on_leaveplayer(function()
minetest.sound_play("player_leave", {gain = 1})
end)
end
minetest.after(1, count_items)
minetest.after(5, player_join_sounds)
minetest.after(5, player_leave_sounds)
hotbar_size = minetest.setting_get("hotbar_size") or 16
minetest.register_on_joinplayer(function(player)
player:set_physics_override({
sneak_glitch = false, -- Climable blocks are quite fast in Carbone.
})
player:hud_set_hotbar_itemcount(hotbar_size)
end)
minetest.register_on_respawnplayer(function(player)
player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
local pos = player:getpos()
-- minetest.sound_play("player_join", {pos = pos, gain = 0.5})
end)
minetest.register_on_item_eat(function(hp_change, replace_with_item, itemstack, user, pointed_thing)
if user:get_hp() >= 20 then return itemstack end
local pos = user:getpos()
minetest.sound_play("health_gain", {pos = pos, gain = 0.4})
end)
minetest.log("action", "") -- Empty line.
minetest.log("action", "") -- Empty line.
if minetest.setting_getbool("creative_mode") then
minetest.log("action", "Creative mode is enabled.")
else
minetest.log("action", "Creative mode is disabled.")
end
if minetest.setting_getbool("enable_damage") then
minetest.log("action", "Damage is enabled.")
else
minetest.log("action", "Damage is disabled.")
end
if minetest.setting_getbool("enable_pvp") then
minetest.log("action", "PvP is enabled.")
else
minetest.log("action", "PvP is disabled.")
end
if not minetest.is_singleplayer() and minetest.setting_getbool("server_announce") then
minetest.log("action", "") -- Empty line.
minetest.log("action", "Server name: " .. minetest.setting_get("server_name") or "(none)")
minetest.log("action", "Server description: " .. minetest.setting_get("server_description") or "(none)")
minetest.log("action", "Server URL: " .. minetest.setting_get("server_address") or "(none)")
minetest.log("action", "MOTD: " .. minetest.setting_get("motd") or "(none)")
minetest.log("action", "Maximum users: " .. minetest.setting_get("max_users") or 15)
end
minetest.log("action", "") -- Empty line.
minetest.log("action", "") -- Empty line.
-- Reserved slot handling:
minetest.register_on_prejoinplayer(function(name, ip)
if #minetest.get_connected_players() >= (minetest.setting_get("max_users") - 2)
and not minetest.check_player_privs(name, {server = true}) then
return "Sorry, 2 slots are reserved for administrators."
end
end)
if minetest.setting_getbool("log_mods") then
-- Highlight the default mod in the mod loading logs:
minetest.log("action", "Carbone: * [default] loaded.")
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -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
@ -65,15 +16,17 @@ end
-- Default player appearance
default.player_register_model("character.x", {
animation_speed = 35,
animation_speed = 30,
textures = {"character.png", },
animations = {
stand = {x = 0, y = 40},
lay = {x = 162, y = 166},
walk = {x = 168, y = 187},
mine = {x = 189, y = 198},
walk_mine = {x = 200, y = 219},
sit = {x = 81, y = 160},
-- Standard animations.
stand = { x= 0, y= 79, },
lay = { x=162, y=166, },
walk = { x=168, y=187, },
mine = { x=189, y=198, },
walk_mine = { x=200, y=219, },
-- Extra animations (not currently used by the game).
sit = { x= 81, y=160, },
},
})
@ -93,7 +46,7 @@ function default.player_get_animation(player)
}
end
-- Called when a player"s appearance needs to be updated
-- Called when a player's appearance needs to be updated
function default.player_set_model(player, model_name)
local name = player:get_player_name()
local model = models[model_name]
@ -105,7 +58,7 @@ function default.player_set_model(player, model_name)
mesh = model_name,
textures = player_textures[name] or model.textures,
visual = "mesh",
visual_size = model.visual_size or {x = 1, y = 1},
visual_size = model.visual_size or {x=1, y=1},
})
default.player_set_animation(player, "stand")
else
@ -141,18 +94,14 @@ end
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 = 40}, {x = 168, y = 187}, {x = 189, y = 198}, {x = 200, y = 219}, 35)
player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
-- set GUI
if minetest.setting_getbool("creative_mode") then
-- creative.set_creative_formspec(player, 0, 1)
else
player:set_inventory_formspec(gui_suvival_form)
if not minetest.setting_getbool("creative_mode") then
player:set_inventory_formspec(default.gui_suvival_form)
end
minetest.after(0.5,function()
player:hud_set_hotbar_image("gui_hotbar.png")
player:hud_set_hotbar_selected_image("gui_hotbar_selected.png")
end)
end)
minetest.register_on_leaveplayer(function(player)
@ -164,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)
@ -171,10 +121,10 @@ 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 and not default.player_attached[name] 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 35
local animation_speed_mod = model.animation_speed or 30
-- Determine if the player is walking
if controls.up or controls.down or controls.left or controls.right then
@ -183,27 +133,26 @@ minetest.register_globalstep(function(dtime)
-- Determine if the player is sneaking, and reduce animation speed if so
if controls.sneak then
animation_speed_mod = animation_speed_mod * 0.5
animation_speed_mod = animation_speed_mod / 2
end
-- Apply animations based on what the player is doing
if player:get_hp() == 0 then
player_set_animation(player, "lay", animation_speed_mod)
player:set_eye_offset({x = 0, y = -10, z = 0}, {x = 0, y = -10, z = 0})
player_set_animation(player, "lay")
elseif walking then
if player_sneak[name] ~= controls.sneak then
player_anim[name] = nil
player_sneak[name] = controls.sneak
end
if controls.LMB or controls.RMB then
if controls.LMB then
player_set_animation(player, "walk_mine", animation_speed_mod)
else
player_set_animation(player, "walk", animation_speed_mod)
end
elseif controls.LMB or controls.RMB then
player_set_animation(player, "mine", animation_speed_mod)
elseif controls.LMB then
player_set_animation(player, "mine")
else
player_set_animation(player, "stand", animation_speed_mod * 0.4)
player_set_animation(player, "stand", animation_speed_mod)
end
end
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 692 B

After

Width:  |  Height:  |  Size: 859 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 794 B

After

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 667 B

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 802 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 315 B

After

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 B

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 B

After

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -4,16 +4,16 @@
minetest.register_item(":", {
type = "none",
wield_image = "wieldhand.png",
range = 5,
wield_scale = {x=1,y=1,z=2.5},
tool_capabilities = {
full_punch_interval = 0.8,
full_punch_interval = 0.9,
max_drop_level = 0,
groupcaps = {
crumbly = {times = {[2] = 2.75, [3] = 0.65}, uses = 0, maxlevel = 1},
snappy = {times = {[3] = 0.25}, uses = 0, maxlevel = 1},
oddly_breakable_by_hand = {times = {[1] = 3.50, [2] = 2.00, [3] = 0.65}, uses = 0}
crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1},
snappy = {times={[3]=0.40}, uses=0, maxlevel=1},
oddly_breakable_by_hand = {times={[1]=3.50,[2]=2.00,[3]=0.70}, uses=0}
},
damage_groups = {fleshy = 2},
damage_groups = {fleshy=1},
}
})
@ -26,89 +26,47 @@ minetest.register_tool("default:pick_wood", {
inventory_image = "default_tool_woodpick.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 0,
groupcaps = {
cracky = {times = {[1] = 6.5, [2] = 2.0, [3] = 1.2}, uses = 20, maxlevel = 1},
max_drop_level=0,
groupcaps={
cracky = {times={[3]=1.60}, uses=10, maxlevel=1},
},
damage_groups = {fleshy = 3},
damage_groups = {fleshy=2},
},
})
minetest.register_tool("default:pick_stone", {
description = "Stone Pickaxe",
inventory_image = "default_tool_stonepick.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 0,
groupcaps = {
cracky = {times = {[1] = 5.5, [2] = 1.6, [3] = 0.9}, uses = 20, maxlevel = 1},
crumbly = {times = {[1] = 2.6, [2] = 1.4, [3] = 0.44}, uses = 20, maxlevel = 1},
full_punch_interval = 1.3,
max_drop_level=0,
groupcaps={
cracky = {times={[2]=2.0, [3]=1.20}, uses=20, maxlevel=1},
},
damage_groups = {fleshy = 3},
damage_groups = {fleshy=3},
},
})
minetest.register_tool("default:pick_steel", {
description = "Steel Pickaxe",
inventory_image = "default_tool_steelpick.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 1,
groupcaps = {
cracky = {times = {[1] = 4.0, [2] = 1.3, [3] = 0.85}, uses = 20, maxlevel = 2},
crumbly = {times = {[1] = 2.4, [2] = 1.2, [3] = 0.39}, uses = 20, maxlevel = 1},
full_punch_interval = 1.0,
max_drop_level=1,
groupcaps={
cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=20, maxlevel=2},
},
damage_groups = {fleshy = 4},
damage_groups = {fleshy=4},
},
})
minetest.register_tool("default:pick_bronze", {
description = "Bronze Pickaxe",
inventory_image = "default_tool_bronzepick.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 1,
groupcaps = {
cracky = {times = {[1] = 4.0, [2] = 1.3, [3] = 0.85}, uses = 30, maxlevel = 2},
crumbly = {times = {[1] = 2.4, [2] = 1.2, [3] = 0.39}, uses = 30, maxlevel = 1},
full_punch_interval = 1.0,
max_drop_level=1,
groupcaps={
cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=30, maxlevel=2},
},
damage_groups = {fleshy = 4},
},
})
minetest.register_tool("default:pick_gold", {
description = "Golden Pickaxe",
inventory_image = "default_tool_goldpick.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 3,
groupcaps = {
cracky = {times = {[1] = 2.4, [2] = 1.0, [3] = 0.65}, uses = 5, maxlevel = 3},
crumbly = {times = {[1] = 2.0, [2] = 0.9, [3] = 0.36}, uses = 5, maxlevel = 2},
},
damage_groups = {fleshy = 5},
},
})
minetest.register_tool("default:pick_diamond", {
description = "Diamond Pickaxe",
inventory_image = "default_tool_diamondpick.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 3,
groupcaps = {
cracky = {times = {[1] = 2.4, [2] = 1.0, [3] = 0.65}, uses = 25, maxlevel = 3},
crumbly = {times = {[1] = 2.0, [2] = 0.9, [3] = 0.36}, uses = 25, maxlevel = 2},
},
damage_groups = {fleshy = 5},
},
})
minetest.register_tool("default:pick_nyan", {
description = "Nyan Pickaxe",
inventory_image = "default_tool_nyanpick.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 3,
groupcaps = {
cracky = {times = {[1] = 2.4, [2] = 1.0, [3] = 0.65}, uses = 75, maxlevel = 3},
crumbly = {times = {[1] = 2.0, [2] = 0.9, [3] = 0.36}, uses = 75, maxlevel = 2},
},
damage_groups = {fleshy = 5},
damage_groups = {fleshy=4},
},
})
minetest.register_tool("default:pick_mese", {
@ -116,12 +74,23 @@ minetest.register_tool("default:pick_mese", {
inventory_image = "default_tool_mesepick.png",
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level = 3,
groupcaps = {
cracky = {times = {[1] = 1.8, [2] = 0.75, [3] = 0.45}, uses = 15, maxlevel = 3},
crumbly = {times = {[1] = 1.65, [2] = 0.6, [3] = 0.32}, uses = 15, maxlevel = 3},
max_drop_level=3,
groupcaps={
cracky = {times={[1]=2.4, [2]=1.2, [3]=0.60}, uses=20, maxlevel=3},
},
damage_groups = {fleshy = 5},
damage_groups = {fleshy=5},
},
})
minetest.register_tool("default:pick_diamond", {
description = "Diamond Pickaxe",
inventory_image = "default_tool_diamondpick.png",
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level=3,
groupcaps={
cracky = {times={[1]=2.0, [2]=1.0, [3]=0.50}, uses=30, maxlevel=3},
},
damage_groups = {fleshy=5},
},
})
@ -135,11 +104,11 @@ minetest.register_tool("default:shovel_wood", {
wield_image = "default_tool_woodshovel.png^[transformR90",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 0,
groupcaps = {
crumbly = {times = {[1] = 2.6, [2] = 1.4, [3] = 0.44}, uses = 20, maxlevel = 1},
max_drop_level=0,
groupcaps={
crumbly = {times={[1]=3.00, [2]=1.60, [3]=0.60}, uses=10, maxlevel=1},
},
damage_groups = {fleshy = 2},
damage_groups = {fleshy=2},
},
})
minetest.register_tool("default:shovel_stone", {
@ -147,12 +116,12 @@ minetest.register_tool("default:shovel_stone", {
inventory_image = "default_tool_stoneshovel.png",
wield_image = "default_tool_stoneshovel.png^[transformR90",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 0,
groupcaps = {
crumbly = {times = {[1] = 2.4, [2] = 1.2, [3] = 0.39}, uses = 20, maxlevel = 1},
full_punch_interval = 1.4,
max_drop_level=0,
groupcaps={
crumbly = {times={[1]=1.80, [2]=1.20, [3]=0.50}, uses=20, maxlevel=1},
},
damage_groups = {fleshy = 3},
damage_groups = {fleshy=2},
},
})
minetest.register_tool("default:shovel_steel", {
@ -160,12 +129,12 @@ minetest.register_tool("default:shovel_steel", {
inventory_image = "default_tool_steelshovel.png",
wield_image = "default_tool_steelshovel.png^[transformR90",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 1,
groupcaps = {
crumbly = {times = {[1] = 2.0, [2] = 0.9, [3] = 0.36}, uses = 30, maxlevel = 2},
full_punch_interval = 1.1,
max_drop_level=1,
groupcaps={
crumbly = {times={[1]=1.50, [2]=0.90, [3]=0.40}, uses=30, maxlevel=2},
},
damage_groups = {fleshy = 3},
damage_groups = {fleshy=3},
},
})
minetest.register_tool("default:shovel_bronze", {
@ -173,51 +142,12 @@ minetest.register_tool("default:shovel_bronze", {
inventory_image = "default_tool_bronzeshovel.png",
wield_image = "default_tool_bronzeshovel.png^[transformR90",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 1,
groupcaps = {
crumbly = {times = {[1] = 2.0, [2] = 0.9, [3] = 0.36}, uses = 40, maxlevel = 2},
full_punch_interval = 1.1,
max_drop_level=1,
groupcaps={
crumbly = {times={[1]=1.50, [2]=0.90, [3]=0.40}, uses=40, maxlevel=2},
},
damage_groups = {fleshy = 3},
},
})
minetest.register_tool("default:shovel_gold", {
description = "Golden Shovel",
inventory_image = "default_tool_goldshovel.png",
wield_image = "default_tool_goldshovel.png^[transformR90",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 1,
groupcaps = {
crumbly = {times = {[1] = 1.65, [2] = 0.6, [3] = 0.32}, uses = 5, maxlevel = 3},
},
damage_groups = {fleshy = 4},
},
})
minetest.register_tool("default:shovel_diamond", {
description = "Diamond Shovel",
inventory_image = "default_tool_diamondshovel.png",
wield_image = "default_tool_diamondshovel.png^[transformR90",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 1,
groupcaps = {
crumbly = {times = {[1] = 1.65, [2] = 0.6, [3] = 0.32}, uses = 25, maxlevel = 3},
},
damage_groups = {fleshy = 4},
},
})
minetest.register_tool("default:shovel_nyan", {
description = "Nyan Shovel",
inventory_image = "default_tool_nyanshovel.png",
wield_image = "default_tool_nyanshovel.png^[transformR90",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 1,
groupcaps = {
crumbly = {times = {[1] = 1.65, [2] = 0.6, [3] = 0.32}, uses = 75, maxlevel = 3},
},
damage_groups = {fleshy = 4},
damage_groups = {fleshy=3},
},
})
minetest.register_tool("default:shovel_mese", {
@ -225,12 +155,25 @@ minetest.register_tool("default:shovel_mese", {
inventory_image = "default_tool_meseshovel.png",
wield_image = "default_tool_meseshovel.png^[transformR90",
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level = 3,
groupcaps = {
crumbly = {times = {[1] = 1.25, [2] = 0.45, [3] = 0.26}, uses = 15, maxlevel = 3},
full_punch_interval = 1.0,
max_drop_level=3,
groupcaps={
crumbly = {times={[1]=1.20, [2]=0.60, [3]=0.30}, uses=20, maxlevel=3},
},
damage_groups = {fleshy = 4},
damage_groups = {fleshy=4},
},
})
minetest.register_tool("default:shovel_diamond", {
description = "Diamond Shovel",
inventory_image = "default_tool_diamondshovel.png",
wield_image = "default_tool_diamondshovel.png^[transformR90",
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=1,
groupcaps={
crumbly = {times={[1]=1.10, [2]=0.50, [3]=0.30}, uses=30, maxlevel=3},
},
damage_groups = {fleshy=4},
},
})
@ -242,13 +185,12 @@ minetest.register_tool("default:axe_wood", {
description = "Wooden Axe",
inventory_image = "default_tool_woodaxe.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 0,
groupcaps = {
choppy = {times = {[2] = 2.0, [3] = 1.3}, uses = 20, maxlevel = 1},
snappy = {times = {[3] = 0.2}, uses = 0, maxlevel = 1},
full_punch_interval = 1.0,
max_drop_level=0,
groupcaps={
choppy = {times={[2]=3.00, [3]=2.00}, uses=10, maxlevel=1},
},
damage_groups = {fleshy = 3},
damage_groups = {fleshy=2},
},
})
minetest.register_tool("default:axe_stone", {
@ -256,77 +198,35 @@ minetest.register_tool("default:axe_stone", {
inventory_image = "default_tool_stoneaxe.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 0,
groupcaps = {
choppy = {times = {[1] = 3.0, [2] = 1.6, [3] = 1.1}, uses = 20, maxlevel = 1},
snappy = {times = {[3] = 0.175}, uses = 0, maxlevel = 1},
max_drop_level=0,
groupcaps={
choppy={times={[1]=3.00, [2]=2.00, [3]=1.50}, uses=20, maxlevel=1},
},
damage_groups = {fleshy = 4},
damage_groups = {fleshy=3},
},
})
minetest.register_tool("default:axe_steel", {
description = "Steel Axe",
inventory_image = "default_tool_steelaxe.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 1,
groupcaps = {
choppy = {times = {[1] = 2.5, [2] = 1.3, [3] = 0.9}, uses = 20, maxlevel = 2},
snappy = {times = {[3] = 0.15}, uses = 0, maxlevel = 1},
full_punch_interval = 1.0,
max_drop_level=1,
groupcaps={
choppy={times={[1]=2.50, [2]=1.40, [3]=1.00}, uses=20, maxlevel=2},
},
damage_groups = {fleshy = 5},
damage_groups = {fleshy=4},
},
})
minetest.register_tool("default:axe_bronze", {
description = "Bronze Axe",
inventory_image = "default_tool_bronzeaxe.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 1,
groupcaps = {
choppy = {times = {[1] = 2.5, [2] = 1.3, [3] = 0.9}, uses = 30, maxlevel = 2},
snappy = {times = {[3] = 0.15}, uses = 0, maxlevel = 1},
full_punch_interval = 1.0,
max_drop_level=1,
groupcaps={
choppy={times={[1]=2.50, [2]=1.40, [3]=1.00}, uses=30, maxlevel=2},
},
damage_groups = {fleshy = 5},
},
})
minetest.register_tool("default:axe_gold", {
description = "Golden Axe",
inventory_image = "default_tool_goldaxe.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 1,
groupcaps = {
choppy = {times = {[1] = 2.2, [2] = 1.0, [3] = 0.55}, uses = 5, maxlevel = 3},
snappy = {times = {[3] = 0.125}, uses = 0, maxlevel = 1},
},
damage_groups = {fleshy = 6},
},
})
minetest.register_tool("default:axe_diamond", {
description = "Diamond Axe",
inventory_image = "default_tool_diamondaxe.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 1,
groupcaps = {
choppy = {times = {[1] = 2.2, [2] = 1.0, [3] = 0.55}, uses = 25, maxlevel = 3},
snappy = {times = {[3] = 0.125}, uses = 0, maxlevel = 1},
},
damage_groups = {fleshy = 6},
},
})
minetest.register_tool("default:axe_nyan", {
description = "Nyan Axe",
inventory_image = "default_tool_nyanaxe.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 1,
groupcaps = {
choppy = {times = {[1] = 2.2, [2] = 1.0, [3] = 0.55}, uses = 75, maxlevel = 3},
snappy = {times = {[3] = 0.125}, uses = 0, maxlevel = 1},
},
damage_groups = {fleshy = 6},
damage_groups = {fleshy=4},
},
})
minetest.register_tool("default:axe_mese", {
@ -334,12 +234,23 @@ minetest.register_tool("default:axe_mese", {
inventory_image = "default_tool_meseaxe.png",
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level = 1,
groupcaps = {
choppy = {times = {[1] = 1.5, [2] = 0.75, [3] = 0.4}, uses = 15, maxlevel = 3},
snappy = {times = {[3] = 0.1}, uses = 0, maxlevel = 1},
max_drop_level=1,
groupcaps={
choppy={times={[1]=2.20, [2]=1.00, [3]=0.60}, uses=20, maxlevel=3},
},
damage_groups = {fleshy = 6},
damage_groups = {fleshy=6},
},
})
minetest.register_tool("default:axe_diamond", {
description = "Diamond Axe",
inventory_image = "default_tool_diamondaxe.png",
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level=1,
groupcaps={
choppy={times={[1]=2.10, [2]=0.90, [3]=0.50}, uses=30, maxlevel=2},
},
damage_groups = {fleshy=7},
},
})
@ -351,95 +262,71 @@ minetest.register_tool("default:sword_wood", {
description = "Wooden Sword",
inventory_image = "default_tool_woodsword.png",
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level = 0,
groupcaps = {
snappy = {times = {[2] = 1.4, [3] = 0.2}, uses = 20, maxlevel = 1},
full_punch_interval = 1,
max_drop_level=0,
groupcaps={
snappy={times={[2]=1.6, [3]=0.40}, uses=10, maxlevel=1},
},
damage_groups = {fleshy = 3},
damage_groups = {fleshy=2},
}
})
minetest.register_tool("default:sword_stone", {
description = "Stone Sword",
inventory_image = "default_tool_stonesword.png",
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level = 0,
groupcaps = {
snappy = {times = {[2] = 1.2, [3] = 0.175}, uses = 20, maxlevel = 1},
full_punch_interval = 1.2,
max_drop_level=0,
groupcaps={
snappy={times={[2]=1.4, [3]=0.40}, uses=20, maxlevel=1},
},
damage_groups = {fleshy = 4},
damage_groups = {fleshy=4},
}
})
minetest.register_tool("default:sword_steel", {
description = "Steel Sword",
inventory_image = "default_tool_steelsword.png",
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level = 1,
groupcaps = {
snappy = {times = {[1] = 2.2, [2] = 1.2, [3] = 0.15}, uses = 30, maxlevel = 2},
full_punch_interval = 0.8,
max_drop_level=1,
groupcaps={
snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, uses=30, maxlevel=2},
},
damage_groups = {fleshy = 5},
damage_groups = {fleshy=6},
}
})
minetest.register_tool("default:sword_bronze", {
description = "Bronze Sword",
inventory_image = "default_tool_bronzesword.png",
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level = 1,
groupcaps = {
snappy = {times = {[1] = 2.2, [2] = 1.2, [3] = 0.15}, uses = 40, maxlevel = 2},
full_punch_interval = 0.8,
max_drop_level=1,
groupcaps={
snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, uses=40, maxlevel=2},
},
damage_groups = {fleshy = 5},
}
})
minetest.register_tool("default:sword_gold", {
description = "Golden Sword",
inventory_image = "default_tool_goldsword.png",
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level = 1,
groupcaps = {
snappy = {times = {[1] = 1.9, [2] = 0.85, [3] = 0.125}, uses = 5, maxlevel = 3},
},
damage_groups = {fleshy = 6},
}
})
minetest.register_tool("default:sword_diamond", {
description = "Diamond Sword",
inventory_image = "default_tool_diamondsword.png",
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level = 1,
groupcaps = {
snappy = {times = {[1] = 1.9, [2] = 0.85, [3] = 0.125}, uses = 25, maxlevel = 3},
},
damage_groups = {fleshy = 6},
}
})
minetest.register_tool("default:sword_nyan", {
description = "Nyan Sword",
inventory_image = "default_tool_nyansword.png",
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level = 1,
groupcaps = {
snappy = {times = {[1] = 1.9, [2] = 0.85, [3] = 0.125}, uses = 75, maxlevel = 3},
},
damage_groups = {fleshy = 6},
damage_groups = {fleshy=6},
}
})
minetest.register_tool("default:sword_mese", {
description = "Mese Sword",
inventory_image = "default_tool_mesesword.png",
tool_capabilities = {
full_punch_interval = 0.675,
max_drop_level = 1,
groupcaps = {
snappy = {times = {[1] = 1.5, [2] = 0.7, [3] = 0.1}, uses = 15, maxlevel = 3},
full_punch_interval = 0.7,
max_drop_level=1,
groupcaps={
snappy={times={[1]=2.0, [2]=1.00, [3]=0.35}, uses=30, maxlevel=3},
},
damage_groups = {fleshy = 6},
damage_groups = {fleshy=7},
}
})
minetest.register_tool("default:sword_diamond", {
description = "Diamond Sword",
inventory_image = "default_tool_diamondsword.png",
tool_capabilities = {
full_punch_interval = 0.7,
max_drop_level=1,
groupcaps={
snappy={times={[1]=1.90, [2]=0.90, [3]=0.30}, uses=40, maxlevel=3},
},
damage_groups = {fleshy=8},
}
})

View File

@ -180,3 +180,4 @@ function default.grow_jungletree(pos, bad)
vm:write_to_map()
vm:update_map()
end

View File

@ -13,21 +13,11 @@ doors = {}
-- node_box_top
-- selection_box_bottom
-- selection_box_top
-- only_placer_can_open: if true only the player who placed the door can open it
-- only_placer_can_open: if true only the player who placed the door can
-- open it
local function is_right(pos)
local r1 = minetest.get_node({x = pos.x-1, y = pos.y, z = pos.z})
local r2 = minetest.get_node({x = pos.x, y = pos.y, z = pos.z-1})
if string.find(r1.name, "door_") or string.find(r2.name, "door_") then
if string.find(r1.name, "_1") or string.find(r2.name, "_1") then
return true
else
return false
end
end
end
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}}
@ -45,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,
@ -61,7 +59,7 @@ function doors:register_door(name, def)
end
local pt = pointed_thing.above
local pt2 = {x = pt.x, y = pt.y, z = pt.z}
local pt2 = {x=pt.x, y=pt.y, z=pt.z}
pt2.y = pt2.y+1
if
not minetest.registered_nodes[minetest.get_node(pt).name].buildable_to or
@ -79,7 +77,7 @@ function doors:register_door(name, def)
end
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
local pt3 = {x = pt.x, y = pt.y, z = pt.z}
local pt3 = {x=pt.x, y=pt.y, z=pt.z}
if p2 == 0 then
pt3.x = pt3.x-1
elseif p2 == 1 then
@ -89,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
minetest.set_node(pt, {name =name.."_b_1", param2 = p2})
minetest.set_node(pt2, {name =name.."_t_1", param2 = p2})
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.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
@ -132,22 +132,22 @@ function doors:register_door(name, def)
local p2 = minetest.get_node(pos).param2
p2 = params[p2+1]
minetest.swap_node(pos, {name =replace_dir, param2 = p2})
minetest.swap_node(pos, {name=replace_dir, param2=p2})
pos.y = pos.y-dir
minetest.swap_node(pos, {name =replace, param2 = p2})
minetest.swap_node(pos, {name=replace, param2=p2})
local snd_1 = "_close"
local snd_2 = "_open"
local snd_1 = def.sound_close_door
local snd_2 = def.sound_open_door
if params[1] == 3 then
snd_1 = "_open"
snd_2 = "_close"
snd_1 = def.sound_open_door
snd_2 = def.sound_close_door
end
if is_right(pos) then
minetest.sound_play("door"..snd_1, {pos = pos, gain = 0.175, max_hear_distance = 16})
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("door"..snd_2, {pos = pos, gain = 0.175, max_hear_distance = 16})
minetest.sound_play(snd_2, {pos = pos, gain = 0.3, max_hear_distance = 10})
end
end
@ -164,7 +164,6 @@ function doors:register_door(name, def)
tiles = {tb[2], tb[2], tb[2], tb[2], tb[1], tb[1].."^[transformfx"},
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
drop = name,
drawtype = "nodebox",
node_box = {
@ -197,7 +196,6 @@ function doors:register_door(name, def)
tiles = {tt[2], tt[2], tt[2], tt[2], tt[1], tt[1].."^[transformfx"},
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
drop = "",
drawtype = "nodebox",
node_box = {
@ -230,7 +228,6 @@ function doors:register_door(name, def)
tiles = {tb[2], tb[2], tb[2], tb[2], tb[1].."^[transformfx", tb[1]},
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
drop = name,
drawtype = "nodebox",
node_box = {
@ -263,7 +260,6 @@ function doors:register_door(name, def)
tiles = {tt[2], tt[2], tt[2], tt[2], tt[1].."^[transformfx", tt[1]},
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
drop = "",
drawtype = "nodebox",
node_box = {
@ -294,10 +290,10 @@ function doors:register_door(name, def)
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},
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(),
@ -305,7 +301,7 @@ doors:register_door("doors:door_wood", {
})
minetest.register_craft({
output = "doors:door_wood 3",
output = "doors:door_wood",
recipe = {
{"group:wood", "group:wood"},
{"group:wood", "group:wood"},
@ -313,10 +309,10 @@ 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},
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,
@ -325,7 +321,7 @@ doors:register_door("doors:door_steel", {
})
minetest.register_craft({
output = "doors:door_steel 3",
output = "doors:door_steel",
recipe = {
{"default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot"},
@ -333,10 +329,10 @@ minetest.register_craft({
}
})
doors:register_door("doors:door_glass", {
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},
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(),
@ -344,7 +340,7 @@ doors:register_door("doors:door_glass", {
})
minetest.register_craft({
output = "doors:door_glass 3",
output = "doors:door_glass",
recipe = {
{"default:glass", "default:glass"},
{"default:glass", "default:glass"},
@ -352,10 +348,10 @@ minetest.register_craft({
}
})
doors:register_door("doors:door_obsidian_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},
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(),
@ -363,7 +359,7 @@ doors:register_door("doors:door_obsidian_glass", {
})
minetest.register_craft({
output = "doors:door_obsidian_glass 3",
output = "doors:door_obsidian_glass",
recipe = {
{"default:obsidian_glass", "default:obsidian_glass"},
{"default:obsidian_glass", "default:obsidian_glass"},
@ -372,7 +368,7 @@ minetest.register_craft({
})
---- Trapdoors ----
----trapdoor----
local function update_door(pos, node)
minetest.set_node(pos, node)
@ -384,15 +380,14 @@ local function punch(pos)
local me = minetest.get_node(pos)
local tmp_node
local tmp_node2
oben = {x = pos.x, y = pos.y+1, z = pos.z}
if state == 1 then
state = 0
minetest.sound_play("door_close", {pos = pos, gain = 0.175, max_hear_distance = 16})
tmp_node = {name = "doors:trapdoor", param1 = me.param1, param2 = me.param2}
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.175, max_hear_distance = 16})
tmp_node = {name = "doors:trapdoor_open", param1 = me.param1, param2 = me.param2}
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)
@ -405,8 +400,7 @@ minetest.register_node("doors:trapdoor", {
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",
sunlight_propagates = true,
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, door= 1},
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 = {
@ -430,9 +424,10 @@ minetest.register_node("doors:trapdoor_open", {
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",
sunlight_propagates = true,
pointable = true,
stack_max = 0,
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,door=1},
climbable = true,
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 = {
@ -449,14 +444,10 @@ minetest.register_node("doors:trapdoor_open", {
})
minetest.register_craft({
output = "doors:trapdoor 6",
output = 'doors:trapdoor 2',
recipe = {
{"group:wood", "group:wood", "group:wood"},
{"group:wood", "group:wood", "group:wood"},
{"", "", ""},
{'group:wood', 'group:wood', 'group:wood'},
{'group:wood', 'group:wood', 'group:wood'},
{'', '', ''},
}
})
if minetest.setting_getbool("log_mods") then
minetest.log("action", "Carbone: [doors] loaded.")
end

View File

@ -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 = {}
@ -138,8 +85,3 @@ for one,results in pairs(dyelocal.mixes) do
})
end
end
-- Hide dyelocal
dyelocal = nil
-- EOF

View File

@ -1,5 +1,7 @@
-- minetest/fire/init.lua
fire = {}
minetest.register_node("fire:basic_flame", {
description = "Fire",
drawtype = "firelike",
@ -9,22 +11,21 @@ minetest.register_node("fire:basic_flame", {
}},
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,
})

View File

@ -288,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())