forked from VoxeLibre/VoxeLibre
Compare commits
103 Commits
chat-comma
...
master
Author | SHA1 | Date |
---|---|---|
epCode | 647a53c354 | |
ArTee3 | 910c9083e5 | |
kay27 | 66a64439c6 | |
kay27 | 7fe3217cd0 | |
epCode | 01df02667b | |
kay27 | 03feb36558 | |
kay27 | 1f925b6c84 | |
Lizzy Fleckenstein | 9a4d26c2ae | |
Lizzy Fleckenstein | 2d1ac1c7fa | |
Lizzy Fleckenstein | f0c2a0a1e9 | |
ArTee3 | 1fa2bd3477 | |
Elias Åström | 7f56e5efa4 | |
Elias Åström | c1e295de5f | |
Elias Åström | dac3c21628 | |
Elias Åström | b0c7941b3a | |
Elias Åström | 0996a83ba0 | |
Elias Åström | 1621c23308 | |
Elias Åström | 1873080046 | |
Elias Åström | 46541a4adc | |
Elias Åström | 10154d5778 | |
epCode | c877d6e922 | |
iliekprogrammar | 12745bd450 | |
iliekprogrammar | 03be45b983 | |
iliekprogrammar | 34dbddb40a | |
kay27 | b871433c47 | |
Nicu | a40e1c4737 | |
Nicu | df8fdda2c5 | |
iliekprogrammar | 249b5cfd1e | |
iliekprogrammar | f5f85a2148 | |
Lizzy Fleckenstein | d168bfa791 | |
Lizzy Fleckenstein | c20bd768ec | |
Lizzy Fleckenstein | 67cedf1308 | |
Lizzy Fleckenstein | 9391628813 | |
Lizzy Fleckenstein | 327bb68927 | |
Lizzy Fleckenstein | 906aa3b434 | |
Lizzy Fleckenstein | ecd27a4cdb | |
Lizzy Fleckenstein | 55df2a57f4 | |
Lizzy Fleckenstein | 4ff987ccc5 | |
Lizzy Fleckenstein | f3c37f49b9 | |
Lizzy Fleckenstein | f3580efced | |
Lizzy Fleckenstein | 4a53ba67ab | |
epCode | d02fc0c83d | |
epCode | e474ce6397 | |
ZeDique la Ruleta | b71566aad6 | |
epCode | 4fbb95bed3 | |
ZeDique la Ruleta | 2571c6124b | |
Nicu | e61f1e38f2 | |
AFCMS | a482a18a67 | |
Elias Åström | ed30fa0868 | |
Elias Åström | 8d473a42ca | |
Elias Åström | 0f2c487dca | |
Elias Åström | dc41c594aa | |
Elias Åström | bfe51316ee | |
Elias Åström | 13268965ee | |
Elias Åström | 521f96b4ab | |
Lizzy Fleckenstein | df59cc12a8 | |
Lizzy Fleckenstein | 3df3e957e2 | |
Lizzy Fleckenstein | 0e206e9974 | |
Lizzy Fleckenstein | 6ac0d628ef | |
Lizzy Fleckenstein | 413fbc9c60 | |
Elias Åström | c8b543991f | |
Elias Åström | 8f9650abe4 | |
Elias Åström | 4c46eb2b4b | |
Elias Åström | fe770c19a5 | |
Elias Åström | 0112825a9f | |
Elias Åström | cff0130506 | |
Elias Åström | 7b93f68ed8 | |
Elias Åström | ece4c892f4 | |
Elias Åström | bec1f786a6 | |
Elias Åström | 6458565bf9 | |
Elias Åström | 2e9b3c2259 | |
Elias Åström | 5193730652 | |
Elias Åström | e77473e800 | |
Elias Åström | 922bdbc601 | |
Elias Åström | 3241dbbec5 | |
Elias Åström | b47733507d | |
Elias Åström | f0528b11d7 | |
Elias Åström | 503b3a8149 | |
Elias Åström | 5b5a254b1a | |
Elias Åström | 0c90dda04c | |
Elias Åström | fa86d4e5eb | |
Elias Åström | f8461d5e90 | |
Elias Åström | fb6f5eae7a | |
AFCMS | 558fa57cc6 | |
epCode | 61ef6ebc03 | |
epCode | e52d58d15a | |
epCode | 6b1ce182d3 | |
AFCMS | 5df668f6af | |
AFCMS | ae18ca7602 | |
Elias Åström | 5c3bb22036 | |
Elias Åström | 7441f0269b | |
Elias Fleckenstein | a06d0f7474 | |
ZeDique la Ruleta | 6c49c46697 | |
epCode | b82da05590 | |
epCode | 86f2d639f9 | |
Elias Åström | 0805431231 | |
epCode | 33c589369f | |
AFCMS | 6645c4cb30 | |
AFCMS | 8f30e223e2 | |
AFCMS | 5d17a6b699 | |
AFCMS | f35f80d79a | |
Code-Sploit | 834dfcf9af | |
Code-Sploit | f06a56d7c4 |
4
API.md
4
API.md
|
@ -17,6 +17,10 @@ Items can have these fields:
|
||||||
anvil.
|
anvil.
|
||||||
See `mcl_banners` for an example.
|
See `mcl_banners` for an example.
|
||||||
|
|
||||||
|
Tools can have these fields:
|
||||||
|
* `_mcl_diggroups`: Specifies the digging groups that a tool can dig and how
|
||||||
|
efficiently. See `_mcl_autogroup` for more information.
|
||||||
|
|
||||||
All nodes can have these fields:
|
All nodes can have these fields:
|
||||||
|
|
||||||
* `_mcl_hardness`: Hardness of the block, ranges from 0 to infinity (represented by -1). Determines digging times. Default: 0
|
* `_mcl_hardness`: Hardness of the block, ranges from 0 to infinity (represented by -1). Determines digging times. Default: 0
|
||||||
|
|
|
@ -33,10 +33,10 @@ mgvalleys_spflags = noaltitude_chill,noaltitude_dry,nohumid_rivers,vary_river_de
|
||||||
keepInventory = false
|
keepInventory = false
|
||||||
|
|
||||||
# Performance settings
|
# Performance settings
|
||||||
dedicated_server_step = 0.001
|
# dedicated_server_step = 0.001
|
||||||
abm_interval = 0.25
|
# abm_interval = 0.25
|
||||||
max_objects_per_block = 4096
|
# max_objects_per_block = 4096
|
||||||
max_packets_per_iteration = 10096
|
# max_packets_per_iteration = 10096
|
||||||
|
|
||||||
# Clientmodding to support official client
|
# Clientmodding to support official client
|
||||||
enable_client_modding = true
|
enable_client_modding = true
|
||||||
|
|
|
@ -4,6 +4,11 @@ Specifically, this mod has 2 purposes:
|
||||||
1) Automatically adding the group “solid” for blocks considered “solid” in Minecraft.
|
1) Automatically adding the group “solid” for blocks considered “solid” in Minecraft.
|
||||||
2) Generating digging time group for all nodes based on node metadata (it's complicated)
|
2) Generating digging time group for all nodes based on node metadata (it's complicated)
|
||||||
|
|
||||||
|
This mod also requires another mod called “mcl_autogroup” to function properly.
|
||||||
|
“mcl_autogroup” exposes the API used to register digging groups, while this mod
|
||||||
|
uses those digging groups to set the digging time groups for all the nodes and
|
||||||
|
tools.
|
||||||
|
|
||||||
See init.lua for more infos.
|
See init.lua for more infos.
|
||||||
|
|
||||||
The leading underscore in the name “_mcl_autogroup” was added to force Minetest to load this mod as late as possible.
|
The leading underscore in the name “_mcl_autogroup” was added to force Minetest to load this mod as late as possible.
|
||||||
|
|
|
@ -1,169 +1,358 @@
|
||||||
--[[ Mining times. Yeah, mining times … Alright, this is going to be FUN!
|
--[[
|
||||||
|
This mod implements a HACK to make 100% sure the digging times of all tools
|
||||||
|
match Minecraft's perfectly. The digging times system of Minetest is very
|
||||||
|
different, so this weird group trickery has to be used. In Minecraft, each
|
||||||
|
block has a hardness and the actual Minecraft digging time is determined by
|
||||||
|
this:
|
||||||
|
|
||||||
This mod does include a HACK to make 100% sure the digging times of all tools match Minecraft's perfectly.
|
|
||||||
The digging times system of Minetest is very different, so this weird group trickery has to be used.
|
|
||||||
In Minecraft, each block has a hardness and the actual Minecraft digging time is determined by this:
|
|
||||||
1) The block's hardness
|
1) The block's hardness
|
||||||
2) The tool being used
|
2) The tool being used (the tool speed and its efficiency level)
|
||||||
3) Whether the tool is considered as “eligible” for the block
|
3) Whether the tool is considered as "eligible" for the block
|
||||||
(e.g. only diamond pick eligible for obsidian)
|
(e.g. only diamond pick eligible for obsidian)
|
||||||
See Minecraft Wiki <http://minecraft.gamepedia.com/Minecraft_Wiki> for more information.
|
|
||||||
|
|
||||||
In MineClone 2, all diggable node have the hardness set in the custom field “_mcl_hardness” (0 by default).
|
See Minecraft Wiki <http://minecraft.gamepedia.com/Minecraft_Wiki> for more
|
||||||
The nodes are also required to specify the “eligible” tools in groups like “pickaxey”, “shovely”, etc.
|
information.
|
||||||
This mod then calculates the real digging time based on the node meta data. The real digging times
|
|
||||||
are then added into mcl_autogroup.digtimes where the table indices are group rating and the values are the
|
|
||||||
digging times in seconds. These digging times can be then added verbatim into the tool definitions.
|
|
||||||
|
|
||||||
Example:
|
How the mod is used
|
||||||
mcl_autogroup.digtimes.pickaxey_dig_diamond[1] = 0.2
|
===================
|
||||||
|
|
||||||
→ This means that when a node has been assigned the group “pickaxey_dig_diamond=1”, it can be dug by the
|
In MineClone 2, all diggable nodes have the hardness set in the custom field
|
||||||
diamond pickaxe in 0.2 seconds.
|
"_mcl_hardness" (0 by default). These values are used together with digging
|
||||||
|
groups by this mod to create the correct digging times for nodes. Digging
|
||||||
|
groups are registered using the following code:
|
||||||
|
|
||||||
|
mcl_autogroup.register_diggroup("shovely")
|
||||||
|
mcl_autogroup.register_diggroup("pickaxey", {
|
||||||
|
levels = { "wood", "gold", "stone", "iron", "diamond" }
|
||||||
|
})
|
||||||
|
|
||||||
|
The first line registers a simple digging group. The second line registers a
|
||||||
|
digging group with 5 different levels (in this case one for each material of a
|
||||||
|
pickaxes).
|
||||||
|
|
||||||
This strange setup with mcl_autogroup has been done to minimize the amount of required digging times
|
Nodes indicate that they belong to a particular digging group by being member of
|
||||||
a single tool needs to use. If this is not being done, the loading time will increase considerably
|
the digging group in their node definition. "mcl_core:dirt" for example has
|
||||||
(>10s).
|
shovely=1 in its groups. If the digging group has multiple levels the value of
|
||||||
|
the group indicates which digging level the node requires.
|
||||||
|
"mcl_core:stone_with_gold" for example has pickaxey=4 because it requires a
|
||||||
|
pickaxe of level 4 be mined.
|
||||||
|
|
||||||
]]
|
For tools to be able to dig nodes of digging groups they need to use the have
|
||||||
|
the custom field "_mcl_diggroups" function to get the groupcaps. The value of
|
||||||
|
this field is a table which defines which groups the tool can dig and how
|
||||||
|
efficiently.
|
||||||
|
|
||||||
local materials = { "wood", "gold", "stone", "iron", "diamond" }
|
_mcl_diggroups = {
|
||||||
local basegroups = { "pickaxey", "axey", "shovely" }
|
handy = { speed = 1, level = 1, uses = 0 },
|
||||||
local minigroups = { "handy", "shearsy", "swordy", "shearsy_wool", "swordy_cobweb" }
|
pickaxey = { speed = 1, level = 0, uses = 0 },
|
||||||
local divisors = {
|
}
|
||||||
["wood"] = 2,
|
|
||||||
["gold"] = 12,
|
|
||||||
["stone"] = 4,
|
|
||||||
["iron"] = 6,
|
|
||||||
["diamond"] = 8,
|
|
||||||
["handy"] = 1,
|
|
||||||
["shearsy"] = 15,
|
|
||||||
["swordy"] = 1.5,
|
|
||||||
["shearsy_wool"] = 5,
|
|
||||||
["swordy_cobweb"] = 15,
|
|
||||||
}
|
|
||||||
local max_efficiency_level = 5
|
|
||||||
|
|
||||||
mcl_autogroup = {}
|
The "uses" field indicate how many uses (0 for infinite) a tool has when used on
|
||||||
mcl_autogroup.digtimes = {}
|
the specified digging group. The "speed" field is a multiplier to the dig speed
|
||||||
mcl_autogroup.creativetimes = {} -- Copy of digtimes, except that all values are 0. Used for creative mode
|
on that digging group.
|
||||||
|
|
||||||
for m=1, #materials do
|
The "level" field indicates which levels of the group the tool can harvest. A
|
||||||
for g=1, #basegroups do
|
level of 0 means that the tool cannot harvest blocks of that node. A level of 1
|
||||||
mcl_autogroup.digtimes[basegroups[g].."_dig_"..materials[m]] = {}
|
or above means that the tool can harvest nodes with that level or below. See
|
||||||
mcl_autogroup.creativetimes[basegroups[g].."_dig_"..materials[m]] = {}
|
"mcl_tools/init.lua" for examples on how "_mcl_diggroups" is used in practice.
|
||||||
for e=1, max_efficiency_level do
|
|
||||||
mcl_autogroup.digtimes[basegroups[g].."_dig_"..materials[m].."_efficiency_"..e] = {}
|
Information about the mod
|
||||||
|
=========================
|
||||||
|
|
||||||
|
The mod is split up into two parts, mcl_autogroup and _mcl_autogroup.
|
||||||
|
mcl_autogroup contains the API functions used to register custom digging groups.
|
||||||
|
_mcl_autogroup contains most of the code. The leading underscore in the name
|
||||||
|
"_mcl_autogroup" is used to force Minetest to load that part of the mod as late
|
||||||
|
as possible. Minetest loads mods in reverse alphabetical order.
|
||||||
|
|
||||||
|
This also means that it is very important that no mod adds _mcl_autogroup as a
|
||||||
|
dependency.
|
||||||
|
--]]
|
||||||
|
|
||||||
|
assert(minetest.get_modpath("mcl_autogroup"), "This mod requires the mod mcl_autogroup to function")
|
||||||
|
|
||||||
|
-- Returns a table containing the unique "_mcl_hardness" for nodes belonging to
|
||||||
|
-- each diggroup.
|
||||||
|
local function get_hardness_values_for_groups()
|
||||||
|
local maps = {}
|
||||||
|
local values = {}
|
||||||
|
for g, _ in pairs(mcl_autogroup.registered_diggroups) do
|
||||||
|
maps[g] = {}
|
||||||
|
values[g] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, ndef in pairs(minetest.registered_nodes) do
|
||||||
|
for g, _ in pairs(mcl_autogroup.registered_diggroups) do
|
||||||
|
if ndef.groups[g] ~= nil then
|
||||||
|
maps[g][ndef._mcl_hardness or 0] = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
for g=1, #minigroups do
|
for g, map in pairs(maps) do
|
||||||
mcl_autogroup.digtimes[minigroups[g].."_dig"] = {}
|
for k, _ in pairs(map) do
|
||||||
mcl_autogroup.creativetimes[minigroups[g].."_dig"] = {}
|
table.insert(values[g], k)
|
||||||
for e=1, max_efficiency_level do
|
end
|
||||||
mcl_autogroup.digtimes[minigroups[g].."_dig_efficiency_"..e] = {}
|
|
||||||
mcl_autogroup.creativetimes[minigroups[g].."_dig_efficiency_"..e] = {}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for g, _ in pairs(mcl_autogroup.registered_diggroups) do
|
||||||
|
table.sort(values[g])
|
||||||
|
end
|
||||||
|
return values
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Returns a table containing a table indexed by "_mcl_hardness_value" to get
|
||||||
|
-- its index in the list of unique hardnesses for each diggroup.
|
||||||
|
local function get_hardness_lookup_for_groups(hardness_values)
|
||||||
|
local map = {}
|
||||||
|
for g, values in pairs(hardness_values) do
|
||||||
|
map[g] = {}
|
||||||
|
for k, v in pairs(values) do
|
||||||
|
map[g][v] = k
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return map
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Array of unique hardness values for each group which affects dig time.
|
||||||
|
local hardness_values = get_hardness_values_for_groups()
|
||||||
|
|
||||||
|
-- Map indexed by hardness values which return the index of that value in
|
||||||
|
-- hardness_value. Used for quick lookup.
|
||||||
|
local hardness_lookup = get_hardness_lookup_for_groups(hardness_values)
|
||||||
|
|
||||||
|
local function compute_creativetimes(group)
|
||||||
|
local creativetimes = {}
|
||||||
|
|
||||||
|
for index, hardness in pairs(hardness_values[group]) do
|
||||||
|
table.insert(creativetimes, 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
return creativetimes
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Get the list of digging times for using a specific tool on a specific
|
||||||
|
-- diggroup.
|
||||||
|
--
|
||||||
|
-- Parameters:
|
||||||
|
-- group - the group which it is digging
|
||||||
|
-- can_harvest - if the tool can harvest the block
|
||||||
|
-- speed - dig speed multiplier for tool (default 1)
|
||||||
|
-- efficiency - efficiency level for the tool if applicable
|
||||||
|
local function get_digtimes(group, can_harvest, speed, efficiency)
|
||||||
|
local speed = speed or 1
|
||||||
|
if efficiency then
|
||||||
|
speed = speed + efficiency * efficiency + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
local digtimes = {}
|
||||||
|
|
||||||
|
for index, hardness in pairs(hardness_values[group]) do
|
||||||
|
local digtime = (hardness or 0) / speed
|
||||||
|
if can_harvest then
|
||||||
|
digtime = digtime * 1.5
|
||||||
|
else
|
||||||
|
digtime = digtime * 5
|
||||||
|
end
|
||||||
|
|
||||||
|
if digtime <= 0.05 then
|
||||||
|
digtime = 0
|
||||||
|
else
|
||||||
|
digtime = math.ceil(digtime * 20) / 20
|
||||||
|
end
|
||||||
|
table.insert(digtimes, digtime)
|
||||||
|
end
|
||||||
|
|
||||||
|
return digtimes
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Get one groupcap field for using a specific tool on a specific group.
|
||||||
|
local function get_groupcap(group, can_harvest, multiplier, efficiency, uses)
|
||||||
|
return {
|
||||||
|
times = get_digtimes(group, can_harvest, multiplier, efficiency),
|
||||||
|
uses = uses,
|
||||||
|
maxlevel = 0,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add the groupcaps from a field in "_mcl_diggroups" to the groupcaps of a
|
||||||
|
-- tool.
|
||||||
|
local function add_groupcaps(toolname, groupcaps, groupcaps_def, efficiency)
|
||||||
|
for g, capsdef in pairs(groupcaps_def) do
|
||||||
|
local mult = capsdef.speed or 1
|
||||||
|
local uses = capsdef.uses
|
||||||
|
local def = mcl_autogroup.registered_diggroups[g]
|
||||||
|
local max_level = def.levels and #def.levels or 1
|
||||||
|
|
||||||
|
assert(capsdef.level, toolname .. ' is missing level for ' .. g)
|
||||||
|
local level = math.min(capsdef.level, max_level)
|
||||||
|
|
||||||
|
if def.levels then
|
||||||
|
groupcaps[g .. "_dig_default"] = get_groupcap(g, false, mult, efficiency, uses)
|
||||||
|
if level > 0 then
|
||||||
|
groupcaps[g .. "_dig_" .. def.levels[level]] = get_groupcap(g, true, mult, efficiency, uses)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
groupcaps[g .. "_dig"] = get_groupcap(g, level > 0, mult, efficiency, uses)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return groupcaps
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Checks if the given node would drop its useful drop if dug by a given tool.
|
||||||
|
-- Returns true if it will yield its useful drop, false otherwise.
|
||||||
|
function mcl_autogroup.can_harvest(nodename, toolname)
|
||||||
|
local ndef = minetest.registered_nodes[nodename]
|
||||||
|
|
||||||
|
if minetest.get_item_group(nodename, "dig_immediate") >= 2 then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check if it can be dug by tool
|
||||||
|
local tdef = minetest.registered_tools[toolname]
|
||||||
|
if tdef and tdef._mcl_diggroups then
|
||||||
|
for g, gdef in pairs(tdef._mcl_diggroups) do
|
||||||
|
if ndef.groups[g] then
|
||||||
|
if ndef.groups[g] <= gdef.level then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check if it can be dug by hand
|
||||||
|
local tdef = minetest.registered_tools[""]
|
||||||
|
if tdef then
|
||||||
|
for g, gdef in pairs(tdef._mcl_diggroups) do
|
||||||
|
if ndef.groups[g] then
|
||||||
|
if ndef.groups[g] <= gdef.level then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Get one groupcap field for using a specific tool on a specific group.
|
||||||
|
local function get_groupcap(group, can_harvest, multiplier, efficiency, uses)
|
||||||
|
return {
|
||||||
|
times = get_digtimes(group, can_harvest, multiplier, efficiency),
|
||||||
|
uses = uses,
|
||||||
|
maxlevel = 0,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Returns the tool_capabilities from a tool definition or a default set of
|
||||||
|
-- tool_capabilities
|
||||||
|
local function get_tool_capabilities(tdef)
|
||||||
|
if tdef.tool_capabilities then
|
||||||
|
return tdef.tool_capabilities
|
||||||
|
end
|
||||||
|
|
||||||
|
-- If the damage group and punch interval from hand is not included,
|
||||||
|
-- then the user will not be able to attack with the tool.
|
||||||
|
local hand_toolcaps = minetest.registered_tools[""].tool_capabilities
|
||||||
|
return {
|
||||||
|
full_punch_interval = hand_toolcaps.full_punch_interval,
|
||||||
|
damage_groups = hand_toolcaps.damage_groups
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Get the groupcaps for a tool. This function returns "groupcaps" table of
|
||||||
|
-- digging which should be put in the "tool_capabilities" of the tool definition
|
||||||
|
-- or in the metadata of an enchanted tool.
|
||||||
|
--
|
||||||
|
-- Parameters:
|
||||||
|
-- toolname - Name of the tool being enchanted (like "mcl_tools:diamond_pickaxe")
|
||||||
|
-- efficiency - The efficiency level the tool is enchanted with (default 0)
|
||||||
|
--
|
||||||
|
-- NOTE:
|
||||||
|
-- This function can only be called after mod initialization. Otherwise a mod
|
||||||
|
-- would have to add _mcl_autogroup as a dependency which would break the mod
|
||||||
|
-- loading order.
|
||||||
|
function mcl_autogroup.get_groupcaps(toolname, efficiency)
|
||||||
|
local tdef = minetest.registered_tools[toolname]
|
||||||
|
local groupcaps = table.copy(get_tool_capabilities(tdef).groupcaps or {})
|
||||||
|
add_groupcaps(toolname, groupcaps, tdef._mcl_diggroups, efficiency)
|
||||||
|
return groupcaps
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Get the wear from using a tool on a digging group.
|
||||||
|
--
|
||||||
|
-- Parameters
|
||||||
|
-- toolname - Name of the tool used
|
||||||
|
-- diggroup - The name of the diggroup the tool is used on
|
||||||
|
--
|
||||||
|
-- NOTE:
|
||||||
|
-- This function can only be called after mod initialization. Otherwise a mod
|
||||||
|
-- would have to add _mcl_autogroup as a dependency which would break the mod
|
||||||
|
-- loading order.
|
||||||
|
function mcl_autogroup.get_wear(toolname, diggroup)
|
||||||
|
local tdef = minetest.registered_tools[toolname]
|
||||||
|
local uses = tdef._mcl_diggroups[diggroup].uses
|
||||||
|
return math.ceil(65535 / uses)
|
||||||
end
|
end
|
||||||
|
|
||||||
local overwrite = function()
|
local overwrite = function()
|
||||||
for nname, ndef in pairs(minetest.registered_nodes) do
|
for nname, ndef in pairs(minetest.registered_nodes) do
|
||||||
local groups_changed = false
|
|
||||||
local newgroups = table.copy(ndef.groups)
|
local newgroups = table.copy(ndef.groups)
|
||||||
if (nname ~= "ignore" and ndef.diggable) then
|
if (nname ~= "ignore" and ndef.diggable) then
|
||||||
-- Automatically assign the “solid” group for solid nodes
|
-- Automatically assign the "solid" group for solid nodes
|
||||||
if (ndef.walkable == nil or ndef.walkable == true)
|
if (ndef.walkable == nil or ndef.walkable == true)
|
||||||
and (ndef.collision_box == nil or ndef.collision_box.type == "regular")
|
and (ndef.collision_box == nil or ndef.collision_box.type == "regular")
|
||||||
and (ndef.node_box == nil or ndef.node_box.type == "regular")
|
and (ndef.node_box == nil or ndef.node_box.type == "regular")
|
||||||
and (ndef.groups.not_solid == 0 or ndef.groups.not_solid == nil) then
|
and (ndef.groups.not_solid == 0 or ndef.groups.not_solid == nil) then
|
||||||
newgroups.solid = 1
|
newgroups.solid = 1
|
||||||
groups_changed = true
|
|
||||||
end
|
end
|
||||||
-- Automatically assign the “opaque” group for opaque nodes
|
-- Automatically assign the "opaque" group for opaque nodes
|
||||||
if (not (ndef.paramtype == "light" or ndef.sunlight_propagates)) and
|
if (not (ndef.paramtype == "light" or ndef.sunlight_propagates)) and
|
||||||
(ndef.groups.not_opaque == 0 or ndef.groups.not_opaque == nil) then
|
(ndef.groups.not_opaque == 0 or ndef.groups.not_opaque == nil) then
|
||||||
newgroups.opaque = 1
|
newgroups.opaque = 1
|
||||||
groups_changed = true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function calculate_group(hardness, material, diggroup, newgroups, actual_rating, expected_rating, efficiency)
|
local creative_breakable = false
|
||||||
local time, validity_factor
|
|
||||||
if actual_rating >= expected_rating then
|
|
||||||
-- Valid tool
|
|
||||||
validity_factor = 1.5
|
|
||||||
else
|
|
||||||
-- Wrong tool (higher digging time)
|
|
||||||
validity_factor = 5
|
|
||||||
end
|
|
||||||
local speed_multiplier = divisors[material]
|
|
||||||
if efficiency then
|
|
||||||
speed_multiplier = speed_multiplier + efficiency * efficiency + 1
|
|
||||||
end
|
|
||||||
time = (hardness * validity_factor) / speed_multiplier
|
|
||||||
if time <= 0.05 then
|
|
||||||
time = 0
|
|
||||||
else
|
|
||||||
time = math.ceil(time * 20) / 20
|
|
||||||
end
|
|
||||||
table.insert(mcl_autogroup.digtimes[diggroup], time)
|
|
||||||
if not efficiency then
|
|
||||||
table.insert(mcl_autogroup.creativetimes[diggroup], 0)
|
|
||||||
end
|
|
||||||
newgroups[diggroup] = #mcl_autogroup.digtimes[diggroup]
|
|
||||||
return newgroups
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Hack in digging times
|
-- Assign groups used for digging this node depending on
|
||||||
local hardness = ndef._mcl_hardness
|
-- the registered digging groups
|
||||||
if not hardness then
|
for g, gdef in pairs(mcl_autogroup.registered_diggroups) do
|
||||||
hardness = 0
|
creative_breakable = true
|
||||||
end
|
local index = hardness_lookup[g][ndef._mcl_hardness or 0]
|
||||||
|
if ndef.groups[g] then
|
||||||
|
if gdef.levels then
|
||||||
|
newgroups[g .. "_dig_default"] = index
|
||||||
|
|
||||||
-- Handle pickaxey, axey and shovely
|
for i = ndef.groups[g], #gdef.levels do
|
||||||
for _, basegroup in pairs(basegroups) do
|
newgroups[g .. "_dig_" .. gdef.levels[i]] = index
|
||||||
if (hardness ~= -1 and ndef.groups[basegroup]) then
|
|
||||||
for g=1,#materials do
|
|
||||||
local diggroup = basegroup.."_dig_"..materials[g]
|
|
||||||
newgroups = calculate_group(hardness, materials[g], diggroup, newgroups, g, ndef.groups[basegroup])
|
|
||||||
for e=1,max_efficiency_level do
|
|
||||||
newgroups = calculate_group(hardness, materials[g], diggroup .. "_efficiency_" .. e, newgroups, g, ndef.groups[basegroup], e)
|
|
||||||
end
|
end
|
||||||
groups_changed = true
|
else
|
||||||
end
|
newgroups[g .. "_dig"] = index
|
||||||
end
|
|
||||||
end
|
|
||||||
for m=1, #minigroups do
|
|
||||||
local minigroup = minigroups[m]
|
|
||||||
if hardness ~= -1 then
|
|
||||||
local diggroup = minigroup.."_dig"
|
|
||||||
-- actual rating
|
|
||||||
local ar = ndef.groups[minigroup]
|
|
||||||
if ar == nil then
|
|
||||||
ar = 0
|
|
||||||
end
|
|
||||||
if (minigroup == "handy")
|
|
||||||
or
|
|
||||||
(ndef.groups.shearsy_wool and minigroup == "shearsy_wool" and ndef.groups.wool)
|
|
||||||
or
|
|
||||||
(ndef.groups.swordy_cobweb and minigroup == "swordy_cobweb" and nname == "mcl_core:cobweb")
|
|
||||||
or
|
|
||||||
(ndef.groups[minigroup] and minigroup ~= "swordy_cobweb" and minigroup ~= "shearsy_wool") then
|
|
||||||
newgroups = calculate_group(hardness, minigroup, diggroup, newgroups, ar, 1)
|
|
||||||
for e=1,max_efficiency_level do
|
|
||||||
newgroups = calculate_group(hardness, minigroup, diggroup .. "_efficiency_" .. e, newgroups, ar, 1, e)
|
|
||||||
end
|
|
||||||
groups_changed = true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if groups_changed then
|
-- Automatically assign the node to the
|
||||||
minetest.override_item(nname, {
|
-- creative_breakable group if it belongs to any digging
|
||||||
groups = newgroups
|
-- group.
|
||||||
})
|
newgroups["creative_breakable"] = 1
|
||||||
end
|
|
||||||
|
minetest.override_item(nname, {
|
||||||
|
groups = newgroups
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for tname, tdef in pairs(minetest.registered_tools) do
|
||||||
|
-- Assign groupcaps for digging the registered digging groups
|
||||||
|
-- depending on the _mcl_diggroups in the tool definition
|
||||||
|
if tdef._mcl_diggroups then
|
||||||
|
local toolcaps = table.copy(get_tool_capabilities(tdef))
|
||||||
|
toolcaps.groupcaps = mcl_autogroup.get_groupcaps(tname)
|
||||||
|
|
||||||
|
minetest.override_item(tname, {
|
||||||
|
tool_capabilities = toolcaps
|
||||||
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
name = _mcl_autogroup
|
name = _mcl_autogroup
|
||||||
author = Wuzzy
|
author = ryvnf
|
||||||
description = MineClone 2 core mod which automatically adds groups to all items. Very important for digging times.
|
description = MineClone 2 core mod which automatically adds groups to all items. Very important for digging times.
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
--[[
|
||||||
|
This is one part of a mod to replicate the digging times from Minecraft. This
|
||||||
|
part only exposes a function to register digging groups. The rest of the mod is
|
||||||
|
implemented and documented in the _mcl_autogroup.
|
||||||
|
|
||||||
|
The mod is split up into two parts, mcl_autogroup and _mcl_autogroup.
|
||||||
|
mcl_autogroup contains the API functions used to register custom digging groups.
|
||||||
|
_mcl_autogroup contains most of the code. The leading underscore in the name
|
||||||
|
"_mcl_autogroup" is used to force Minetest to load that part of the mod as late
|
||||||
|
as possible. Minetest loads mods in reverse alphabetical order.
|
||||||
|
--]]
|
||||||
|
mcl_autogroup = {}
|
||||||
|
mcl_autogroup.registered_diggroups = {}
|
||||||
|
|
||||||
|
assert(minetest.get_modpath("_mcl_autogroup"), "This mod requires the mod _mcl_autogroup to function")
|
||||||
|
|
||||||
|
-- Register a group as a digging group.
|
||||||
|
--
|
||||||
|
-- Parameters:
|
||||||
|
-- group - Name of the group to register as a digging group
|
||||||
|
-- def - Table with information about the diggroup (defaults to {} if unspecified)
|
||||||
|
--
|
||||||
|
-- Values in def:
|
||||||
|
-- level - If specified it is an array containing the names of the different
|
||||||
|
-- digging levels the digging group supports.
|
||||||
|
function mcl_autogroup.register_diggroup(group, def)
|
||||||
|
mcl_autogroup.registered_diggroups[group] = def or {}
|
||||||
|
end
|
|
@ -0,0 +1,3 @@
|
||||||
|
name = mcl_autogroup
|
||||||
|
author = ryvnf
|
||||||
|
description = MineClone 2 core mod which automatically adds groups to all items. Very important for digging times.
|
|
@ -33,25 +33,26 @@ mcl_vars.MAP_BLOCKSIZE = math.max(1, core.MAP_BLOCKSIZE or 16)
|
||||||
mcl_vars.mapgen_limit = math.max(1, tonumber(minetest.get_mapgen_setting("mapgen_limit")) or 31000)
|
mcl_vars.mapgen_limit = math.max(1, tonumber(minetest.get_mapgen_setting("mapgen_limit")) or 31000)
|
||||||
mcl_vars.MAX_MAP_GENERATION_LIMIT = math.max(1, core.MAX_MAP_GENERATION_LIMIT or 31000)
|
mcl_vars.MAX_MAP_GENERATION_LIMIT = math.max(1, core.MAX_MAP_GENERATION_LIMIT or 31000)
|
||||||
local central_chunk_offset = -math.floor(mcl_vars.chunksize / 2)
|
local central_chunk_offset = -math.floor(mcl_vars.chunksize / 2)
|
||||||
local chunk_size_in_nodes = mcl_vars.chunksize * mcl_vars.MAP_BLOCKSIZE
|
mcl_vars.central_chunk_offset_in_nodes = central_chunk_offset * mcl_vars.MAP_BLOCKSIZE
|
||||||
|
mcl_vars.chunk_size_in_nodes = mcl_vars.chunksize * mcl_vars.MAP_BLOCKSIZE
|
||||||
local central_chunk_min_pos = central_chunk_offset * mcl_vars.MAP_BLOCKSIZE
|
local central_chunk_min_pos = central_chunk_offset * mcl_vars.MAP_BLOCKSIZE
|
||||||
local central_chunk_max_pos = central_chunk_min_pos + chunk_size_in_nodes - 1
|
local central_chunk_max_pos = central_chunk_min_pos + mcl_vars.chunk_size_in_nodes - 1
|
||||||
local ccfmin = central_chunk_min_pos - mcl_vars.MAP_BLOCKSIZE -- Fullminp/fullmaxp of central chunk, in nodes
|
local ccfmin = central_chunk_min_pos - mcl_vars.MAP_BLOCKSIZE -- Fullminp/fullmaxp of central chunk, in nodes
|
||||||
local ccfmax = central_chunk_max_pos + mcl_vars.MAP_BLOCKSIZE
|
local ccfmax = central_chunk_max_pos + mcl_vars.MAP_BLOCKSIZE
|
||||||
local mapgen_limit_b = math.floor(math.min(mcl_vars.mapgen_limit, mcl_vars.MAX_MAP_GENERATION_LIMIT) / mcl_vars.MAP_BLOCKSIZE)
|
local mapgen_limit_b = math.floor(math.min(mcl_vars.mapgen_limit, mcl_vars.MAX_MAP_GENERATION_LIMIT) / mcl_vars.MAP_BLOCKSIZE)
|
||||||
local mapgen_limit_min = -mapgen_limit_b * mcl_vars.MAP_BLOCKSIZE
|
local mapgen_limit_min = -mapgen_limit_b * mcl_vars.MAP_BLOCKSIZE
|
||||||
local mapgen_limit_max = (mapgen_limit_b + 1) * mcl_vars.MAP_BLOCKSIZE - 1
|
local mapgen_limit_max = (mapgen_limit_b + 1) * mcl_vars.MAP_BLOCKSIZE - 1
|
||||||
local numcmin = math.max(math.floor((ccfmin - mapgen_limit_min) / chunk_size_in_nodes), 0) -- Number of complete chunks from central chunk
|
local numcmin = math.max(math.floor((ccfmin - mapgen_limit_min) / mcl_vars.chunk_size_in_nodes), 0) -- Number of complete chunks from central chunk
|
||||||
local numcmax = math.max(math.floor((mapgen_limit_max - ccfmax) / chunk_size_in_nodes), 0) -- fullminp/fullmaxp to effective mapgen limits.
|
local numcmax = math.max(math.floor((mapgen_limit_max - ccfmax) / mcl_vars.chunk_size_in_nodes), 0) -- fullminp/fullmaxp to effective mapgen limits.
|
||||||
mcl_vars.mapgen_edge_min = central_chunk_min_pos - numcmin * chunk_size_in_nodes
|
mcl_vars.mapgen_edge_min = central_chunk_min_pos - numcmin * mcl_vars.chunk_size_in_nodes
|
||||||
mcl_vars.mapgen_edge_max = central_chunk_max_pos + numcmax * chunk_size_in_nodes
|
mcl_vars.mapgen_edge_max = central_chunk_max_pos + numcmax * mcl_vars.chunk_size_in_nodes
|
||||||
|
|
||||||
local function coordinate_to_block(x)
|
local function coordinate_to_block(x)
|
||||||
return math.floor(x / mcl_vars.MAP_BLOCKSIZE)
|
return math.floor(x / mcl_vars.MAP_BLOCKSIZE)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function coordinate_to_chunk(x)
|
local function coordinate_to_chunk(x)
|
||||||
return math.floor((coordinate_to_block(x) + central_chunk_offset) / mcl_vars.chunksize)
|
return math.floor((coordinate_to_block(x) - central_chunk_offset) / mcl_vars.chunksize)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mcl_vars.pos_to_block(pos)
|
function mcl_vars.pos_to_block(pos)
|
||||||
|
@ -70,7 +71,7 @@ function mcl_vars.pos_to_chunk(pos)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
local k_positive = math.ceil(mcl_vars.MAX_MAP_GENERATION_LIMIT / chunk_size_in_nodes)
|
local k_positive = math.ceil(mcl_vars.MAX_MAP_GENERATION_LIMIT / mcl_vars.chunk_size_in_nodes)
|
||||||
local k_positive_z = k_positive * 2
|
local k_positive_z = k_positive * 2
|
||||||
local k_positive_y = k_positive_z * k_positive_z
|
local k_positive_y = k_positive_z * k_positive_z
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ mcl_worlds = {}
|
||||||
function mcl_worlds.is_in_void(pos)
|
function mcl_worlds.is_in_void(pos)
|
||||||
local void =
|
local void =
|
||||||
not ((pos.y < mcl_vars.mg_overworld_max and pos.y > mcl_vars.mg_overworld_min) or
|
not ((pos.y < mcl_vars.mg_overworld_max and pos.y > mcl_vars.mg_overworld_min) or
|
||||||
(pos.y < mcl_vars.mg_nether_max and pos.y > mcl_vars.mg_nether_min) or
|
(pos.y < mcl_vars.mg_nether_max+128 and pos.y > mcl_vars.mg_nether_min) or
|
||||||
(pos.y < mcl_vars.mg_end_max and pos.y > mcl_vars.mg_end_min))
|
(pos.y < mcl_vars.mg_end_max and pos.y > mcl_vars.mg_end_min))
|
||||||
|
|
||||||
local void_deadly = false
|
local void_deadly = false
|
||||||
|
@ -15,11 +15,11 @@ function mcl_worlds.is_in_void(pos)
|
||||||
-- Overworld → Void → End → Void → Nether → Void
|
-- Overworld → Void → End → Void → Nether → Void
|
||||||
if pos.y < mcl_vars.mg_overworld_min and pos.y > mcl_vars.mg_end_max then
|
if pos.y < mcl_vars.mg_overworld_min and pos.y > mcl_vars.mg_end_max then
|
||||||
void_deadly = pos.y < mcl_vars.mg_overworld_min - deadly_tolerance
|
void_deadly = pos.y < mcl_vars.mg_overworld_min - deadly_tolerance
|
||||||
elseif pos.y < mcl_vars.mg_end_min and pos.y > mcl_vars.mg_nether_max then
|
elseif pos.y < mcl_vars.mg_end_min and pos.y > mcl_vars.mg_nether_max+128 then
|
||||||
-- The void between End and Nether. Like usual, but here, the void
|
-- The void between End and Nether. Like usual, but here, the void
|
||||||
-- *above* the Nether also has a small tolerance area, so player
|
-- *above* the Nether also has a small tolerance area, so player
|
||||||
-- can fly above the Nether without getting hurt instantly.
|
-- can fly above the Nether without getting hurt instantly.
|
||||||
void_deadly = (pos.y < mcl_vars.mg_end_min - deadly_tolerance) and (pos.y > mcl_vars.mg_nether_max + deadly_tolerance)
|
void_deadly = (pos.y < mcl_vars.mg_end_min - deadly_tolerance) and (pos.y > mcl_vars.mg_nether_max+128 + deadly_tolerance)
|
||||||
elseif pos.y < mcl_vars.mg_nether_min then
|
elseif pos.y < mcl_vars.mg_nether_min then
|
||||||
void_deadly = pos.y < mcl_vars.mg_nether_min - deadly_tolerance
|
void_deadly = pos.y < mcl_vars.mg_nether_min - deadly_tolerance
|
||||||
end
|
end
|
||||||
|
@ -35,7 +35,7 @@ end
|
||||||
function mcl_worlds.y_to_layer(y)
|
function mcl_worlds.y_to_layer(y)
|
||||||
if y >= mcl_vars.mg_overworld_min then
|
if y >= mcl_vars.mg_overworld_min then
|
||||||
return y - mcl_vars.mg_overworld_min, "overworld"
|
return y - mcl_vars.mg_overworld_min, "overworld"
|
||||||
elseif y >= mcl_vars.mg_nether_min and y <= mcl_vars.mg_nether_max then
|
elseif y >= mcl_vars.mg_nether_min and y <= mcl_vars.mg_nether_max+128 then
|
||||||
return y - mcl_vars.mg_nether_min, "nether"
|
return y - mcl_vars.mg_nether_min, "nether"
|
||||||
elseif y >= mcl_vars.mg_end_min and y <= mcl_vars.mg_end_max then
|
elseif y >= mcl_vars.mg_end_min and y <= mcl_vars.mg_end_max then
|
||||||
return y - mcl_vars.mg_end_min, "end"
|
return y - mcl_vars.mg_end_min, "end"
|
||||||
|
@ -73,7 +73,7 @@ end
|
||||||
-- Takes a position and returns true if this position can have Nether dust
|
-- Takes a position and returns true if this position can have Nether dust
|
||||||
function mcl_worlds.has_dust(pos)
|
function mcl_worlds.has_dust(pos)
|
||||||
-- Weather in the Overworld and the high part of the void below
|
-- Weather in the Overworld and the high part of the void below
|
||||||
return pos.y <= mcl_vars.mg_nether_max + 64 and pos.y >= mcl_vars.mg_nether_min - 64
|
return pos.y <= mcl_vars.mg_nether_max + 138 and pos.y >= mcl_vars.mg_nether_min - 10
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Takes a position (pos) and returns true if compasses are working here
|
-- Takes a position (pos) and returns true if compasses are working here
|
||||||
|
|
|
@ -22,7 +22,7 @@ minetest.register_on_mods_loaded(function()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for _,func in ipairs(walkover.registered_globals) do --cache registered globals
|
for _,func in ipairs(walkover.registered_globals) do --cache registered globals
|
||||||
table.insert(registered_globals, value)
|
table.insert(registered_globals, func)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ local timer = 0
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
timer = timer + dtime;
|
timer = timer + dtime;
|
||||||
if timer >= 0.3 then
|
if timer >= 0.3 then
|
||||||
for _,player in ipairs(get_connected_players()) do
|
for _,player in pairs(get_connected_players()) do
|
||||||
local pp = player:get_pos()
|
local pp = player:get_pos()
|
||||||
pp.y = ceil(pp.y)
|
pp.y = ceil(pp.y)
|
||||||
local loc = vector_add(pp, {x=0,y=-1,z=0})
|
local loc = vector_add(pp, {x=0,y=-1,z=0})
|
||||||
|
|
|
@ -163,6 +163,8 @@ function boat.get_staticdata(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function boat.on_death(self, killer)
|
function boat.on_death(self, killer)
|
||||||
|
mcl_burning.extinguish(self.object)
|
||||||
|
|
||||||
if killer and killer:is_player() and minetest.is_creative_enabled(killer:get_player_name()) then
|
if killer and killer:is_player() and minetest.is_creative_enabled(killer:get_player_name()) then
|
||||||
local inv = killer:get_inventory()
|
local inv = killer:get_inventory()
|
||||||
if not inv:contains_item("main", self._itemstring) then
|
if not inv:contains_item("main", self._itemstring) then
|
||||||
|
@ -188,6 +190,8 @@ function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, d
|
||||||
end
|
end
|
||||||
|
|
||||||
function boat.on_step(self, dtime, moveresult)
|
function boat.on_step(self, dtime, moveresult)
|
||||||
|
mcl_burning.tick(self.object, dtime)
|
||||||
|
|
||||||
self._v = get_v(self.object:get_velocity()) * get_sign(self._v)
|
self._v = get_v(self.object:get_velocity()) * get_sign(self._v)
|
||||||
local v_factor = 1
|
local v_factor = 1
|
||||||
local v_slowdown = 0.02
|
local v_slowdown = 0.02
|
||||||
|
@ -223,7 +227,7 @@ function boat.on_step(self, dtime, moveresult)
|
||||||
self._regen_timer = regen_timer
|
self._regen_timer = regen_timer
|
||||||
|
|
||||||
if moveresult and moveresult.collides then
|
if moveresult and moveresult.collides then
|
||||||
for _, collision in ipairs(moveresult.collisions) do
|
for _, collision in pairs(moveresult.collisions) do
|
||||||
local pos = collision.node_pos
|
local pos = collision.node_pos
|
||||||
if collision.type == "node" and minetest.get_item_group(minetest.get_node(pos).name, "dig_by_boat") > 0 then
|
if collision.type == "node" and minetest.get_item_group(minetest.get_node(pos).name, "dig_by_boat") > 0 then
|
||||||
minetest.dig_node(pos)
|
minetest.dig_node(pos)
|
||||||
|
@ -305,7 +309,7 @@ function boat.on_step(self, dtime, moveresult)
|
||||||
self._animation = 0
|
self._animation = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, obj in ipairs(minetest.get_objects_inside_radius(self.object:get_pos(), 1.3)) do
|
for _, obj in pairs(minetest.get_objects_inside_radius(self.object:get_pos(), 1.3)) do
|
||||||
local entity = obj:get_luaentity()
|
local entity = obj:get_luaentity()
|
||||||
if entity and entity._cmi_is_mob then
|
if entity and entity._cmi_is_mob then
|
||||||
attach_object(self, obj)
|
attach_object(self, obj)
|
||||||
|
|
|
@ -117,6 +117,10 @@ function mcl_burning.damage(obj)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mcl_burning.set_on_fire(obj, burn_time, reason)
|
function mcl_burning.set_on_fire(obj, burn_time, reason)
|
||||||
|
if obj:get_hp() < 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local luaentity = obj:get_luaentity()
|
local luaentity = obj:get_luaentity()
|
||||||
if luaentity and luaentity.fire_resistant then
|
if luaentity and luaentity.fire_resistant then
|
||||||
return
|
return
|
||||||
|
@ -145,7 +149,7 @@ function mcl_burning.set_on_fire(obj, burn_time, reason)
|
||||||
end
|
end
|
||||||
|
|
||||||
if old_burn_time <= burn_time then
|
if old_burn_time <= burn_time then
|
||||||
local sound_id = mcl_burning.get(obj, "int", "sound_id")
|
--[[local sound_id = mcl_burning.get(obj, "int", "sound_id")
|
||||||
if sound_id == 0 then
|
if sound_id == 0 then
|
||||||
sound_id = minetest.sound_play("fire_fire", {
|
sound_id = minetest.sound_play("fire_fire", {
|
||||||
object = obj,
|
object = obj,
|
||||||
|
@ -153,7 +157,7 @@ function mcl_burning.set_on_fire(obj, burn_time, reason)
|
||||||
max_hear_distance = 16,
|
max_hear_distance = 16,
|
||||||
loop = true,
|
loop = true,
|
||||||
}) + 1
|
}) + 1
|
||||||
end
|
end]]--
|
||||||
|
|
||||||
local hud_id
|
local hud_id
|
||||||
if obj:is_player() then
|
if obj:is_player() then
|
||||||
|
@ -163,7 +167,7 @@ function mcl_burning.set_on_fire(obj, burn_time, reason)
|
||||||
hud_elem_type = "image",
|
hud_elem_type = "image",
|
||||||
position = {x = 0.5, y = 0.5},
|
position = {x = 0.5, y = 0.5},
|
||||||
scale = {x = -100, y = -100},
|
scale = {x = -100, y = -100},
|
||||||
text = "fire_basic_flame.png",
|
text = "mcl_burning_hud_flame_animated.png",
|
||||||
z_index = 1000,
|
z_index = 1000,
|
||||||
}) + 1
|
}) + 1
|
||||||
end
|
end
|
||||||
|
@ -171,7 +175,7 @@ function mcl_burning.set_on_fire(obj, burn_time, reason)
|
||||||
mcl_burning.set(obj, "float", "burn_time", burn_time)
|
mcl_burning.set(obj, "float", "burn_time", burn_time)
|
||||||
mcl_burning.set(obj, "string", "reason", reason)
|
mcl_burning.set(obj, "string", "reason", reason)
|
||||||
mcl_burning.set(obj, "int", "hud_id", hud_id)
|
mcl_burning.set(obj, "int", "hud_id", hud_id)
|
||||||
mcl_burning.set(obj, "int", "sound_id", sound_id)
|
--mcl_burning.set(obj, "int", "sound_id", sound_id)
|
||||||
|
|
||||||
local fire_entity = minetest.add_entity(obj:get_pos(), "mcl_burning:fire")
|
local fire_entity = minetest.add_entity(obj:get_pos(), "mcl_burning:fire")
|
||||||
local minp, maxp = mcl_burning.get_collisionbox(obj)
|
local minp, maxp = mcl_burning.get_collisionbox(obj)
|
||||||
|
@ -194,8 +198,8 @@ end
|
||||||
|
|
||||||
function mcl_burning.extinguish(obj)
|
function mcl_burning.extinguish(obj)
|
||||||
if mcl_burning.is_burning(obj) then
|
if mcl_burning.is_burning(obj) then
|
||||||
local sound_id = mcl_burning.get(obj, "int", "sound_id") - 1
|
--local sound_id = mcl_burning.get(obj, "int", "sound_id") - 1
|
||||||
minetest.sound_stop(sound_id)
|
--minetest.sound_stop(sound_id)
|
||||||
|
|
||||||
if obj:is_player() then
|
if obj:is_player() then
|
||||||
local hud_id = mcl_burning.get(obj, "int", "hud_id") - 1
|
local hud_id = mcl_burning.get(obj, "int", "hud_id") - 1
|
||||||
|
@ -206,7 +210,7 @@ function mcl_burning.extinguish(obj)
|
||||||
mcl_burning.set(obj, "float", "burn_time")
|
mcl_burning.set(obj, "float", "burn_time")
|
||||||
mcl_burning.set(obj, "float", "damage_timer")
|
mcl_burning.set(obj, "float", "damage_timer")
|
||||||
mcl_burning.set(obj, "int", "hud_id")
|
mcl_burning.set(obj, "int", "hud_id")
|
||||||
mcl_burning.set(obj, "int", "sound_id")
|
--mcl_burning.set(obj, "int", "sound_id")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -267,7 +271,7 @@ function mcl_burning.fire_entity_step(self, dtime)
|
||||||
if not parent or not mcl_burning.is_burning(parent) then
|
if not parent or not mcl_burning.is_burning(parent) then
|
||||||
do_remove = true
|
do_remove = true
|
||||||
else
|
else
|
||||||
for _, other in ipairs(minetest.get_objects_inside_radius(obj:get_pos(), 0)) do
|
for _, other in pairs(minetest.get_objects_inside_radius(obj:get_pos(), 0)) do
|
||||||
local luaentity = obj:get_luaentity()
|
local luaentity = obj:get_luaentity()
|
||||||
if luaentity and luaentity.name == "mcl_burning:fire" and not luaentity.doing_step and not luaentity.removed then
|
if luaentity and luaentity.name == "mcl_burning:fire" and not luaentity.doing_step and not luaentity.removed then
|
||||||
do_remove = true
|
do_remove = true
|
||||||
|
|
|
@ -22,7 +22,7 @@ minetest.register_entity("mcl_burning:fire", {
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in pairs(minetest.get_connected_players()) do
|
||||||
mcl_burning.tick(player, dtime)
|
mcl_burning.tick(player, dtime)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -54,14 +54,14 @@ local disable_physics = function(object, luaentity, ignore_check, reset_movement
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
for _,player in ipairs(minetest.get_connected_players()) do
|
for _,player in pairs(minetest.get_connected_players()) do
|
||||||
if player:get_hp() > 0 or not minetest.settings:get_bool("enable_damage") then
|
if player:get_hp() > 0 or not minetest.settings:get_bool("enable_damage") then
|
||||||
local pos = player:get_pos()
|
local pos = player:get_pos()
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
local checkpos = {x=pos.x,y=pos.y + item_drop_settings.player_collect_height,z=pos.z}
|
local checkpos = {x=pos.x,y=pos.y + item_drop_settings.player_collect_height,z=pos.z}
|
||||||
|
|
||||||
--magnet and collection
|
--magnet and collection
|
||||||
for _,object in ipairs(minetest.get_objects_inside_radius(checkpos, item_drop_settings.xp_radius_magnet)) do
|
for _,object in pairs(minetest.get_objects_inside_radius(checkpos, item_drop_settings.xp_radius_magnet)) do
|
||||||
if not object:is_player() and vector.distance(checkpos, object:get_pos()) < item_drop_settings.radius_magnet and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" and object:get_luaentity()._magnet_timer and (object:get_luaentity()._insta_collect or (object:get_luaentity().age > item_drop_settings.age)) then
|
if not object:is_player() and vector.distance(checkpos, object:get_pos()) < item_drop_settings.radius_magnet and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" and object:get_luaentity()._magnet_timer and (object:get_luaentity()._insta_collect or (object:get_luaentity().age > item_drop_settings.age)) then
|
||||||
object:get_luaentity()._magnet_timer = object:get_luaentity()._magnet_timer + dtime
|
object:get_luaentity()._magnet_timer = object:get_luaentity()._magnet_timer + dtime
|
||||||
local collected = false
|
local collected = false
|
||||||
|
@ -165,66 +165,6 @@ minetest.register_globalstep(function(dtime)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local minigroups = { "shearsy", "swordy", "shearsy_wool", "swordy_cobweb" }
|
|
||||||
local basegroups = { "pickaxey", "axey", "shovely" }
|
|
||||||
local materials = { "wood", "gold", "stone", "iron", "diamond" }
|
|
||||||
|
|
||||||
-- Checks if the given node would drop its useful drop if dug by a tool
|
|
||||||
-- with the given tool capabilities. Returns true if it will yield its useful
|
|
||||||
-- drop, false otherwise.
|
|
||||||
local check_can_drop = function(node_name, tool_capabilities)
|
|
||||||
local handy = minetest.get_item_group(node_name, "handy")
|
|
||||||
local dig_immediate = minetest.get_item_group(node_name, "dig_immediate")
|
|
||||||
if handy == 1 or dig_immediate == 2 or dig_immediate == 3 then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
local toolgroupcaps
|
|
||||||
if tool_capabilities then
|
|
||||||
toolgroupcaps = tool_capabilities.groupcaps
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Compare node groups with tool capabilities
|
|
||||||
for m=1, #minigroups do
|
|
||||||
local minigroup = minigroups[m]
|
|
||||||
local g = minetest.get_item_group(node_name, minigroup)
|
|
||||||
if g ~= 0 then
|
|
||||||
local plus = minigroup .. "_dig"
|
|
||||||
if toolgroupcaps[plus] then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
for e=1,5 do
|
|
||||||
local effplus = plus .. "_efficiency_" .. e
|
|
||||||
if toolgroupcaps[effplus] then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
for b=1, #basegroups do
|
|
||||||
local basegroup = basegroups[b]
|
|
||||||
local g = minetest.get_item_group(node_name, basegroup)
|
|
||||||
if g ~= 0 then
|
|
||||||
for m=g, #materials do
|
|
||||||
local plus = basegroup .. "_dig_"..materials[m]
|
|
||||||
if toolgroupcaps[plus] then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
for e=1,5 do
|
|
||||||
local effplus = plus .. "_efficiency_" .. e
|
|
||||||
if toolgroupcaps[effplus] then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Stupid workaround to get drops from a drop table:
|
-- Stupid workaround to get drops from a drop table:
|
||||||
-- Create a temporary table in minetest.registered_nodes that contains the proper drops,
|
-- Create a temporary table in minetest.registered_nodes that contains the proper drops,
|
||||||
-- because unfortunately minetest.get_node_drops needs the drop table to be inside a registered node definition
|
-- because unfortunately minetest.get_node_drops needs the drop table to be inside a registered node definition
|
||||||
|
@ -281,17 +221,20 @@ function minetest.handle_node_drops(pos, drops, digger)
|
||||||
|
|
||||||
-- Check if node will yield its useful drop by the digger's tool
|
-- Check if node will yield its useful drop by the digger's tool
|
||||||
local dug_node = minetest.get_node(pos)
|
local dug_node = minetest.get_node(pos)
|
||||||
local toolcaps
|
local tooldef
|
||||||
local tool
|
local tool
|
||||||
if digger ~= nil then
|
if digger ~= nil then
|
||||||
tool = digger:get_wielded_item()
|
tool = digger:get_wielded_item()
|
||||||
toolcaps = tool:get_tool_capabilities()
|
tooldef = minetest.registered_tools[tool:get_name()]
|
||||||
|
|
||||||
if not check_can_drop(dug_node.name, toolcaps) then
|
if not mcl_autogroup.can_harvest(dug_node.name, tool:get_name()) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local diggroups = tooldef and tooldef._mcl_diggroups
|
||||||
|
local shearsy_level = diggroups and diggroups.shearsy and diggroups.shearsy.level
|
||||||
|
|
||||||
--[[ Special node drops when dug by shears by reading _mcl_shears_drop or with a silk touch tool reading _mcl_silk_touch_drop
|
--[[ Special node drops when dug by shears by reading _mcl_shears_drop or with a silk touch tool reading _mcl_silk_touch_drop
|
||||||
from the node definition.
|
from the node definition.
|
||||||
Definition of _mcl_shears_drop / _mcl_silk_touch_drop:
|
Definition of _mcl_shears_drop / _mcl_silk_touch_drop:
|
||||||
|
@ -303,7 +246,7 @@ function minetest.handle_node_drops(pos, drops, digger)
|
||||||
|
|
||||||
local silk_touch_drop = false
|
local silk_touch_drop = false
|
||||||
local nodedef = minetest.registered_nodes[dug_node.name]
|
local nodedef = minetest.registered_nodes[dug_node.name]
|
||||||
if toolcaps ~= nil and toolcaps.groupcaps and toolcaps.groupcaps.shearsy_dig and nodedef._mcl_shears_drop then
|
if shearsy_level and shearsy_level > 0 and nodedef._mcl_shears_drop then
|
||||||
if nodedef._mcl_shears_drop == true then
|
if nodedef._mcl_shears_drop == true then
|
||||||
drops = { dug_node.name }
|
drops = { dug_node.name }
|
||||||
else
|
else
|
||||||
|
@ -785,7 +728,7 @@ minetest.register_entity(":__builtin:item", {
|
||||||
if self.physical_state then
|
if self.physical_state then
|
||||||
local own_stack = ItemStack(self.object:get_luaentity().itemstring)
|
local own_stack = ItemStack(self.object:get_luaentity().itemstring)
|
||||||
-- Merge with close entities of the same item
|
-- Merge with close entities of the same item
|
||||||
for _, object in ipairs(minetest.get_objects_inside_radius(p, 0.8)) do
|
for _, object in pairs(minetest.get_objects_inside_radius(p, 0.8)) do
|
||||||
local obj = object:get_luaentity()
|
local obj = object:get_luaentity()
|
||||||
if obj and obj.name == "__builtin:item"
|
if obj and obj.name == "__builtin:item"
|
||||||
and obj.physical_state == false then
|
and obj.physical_state == false then
|
||||||
|
|
|
@ -226,7 +226,7 @@ local collision = function(self)
|
||||||
local z = 0
|
local z = 0
|
||||||
local width = -self.collisionbox[1] + self.collisionbox[4] + 0.5
|
local width = -self.collisionbox[1] + self.collisionbox[4] + 0.5
|
||||||
|
|
||||||
for _,object in ipairs(minetest.get_objects_inside_radius(pos, width)) do
|
for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do
|
||||||
|
|
||||||
if object:is_player()
|
if object:is_player()
|
||||||
or (object:get_luaentity()._cmi_is_mob == true and object ~= self.object) then
|
or (object:get_luaentity()._cmi_is_mob == true and object ~= self.object) then
|
||||||
|
@ -1047,8 +1047,13 @@ local do_env_damage = function(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Use get_node_light for Minetest version 5.3 where get_natural_light
|
||||||
|
-- does not exist yet.
|
||||||
|
local get_light = minetest.get_natural_light or minetest.get_node_light
|
||||||
|
local sunlight = get_light(pos, self.time_of_day)
|
||||||
|
|
||||||
-- bright light harms mob
|
-- bright light harms mob
|
||||||
if self.light_damage ~= 0 and (minetest.get_node_light(pos) or 0) > 12 then
|
if self.light_damage ~= 0 and (sunlight or 0) > 12 then
|
||||||
if deal_light_damage(self, pos, self.light_damage) then
|
if deal_light_damage(self, pos, self.light_damage) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -1057,7 +1062,7 @@ local do_env_damage = function(self)
|
||||||
if mod_worlds then
|
if mod_worlds then
|
||||||
_, dim = mcl_worlds.y_to_layer(pos.y)
|
_, dim = mcl_worlds.y_to_layer(pos.y)
|
||||||
end
|
end
|
||||||
if (self.sunlight_damage ~= 0 or self.ignited_by_sunlight) and (minetest.get_node_light(pos) or 0) >= minetest.LIGHT_MAX and dim == "overworld" then
|
if (self.sunlight_damage ~= 0 or self.ignited_by_sunlight) and (sunlight or 0) >= minetest.LIGHT_MAX and dim == "overworld" then
|
||||||
if self.ignited_by_sunlight then
|
if self.ignited_by_sunlight then
|
||||||
mcl_burning.set_on_fire(self.object, 10)
|
mcl_burning.set_on_fire(self.object, 10)
|
||||||
else
|
else
|
||||||
|
@ -2821,7 +2826,7 @@ local falling = function(self, pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
if mcl_portals ~= nil then
|
if mcl_portals ~= nil then
|
||||||
if mcl_portals.nether_portal_cooloff[self.object] then
|
if mcl_portals.nether_portal_cooloff(self.object) then
|
||||||
return false -- mob has teleported through Nether portal - it's 99% not falling
|
return false -- mob has teleported through Nether portal - it's 99% not falling
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2851,6 +2856,18 @@ local falling = function(self, pos)
|
||||||
self.object:set_acceleration({x = 0, y = 0, z = 0})
|
self.object:set_acceleration({x = 0, y = 0, z = 0})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if minetest.registered_nodes[node_ok(pos).name].groups.lava then
|
||||||
|
|
||||||
|
if self.floats_on_lava == 1 then
|
||||||
|
|
||||||
|
self.object:set_acceleration({
|
||||||
|
x = 0,
|
||||||
|
y = -self.fall_speed / (max(1, v.y) ^ 2),
|
||||||
|
z = 0
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- in water then float up
|
-- in water then float up
|
||||||
if minetest.registered_nodes[node_ok(pos).name].groups.water then
|
if minetest.registered_nodes[node_ok(pos).name].groups.water then
|
||||||
|
|
||||||
|
@ -3768,6 +3785,7 @@ minetest.register_entity(name, {
|
||||||
knock_back = def.knock_back ~= false,
|
knock_back = def.knock_back ~= false,
|
||||||
shoot_offset = def.shoot_offset or 0,
|
shoot_offset = def.shoot_offset or 0,
|
||||||
floats = def.floats or 1, -- floats in water by default
|
floats = def.floats or 1, -- floats in water by default
|
||||||
|
floats_on_lava = def.floats_on_lava or 0,
|
||||||
replace_rate = def.replace_rate,
|
replace_rate = def.replace_rate,
|
||||||
replace_what = def.replace_what,
|
replace_what = def.replace_what,
|
||||||
replace_with = def.replace_with,
|
replace_with = def.replace_with,
|
||||||
|
@ -4576,9 +4594,9 @@ local timer = 0
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
timer = timer + dtime
|
timer = timer + dtime
|
||||||
if timer < 1 then return end
|
if timer < 1 then return end
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in pairs(minetest.get_connected_players()) do
|
||||||
local pos = player:get_pos()
|
local pos = player:get_pos()
|
||||||
for _, obj in ipairs(minetest.get_objects_inside_radius(pos, 47)) do
|
for _, obj in pairs(minetest.get_objects_inside_radius(pos, 47)) do
|
||||||
local lua = obj:get_luaentity()
|
local lua = obj:get_luaentity()
|
||||||
if lua and lua._cmi_is_mob then
|
if lua and lua._cmi_is_mob then
|
||||||
lua.lifetimer = math.max(20, lua.lifetimer)
|
lua.lifetimer = math.max(20, lua.lifetimer)
|
||||||
|
|
|
@ -191,6 +191,14 @@ minetest.register_craftitem("mcl_paintings:painting", {
|
||||||
if pointed_thing.type ~= "node" then
|
if pointed_thing.type ~= "node" then
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local node = minetest.get_node(pointed_thing.under)
|
||||||
|
if placer and not placer:get_player_control().sneak then
|
||||||
|
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
||||||
|
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local dir = vector.subtract(pointed_thing.above, pointed_thing.under)
|
local dir = vector.subtract(pointed_thing.above, pointed_thing.under)
|
||||||
dir = vector.normalize(dir)
|
dir = vector.normalize(dir)
|
||||||
if dir.y ~= 0 then
|
if dir.y ~= 0 then
|
||||||
|
|
|
@ -122,7 +122,7 @@ local arrows = {
|
||||||
}
|
}
|
||||||
|
|
||||||
local throwing_shoot_arrow = function(itemstack, player)
|
local throwing_shoot_arrow = function(itemstack, player)
|
||||||
for _,arrow in ipairs(arrows) do
|
for _,arrow in pairs(arrows) do
|
||||||
if player:get_inventory():get_stack("main", player:get_wield_index()+1):get_name() == arrow[1] then
|
if player:get_inventory():get_stack("main", player:get_wield_index()+1):get_name() == arrow[1] then
|
||||||
if not minetest.is_creative_enabled(player:get_player_name()) then
|
if not minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
player:get_inventory():remove_item("main", arrow[1])
|
player:get_inventory():remove_item("main", arrow[1])
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 4.0 KiB |
|
@ -960,7 +960,7 @@ mobs:register_mob("mobs_mc:villager", {
|
||||||
"mobs_mc_villager_smith.png", --hat
|
"mobs_mc_villager_smith.png", --hat
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
visual_size = {x=3, y=3},
|
visual_size = {x=2.75, y=2.75},
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
walk_velocity = 1.2,
|
walk_velocity = 1.2,
|
||||||
run_velocity = 2.4,
|
run_velocity = 2.4,
|
||||||
|
|
|
@ -28,7 +28,7 @@ mobs:register_mob("mobs_mc:evoker", {
|
||||||
"blank.png", --no hat
|
"blank.png", --no hat
|
||||||
-- TODO: Attack glow
|
-- TODO: Attack glow
|
||||||
} },
|
} },
|
||||||
visual_size = {x=3, y=3},
|
visual_size = {x=2.75, y=2.75},
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
damage = 6,
|
damage = 6,
|
||||||
walk_velocity = 0.2,
|
walk_velocity = 0.2,
|
||||||
|
|
|
@ -36,7 +36,7 @@ mobs:register_mob("mobs_mc:illusioner", {
|
||||||
-- TODO: more sounds
|
-- TODO: more sounds
|
||||||
distance = 16,
|
distance = 16,
|
||||||
},
|
},
|
||||||
visual_size = {x=3, y=3},
|
visual_size = {x=2.75, y=2.75},
|
||||||
walk_velocity = 0.6,
|
walk_velocity = 0.6,
|
||||||
run_velocity = 2,
|
run_velocity = 2,
|
||||||
jump = true,
|
jump = true,
|
||||||
|
|
|
@ -30,7 +30,7 @@ mobs:register_mob("mobs_mc:vindicator", {
|
||||||
-- TODO: Glow when attacking (mobs_mc_vindicator.png)
|
-- TODO: Glow when attacking (mobs_mc_vindicator.png)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
visual_size = {x=3, y=3},
|
visual_size = {x=2.75, y=2.75},
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
damage = 13,
|
damage = 13,
|
||||||
reach = 2,
|
reach = 2,
|
||||||
|
|
|
@ -45,7 +45,7 @@ mobs:register_mob("mobs_mc:villager_zombie", {
|
||||||
{"mobs_mc_zombie_smith.png"},
|
{"mobs_mc_zombie_smith.png"},
|
||||||
{"mobs_mc_zombie_villager.png"}
|
{"mobs_mc_zombie_villager.png"}
|
||||||
},
|
},
|
||||||
visual_size = {x=3, y=3},
|
visual_size = {x=2.75, y=2.75},
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
damage = 3,
|
damage = 3,
|
||||||
reach = 2,
|
reach = 2,
|
||||||
|
|
|
@ -25,7 +25,7 @@ mobs:register_mob("mobs_mc:witch", {
|
||||||
textures = {
|
textures = {
|
||||||
{"mobs_mc_witch.png"},
|
{"mobs_mc_witch.png"},
|
||||||
},
|
},
|
||||||
visual_size = {x=3, y=3},
|
visual_size = {x=2.75, y=2.75},
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
damage = 2,
|
damage = 2,
|
||||||
reach = 2,
|
reach = 2,
|
||||||
|
|
|
@ -27,7 +27,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
if timer < 0.7 then return end
|
if timer < 0.7 then return end
|
||||||
timer = 0
|
timer = 0
|
||||||
|
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in pairs(minetest.get_connected_players()) do
|
||||||
if not mcl_worlds.has_dust(player:get_pos()) then
|
if not mcl_worlds.has_dust(player:get_pos()) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
local PARTICLES_COUNT_RAIN = 30
|
local PARTICLES_COUNT_RAIN = 30
|
||||||
local PARTICLES_COUNT_THUNDER = 45
|
local PARTICLES_COUNT_THUNDER = 45
|
||||||
|
|
||||||
|
local get_connected_players = minetest.get_connected_players
|
||||||
|
|
||||||
mcl_weather.rain = {
|
mcl_weather.rain = {
|
||||||
-- max rain particles created at time
|
-- max rain particles created at time
|
||||||
particles_count = PARTICLES_COUNT_RAIN,
|
particles_count = PARTICLES_COUNT_RAIN,
|
||||||
|
@ -36,7 +38,7 @@ mcl_weather.rain.set_sky_box = function()
|
||||||
{r=85, g=86, b=98},
|
{r=85, g=86, b=98},
|
||||||
{r=0, g=0, b=0}})
|
{r=0, g=0, b=0}})
|
||||||
mcl_weather.skycolor.active = true
|
mcl_weather.skycolor.active = true
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in pairs(get_connected_players()) do
|
||||||
player:set_clouds({color="#5D5D5FE8"})
|
player:set_clouds({color="#5D5D5FE8"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -154,7 +156,7 @@ mcl_weather.rain.clear = function()
|
||||||
mcl_weather.rain.init_done = false
|
mcl_weather.rain.init_done = false
|
||||||
mcl_weather.rain.set_particles_mode("rain")
|
mcl_weather.rain.set_particles_mode("rain")
|
||||||
mcl_weather.skycolor.remove_layer("weather-pack-rain-sky")
|
mcl_weather.skycolor.remove_layer("weather-pack-rain-sky")
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in pairs(get_connected_players()) do
|
||||||
mcl_weather.rain.remove_sound(player)
|
mcl_weather.rain.remove_sound(player)
|
||||||
mcl_weather.rain.remove_player(player)
|
mcl_weather.rain.remove_player(player)
|
||||||
end
|
end
|
||||||
|
@ -176,7 +178,7 @@ mcl_weather.rain.make_weather = function()
|
||||||
mcl_weather.rain.init_done = true
|
mcl_weather.rain.init_done = true
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in pairs(get_connected_players()) do
|
||||||
if (mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:get_pos())) then
|
if (mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:get_pos())) then
|
||||||
mcl_weather.rain.remove_sound(player)
|
mcl_weather.rain.remove_sound(player)
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -43,7 +43,7 @@ mcl_weather.skycolor = {
|
||||||
|
|
||||||
-- Remove layer from colors table
|
-- Remove layer from colors table
|
||||||
remove_layer = function(layer_name)
|
remove_layer = function(layer_name)
|
||||||
for k, name in ipairs(mcl_weather.skycolor.layer_names) do
|
for k, name in pairs(mcl_weather.skycolor.layer_names) do
|
||||||
if name == layer_name then
|
if name == layer_name then
|
||||||
table.remove(mcl_weather.skycolor.layer_names, k)
|
table.remove(mcl_weather.skycolor.layer_names, k)
|
||||||
mcl_weather.skycolor.force_update = true
|
mcl_weather.skycolor.force_update = true
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
local get_connected_players = minetest.get_connected_players
|
||||||
|
|
||||||
mcl_weather.snow = {}
|
mcl_weather.snow = {}
|
||||||
|
|
||||||
mcl_weather.snow.particles_count = 15
|
mcl_weather.snow.particles_count = 15
|
||||||
|
@ -37,7 +39,7 @@ mcl_weather.snow.set_sky_box = function()
|
||||||
{r=85, g=86, b=86},
|
{r=85, g=86, b=86},
|
||||||
{r=0, g=0, b=0}})
|
{r=0, g=0, b=0}})
|
||||||
mcl_weather.skycolor.active = true
|
mcl_weather.skycolor.active = true
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in pairs(get_connected_players()) do
|
||||||
player:set_clouds({color="#ADADADE8"})
|
player:set_clouds({color="#ADADADE8"})
|
||||||
end
|
end
|
||||||
mcl_weather.skycolor.active = true
|
mcl_weather.skycolor.active = true
|
||||||
|
@ -71,7 +73,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
mcl_weather.snow.init_done = true
|
mcl_weather.snow.init_done = true
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in pairs(get_connected_players()) do
|
||||||
if (mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:get_pos())) then
|
if (mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:get_pos())) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
local get_connected_players = minetest.get_connected_players
|
||||||
|
|
||||||
-- turn off lightning mod 'auto mode'
|
-- turn off lightning mod 'auto mode'
|
||||||
lightning.auto = false
|
lightning.auto = false
|
||||||
|
|
||||||
|
@ -25,7 +27,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
{r=40, g=40, b=40},
|
{r=40, g=40, b=40},
|
||||||
{r=0, g=0, b=0}})
|
{r=0, g=0, b=0}})
|
||||||
mcl_weather.skycolor.active = true
|
mcl_weather.skycolor.active = true
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in pairs(get_connected_players()) do
|
||||||
player:set_clouds({color="#3D3D3FE8"})
|
player:set_clouds({color="#3D3D3FE8"})
|
||||||
end
|
end
|
||||||
mcl_weather.thunder.init_done = true
|
mcl_weather.thunder.init_done = true
|
||||||
|
|
|
@ -38,6 +38,7 @@ mcl_weather.reg_weathers["none"] = {
|
||||||
local storage = minetest.get_mod_storage()
|
local storage = minetest.get_mod_storage()
|
||||||
-- Save weather into mod storage, so it can be loaded after restarting the server
|
-- Save weather into mod storage, so it can be loaded after restarting the server
|
||||||
local save_weather = function()
|
local save_weather = function()
|
||||||
|
if not mcl_weather.end_time then return end
|
||||||
storage:set_string("mcl_weather_state", mcl_weather.state)
|
storage:set_string("mcl_weather_state", mcl_weather.state)
|
||||||
storage:set_int("mcl_weather_end_time", mcl_weather.end_time)
|
storage:set_int("mcl_weather_end_time", mcl_weather.end_time)
|
||||||
minetest.log("verbose", "[mcl_weather] Weather data saved: state="..mcl_weather.state.." end_time="..mcl_weather.end_time)
|
minetest.log("verbose", "[mcl_weather] Weather data saved: state="..mcl_weather.state.." end_time="..mcl_weather.end_time)
|
||||||
|
|
|
@ -118,7 +118,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
if main_timer > mcl_hbarmor.tick or timer > 4 then
|
if main_timer > mcl_hbarmor.tick or timer > 4 then
|
||||||
if minetest.settings:get_bool("enable_damage") then
|
if minetest.settings:get_bool("enable_damage") then
|
||||||
if main_timer > mcl_hbarmor.tick then main_timer = 0 end
|
if main_timer > mcl_hbarmor.tick then main_timer = 0 end
|
||||||
for _,player in ipairs(minetest.get_connected_players()) do
|
for _,player in pairs(minetest.get_connected_players()) do
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
if mcl_hbarmor.player_active[name] == true then
|
if mcl_hbarmor.player_active[name] == true then
|
||||||
local ret = mcl_hbarmor.get_armor(player)
|
local ret = mcl_hbarmor.get_armor(player)
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
mesecons
|
|
||||||
mcl_sounds
|
|
||||||
doc?
|
|
||||||
screwdriver?
|
|
|
@ -1,2 +1,3 @@
|
||||||
name = mcl_comparators
|
name = mcl_comparators
|
||||||
depends = mcl_wip
|
depends = mcl_wip, mesecons, mcl_sounds
|
||||||
|
optional_depends = doc, screwdriver
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
mcl_init
|
|
||||||
mcl_formspec
|
|
||||||
mesecons
|
|
||||||
mcl_sounds
|
|
||||||
mcl_tnt
|
|
||||||
mcl_worlds
|
|
||||||
mcl_core
|
|
||||||
mcl_nether
|
|
||||||
mcl_armor_stand
|
|
||||||
mcl_armor
|
|
||||||
doc?
|
|
||||||
screwdriver?
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
name = mcl_dispensers
|
||||||
|
depends = mcl_init, mcl_formspec, mesecons, mcl_sounds, mcl_tnt, mcl_worlds, mcl_core, mcl_nether, mcl_armor_stand, mcl_armor
|
||||||
|
optional_depends = doc, screwdriver
|
|
@ -1,6 +0,0 @@
|
||||||
mcl_init
|
|
||||||
mcl_formspec
|
|
||||||
mesecons
|
|
||||||
mcl_util
|
|
||||||
doc?
|
|
||||||
screwdriver?
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
name = mcl_droppers
|
||||||
|
depends = mcl_init, mcl_formspec, mesecons, mcl_util
|
||||||
|
optional_depends = doc, screwdriver
|
|
@ -1,2 +0,0 @@
|
||||||
mesecons
|
|
||||||
mcl_util
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = mcl_observers
|
||||||
|
depends = mesecons, mcl_util
|
|
@ -22,7 +22,7 @@ function mesecon.queue:add_action(pos, func, params, time, overwritecheck, prior
|
||||||
local toremove = nil
|
local toremove = nil
|
||||||
-- Otherwise, add the action to the queue
|
-- Otherwise, add the action to the queue
|
||||||
if overwritecheck then -- check if old action has to be overwritten / removed:
|
if overwritecheck then -- check if old action has to be overwritten / removed:
|
||||||
for i, ac in ipairs(mesecon.queue.actions) do
|
for i, ac in pairs(mesecon.queue.actions) do
|
||||||
if(vector.equals(pos, ac.pos)
|
if(vector.equals(pos, ac.pos)
|
||||||
and mesecon.cmpAny(overwritecheck, ac.owcheck)) then
|
and mesecon.cmpAny(overwritecheck, ac.owcheck)) then
|
||||||
toremove = i
|
toremove = i
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
mcl_sounds
|
|
||||||
mcl_core
|
|
||||||
doc?
|
|
|
@ -75,10 +75,10 @@ mesecon.queue:add_function("receptor_on", function (pos, rules)
|
||||||
rules = rules or mesecon.rules.default
|
rules = rules or mesecon.rules.default
|
||||||
|
|
||||||
-- Call turnon on all linking positions
|
-- Call turnon on all linking positions
|
||||||
for _, rule in ipairs(mesecon.flattenrules(rules)) do
|
for _, rule in pairs(mesecon.flattenrules(rules)) do
|
||||||
local np = vector.add(pos, rule)
|
local np = vector.add(pos, rule)
|
||||||
local rulenames = mesecon.rules_link_rule_all(pos, rule)
|
local rulenames = mesecon.rules_link_rule_all(pos, rule)
|
||||||
for _, rulename in ipairs(rulenames) do
|
for _, rulename in pairs(rulenames) do
|
||||||
mesecon.turnon(np, rulename)
|
mesecon.turnon(np, rulename)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
name = mesecons
|
||||||
|
depends = mcl_sounds, mcl_core
|
||||||
|
optional_depends = doc
|
|
@ -1 +0,0 @@
|
||||||
mesecons
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = mesecons_alias
|
||||||
|
depends = mesecons
|
|
@ -1,2 +0,0 @@
|
||||||
mesecons
|
|
||||||
doc?
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
name = mesecons_button
|
||||||
|
depends = mesecons
|
||||||
|
optional_depends = doc
|
|
@ -1,3 +0,0 @@
|
||||||
mesecons
|
|
||||||
doc?
|
|
||||||
doc_items?
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
name = mesecons_commandblock
|
||||||
|
depends = mesecons
|
||||||
|
optional_depends = doc, doc_items
|
|
@ -1,3 +0,0 @@
|
||||||
mesecons
|
|
||||||
doc?
|
|
||||||
screwdriver?
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
name = mesecons_delayer
|
||||||
|
depends = mesecons
|
||||||
|
optional_depends = doc, screwdriver
|
|
@ -1,2 +0,0 @@
|
||||||
mesecons
|
|
||||||
doc?
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
name = mesecons_lightstone
|
||||||
|
depends = mesecons
|
||||||
|
optional_depends = doc
|
|
@ -1 +0,0 @@
|
||||||
mesecons
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = mesecons_mvps
|
||||||
|
depends = mesecons
|
|
@ -1,2 +0,0 @@
|
||||||
mesecons
|
|
||||||
mcl_particles
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = mesecons_noteblock
|
||||||
|
depends = mesecons, mcl_particles
|
|
@ -1,5 +0,0 @@
|
||||||
mesecons
|
|
||||||
mesecons_mvps
|
|
||||||
mcl_mobitems
|
|
||||||
doc?
|
|
||||||
screwdriver?
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
name = mesecons_pistons
|
||||||
|
depends = mesecons, mesecons_mvps, mcl_mobitems
|
||||||
|
optional_depends = doc, screwdriver
|
|
@ -1,2 +0,0 @@
|
||||||
mesecons
|
|
||||||
doc?
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
name = mesecons_pressureplates
|
||||||
|
depends = mesecons
|
||||||
|
optional_depends = doc
|
|
@ -1,2 +0,0 @@
|
||||||
mesecons
|
|
||||||
doc?
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
name = mesecons_solarpanel
|
||||||
|
depends = mesecons
|
||||||
|
optional_depends = doc
|
|
@ -1,3 +0,0 @@
|
||||||
mesecons
|
|
||||||
mcl_torches
|
|
||||||
doc?
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
name = mesecons_torch
|
||||||
|
depends = mesecons, mcl_torches
|
||||||
|
optional_depends = doc
|
|
@ -1,2 +0,0 @@
|
||||||
mesecons
|
|
||||||
doc?
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
name = mesecons_walllever
|
||||||
|
depends = mesecons
|
||||||
|
optional_depends = doc
|
|
@ -1,2 +0,0 @@
|
||||||
mesecons
|
|
||||||
doc?
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
name = mesecons_wires
|
||||||
|
depends = mesecons
|
||||||
|
optional_depends = doc
|
|
@ -36,7 +36,7 @@ local function check_in_beds(players)
|
||||||
players = minetest.get_connected_players()
|
players = minetest.get_connected_players()
|
||||||
end
|
end
|
||||||
|
|
||||||
for n, player in ipairs(players) do
|
for n, player in pairs(players) do
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
if not in_bed[name] then
|
if not in_bed[name] then
|
||||||
return false
|
return false
|
||||||
|
@ -102,8 +102,7 @@ local function lay_down(player, pos, bed_pos, state, skip)
|
||||||
-- No sleeping if monsters nearby.
|
-- No sleeping if monsters nearby.
|
||||||
-- The exceptions above apply.
|
-- The exceptions above apply.
|
||||||
-- Zombie pigmen only prevent sleep while they are hostle.
|
-- Zombie pigmen only prevent sleep while they are hostle.
|
||||||
local objs = minetest.get_objects_inside_radius(bed_pos, 8)
|
for _, obj in pairs(minetest.get_objects_inside_radius(bed_pos, 8)) do
|
||||||
for _, obj in ipairs(objs) do
|
|
||||||
if obj ~= nil and not obj:is_player() then
|
if obj ~= nil and not obj:is_player() then
|
||||||
local ent = obj:get_luaentity()
|
local ent = obj:get_luaentity()
|
||||||
local mobname = ent.name
|
local mobname = ent.name
|
||||||
|
|
|
@ -15,6 +15,20 @@ local dir_to_pitch = function(dir)
|
||||||
return -math.atan2(-dir.y, xz)
|
return -math.atan2(-dir.y, xz)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local random_arrow_positions = function(positions, placement)
|
||||||
|
if positions == 'x' then
|
||||||
|
return math.random(-4, 4)
|
||||||
|
elseif positions == 'y' then
|
||||||
|
return math.random(0, 10)
|
||||||
|
end
|
||||||
|
if placement == 'front' and positions == 'z' then
|
||||||
|
return 3
|
||||||
|
elseif placement == 'back' and positions == 'z' then
|
||||||
|
return -3
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
local mod_awards = minetest.get_modpath("awards") and minetest.get_modpath("mcl_achievements")
|
local mod_awards = minetest.get_modpath("awards") and minetest.get_modpath("mcl_achievements")
|
||||||
local mod_button = minetest.get_modpath("mesecons_button")
|
local mod_button = minetest.get_modpath("mesecons_button")
|
||||||
|
|
||||||
|
@ -96,11 +110,23 @@ end
|
||||||
ARROW_ENTITY.on_step = function(self, dtime)
|
ARROW_ENTITY.on_step = function(self, dtime)
|
||||||
mcl_burning.tick(self.object, dtime)
|
mcl_burning.tick(self.object, dtime)
|
||||||
|
|
||||||
|
self._time_in_air = self._time_in_air + .001
|
||||||
|
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
local dpos = table.copy(pos) -- digital pos
|
local dpos = table.copy(pos) -- digital pos
|
||||||
dpos = vector.round(dpos)
|
dpos = vector.round(dpos)
|
||||||
local node = minetest.get_node(dpos)
|
local node = minetest.get_node(dpos)
|
||||||
|
|
||||||
|
if self.object:get_attach() ~= nil and self.object:get_attach(parent):get_hp() < 1 then
|
||||||
|
self.object:remove()
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_leaveplayer(function(player)
|
||||||
|
if self.object:get_attach(parent) == player then
|
||||||
|
self.object:remove()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
if self._stuck then
|
if self._stuck then
|
||||||
self._stucktimer = self._stucktimer + dtime
|
self._stucktimer = self._stucktimer + dtime
|
||||||
self._stuckrechecktimer = self._stuckrechecktimer + dtime
|
self._stuckrechecktimer = self._stuckrechecktimer + dtime
|
||||||
|
@ -146,7 +172,7 @@ ARROW_ENTITY.on_step = function(self, dtime)
|
||||||
-- Check for object "collision". Done every tick (hopefully this is not too stressing)
|
-- Check for object "collision". Done every tick (hopefully this is not too stressing)
|
||||||
else
|
else
|
||||||
|
|
||||||
if self._damage >= 9 then
|
if self._damage >= 9 and self._in_player == false then
|
||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 1,
|
amount = 1,
|
||||||
time = .001,
|
time = .001,
|
||||||
|
@ -180,10 +206,10 @@ ARROW_ENTITY.on_step = function(self, dtime)
|
||||||
for k, obj in pairs(objs) do
|
for k, obj in pairs(objs) do
|
||||||
local ok = false
|
local ok = false
|
||||||
-- Arrows can only damage players and mobs
|
-- Arrows can only damage players and mobs
|
||||||
if obj ~= self._shooter and obj:is_player() then
|
if obj:is_player() then
|
||||||
ok = true
|
ok = true
|
||||||
elseif obj:get_luaentity() ~= nil then
|
elseif obj:get_luaentity() ~= nil then
|
||||||
if obj ~= self._shooter and (obj:get_luaentity()._cmi_is_mob or obj:get_luaentity()._hittable_by_projectile) then
|
if (obj:get_luaentity()._cmi_is_mob or obj:get_luaentity()._hittable_by_projectile) then
|
||||||
ok = true
|
ok = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -201,11 +227,12 @@ ARROW_ENTITY.on_step = function(self, dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If an attackable object was found, we will damage the closest one only
|
-- If an attackable object was found, we will damage the closest one only
|
||||||
|
|
||||||
if closest_object ~= nil then
|
if closest_object ~= nil then
|
||||||
local obj = closest_object
|
local obj = closest_object
|
||||||
local is_player = obj:is_player()
|
local is_player = obj:is_player()
|
||||||
local lua = obj:get_luaentity()
|
local lua = obj:get_luaentity()
|
||||||
if obj ~= self._shooter and (is_player or (lua and (lua._cmi_is_mob or lua._hittable_by_projectile))) then
|
if obj == self._shooter and self._time_in_air > 1.02 or obj ~= self._shooter and (is_player or (lua and (lua._cmi_is_mob or lua._hittable_by_projectile))) then
|
||||||
if obj:get_hp() > 0 then
|
if obj:get_hp() > 0 then
|
||||||
-- Check if there is no solid node between arrow and object
|
-- Check if there is no solid node between arrow and object
|
||||||
local ray = minetest.raycast(self.object:get_pos(), obj:get_pos(), true)
|
local ray = minetest.raycast(self.object:get_pos(), obj:get_pos(), true)
|
||||||
|
@ -230,19 +257,60 @@ ARROW_ENTITY.on_step = function(self, dtime)
|
||||||
if obj:is_player() and rawget(_G, "armor") and armor.last_damage_types then
|
if obj:is_player() and rawget(_G, "armor") and armor.last_damage_types then
|
||||||
armor.last_damage_types[obj:get_player_name()] = "projectile"
|
armor.last_damage_types[obj:get_player_name()] = "projectile"
|
||||||
end
|
end
|
||||||
damage_particles(self.object:get_pos(), self._is_critical)
|
if self._in_player == false then
|
||||||
|
damage_particles(self.object:get_pos(), self._is_critical)
|
||||||
|
end
|
||||||
if mcl_burning.is_burning(self.object) then
|
if mcl_burning.is_burning(self.object) then
|
||||||
mcl_burning.set_on_fire(obj, 5)
|
mcl_burning.set_on_fire(obj, 5)
|
||||||
end
|
end
|
||||||
obj:punch(self.object, 1.0, {
|
if self._in_player == false then
|
||||||
full_punch_interval=1.0,
|
obj:punch(self.object, 1.0, {
|
||||||
damage_groups={fleshy=self._damage},
|
full_punch_interval=1.0,
|
||||||
}, self.object:get_velocity())
|
damage_groups={fleshy=self._damage},
|
||||||
|
}, self.object:get_velocity())
|
||||||
|
if obj:is_player() then
|
||||||
|
local placement = ''
|
||||||
|
self._placement = math.random(1, 2)
|
||||||
|
if self._placement == 1 then
|
||||||
|
placement = 'front'
|
||||||
|
else
|
||||||
|
placement = 'back'
|
||||||
|
end
|
||||||
|
self._in_player = true
|
||||||
|
if self._placement == 2 then
|
||||||
|
self._rotation_station = 90
|
||||||
|
else
|
||||||
|
self._rotation_station = -90
|
||||||
|
end
|
||||||
|
self._y_position = random_arrow_positions('y', placement)
|
||||||
|
self._x_position = random_arrow_positions('x', placement)
|
||||||
|
if self._y_position > 6 and self._x_position < 2 and self._x_position > -2 then
|
||||||
|
self._attach_parent = 'Head'
|
||||||
|
self._y_position = self._y_position - 6
|
||||||
|
elseif self._x_position > 2 then
|
||||||
|
self._attach_parent = 'Arm_Right'
|
||||||
|
self._y_position = self._y_position - 3
|
||||||
|
self._x_position = self._x_position - 2
|
||||||
|
elseif self._x_position < -2 then
|
||||||
|
self._attach_parent = 'Arm_Left'
|
||||||
|
self._y_position = self._y_position - 3
|
||||||
|
self._x_position = self._x_position + 2
|
||||||
|
else
|
||||||
|
self._attach_parent = 'Body'
|
||||||
|
end
|
||||||
|
self._z_rotation = math.random(-30, 30)
|
||||||
|
self._y_rotation = math.random( -30, 30)
|
||||||
|
self.object:set_attach(obj, self._attach_parent, {x=self._x_position,y=self._y_position,z=random_arrow_positions('z', placement)}, {x=0,y=self._rotation_station + self._y_rotation,z=self._z_rotation})
|
||||||
|
minetest.after(150, function()
|
||||||
|
self.object:remove()
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if is_player then
|
if is_player then
|
||||||
if self._shooter and self._shooter:is_player() then
|
if self._shooter and self._shooter:is_player() and self._in_player == false then
|
||||||
-- “Ding” sound for hitting another player
|
-- “Ding” sound for hitting another player
|
||||||
minetest.sound_play({name="mcl_bows_hit_player", gain=0.1}, {to_player=self._shooter:get_player_name()}, true)
|
minetest.sound_play({name="mcl_bows_hit_player", gain=0.1}, {to_player=self._shooter:get_player_name()}, true)
|
||||||
end
|
end
|
||||||
|
@ -259,10 +327,14 @@ ARROW_ENTITY.on_step = function(self, dtime)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
minetest.sound_play({name="mcl_bows_hit_other", gain=0.3}, {pos=self.object:get_pos(), max_hear_distance=16}, true)
|
if self._in_player == false then
|
||||||
|
minetest.sound_play({name="mcl_bows_hit_other", gain=0.3}, {pos=self.object:get_pos(), max_hear_distance=16}, true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not obj:is_player() then
|
||||||
|
mcl_burning.extinguish(self.object)
|
||||||
|
self.object:remove()
|
||||||
end
|
end
|
||||||
mcl_burning.extinguish(self.object)
|
|
||||||
self.object:remove()
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -389,6 +461,8 @@ ARROW_ENTITY.get_staticdata = function(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
ARROW_ENTITY.on_activate = function(self, staticdata, dtime_s)
|
ARROW_ENTITY.on_activate = function(self, staticdata, dtime_s)
|
||||||
|
self._time_in_air = 1.0
|
||||||
|
self._in_player = false
|
||||||
local data = minetest.deserialize(staticdata)
|
local data = minetest.deserialize(staticdata)
|
||||||
if data then
|
if data then
|
||||||
self._stuck = data.stuck
|
self._stuck = data.stuck
|
||||||
|
|
|
@ -341,7 +341,7 @@ controls.register_on_hold(function(player, key, time)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in pairs(minetest.get_connected_players()) do
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local wielditem = player:get_wielded_item()
|
local wielditem = player:get_wielded_item()
|
||||||
local wieldindex = player:get_wield_index()
|
local wieldindex = player:get_wield_index()
|
||||||
|
|
|
@ -65,7 +65,7 @@ function mcl_buckets.register_liquid(def)
|
||||||
_doc_items_usagehelp = def.usagehelp,
|
_doc_items_usagehelp = def.usagehelp,
|
||||||
_tt_help = def.tt_help,
|
_tt_help = def.tt_help,
|
||||||
inventory_image = def.inventory_image,
|
inventory_image = def.inventory_image,
|
||||||
stack_max = 16,
|
stack_max = 1,
|
||||||
groups = def.groups,
|
groups = def.groups,
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
on_place = function(itemstack, user, pointed_thing)
|
||||||
-- Must be pointing to node
|
-- Must be pointing to node
|
||||||
|
@ -92,7 +92,7 @@ function mcl_buckets.register_liquid(def)
|
||||||
-- Check if pointing to a buildable node
|
-- Check if pointing to a buildable node
|
||||||
local item = itemstack:get_name()
|
local item = itemstack:get_name()
|
||||||
|
|
||||||
if extra_check and extra_check(place_pos, user) == false then
|
if def.extra_check and def.extra_check(place_pos, user) == false then
|
||||||
-- Fail placement of liquid
|
-- Fail placement of liquid
|
||||||
elseif minetest.registered_nodes[nn] and minetest.registered_nodes[nn].buildable_to then
|
elseif minetest.registered_nodes[nn] and minetest.registered_nodes[nn].buildable_to then
|
||||||
-- buildable; replace the node
|
-- buildable; replace the node
|
||||||
|
|
|
@ -2,6 +2,20 @@ local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
local mod_mcl_core = minetest.get_modpath("mcl_core")
|
local mod_mcl_core = minetest.get_modpath("mcl_core")
|
||||||
local mod_mclx_core = minetest.get_modpath("mclx_core")
|
local mod_mclx_core = minetest.get_modpath("mclx_core")
|
||||||
|
|
||||||
|
local sound_place = function(itemname, pos)
|
||||||
|
local def = minetest.registered_nodes[itemname]
|
||||||
|
if def and def.sounds and def.sounds.place then
|
||||||
|
minetest.sound_play(def.sounds.place, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}, true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local sound_take = function(itemname, pos)
|
||||||
|
local def = minetest.registered_nodes[itemname]
|
||||||
|
if def and def.sounds and def.sounds.dug then
|
||||||
|
minetest.sound_play(def.sounds.dug, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}, true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if mod_mcl_core then
|
if mod_mcl_core then
|
||||||
-- Lava bucket
|
-- Lava bucket
|
||||||
mcl_buckets.register_liquid({
|
mcl_buckets.register_liquid({
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
mcl_core
|
|
||||||
mclx_core?
|
|
||||||
mcl_sounds
|
|
||||||
doc?
|
|
|
@ -131,7 +131,7 @@ minetest.register_abm({
|
||||||
interval = 0.5,
|
interval = 0.5,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
for _, obj in ipairs(minetest.get_objects_inside_radius(pos, 0.4)) do
|
for _, obj in pairs(minetest.get_objects_inside_radius(pos, 0.4)) do
|
||||||
if mcl_burning.is_burning(obj) then
|
if mcl_burning.is_burning(obj) then
|
||||||
mcl_burning.extinguish(obj)
|
mcl_burning.extinguish(obj)
|
||||||
local new_group = minetest.get_item_group(node.name, "cauldron_filled") - 1
|
local new_group = minetest.get_item_group(node.name, "cauldron_filled") - 1
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
name = mcl_cauldrons
|
name = mcl_cauldrons
|
||||||
|
depends = mcl_core, mcl_sounds
|
||||||
|
optional_depends = mclx_core, doc
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
mcl_init
|
|
||||||
mcl_formspec
|
|
||||||
mcl_core
|
|
||||||
mcl_sounds
|
|
||||||
mcl_end
|
|
||||||
mesecons
|
|
||||||
doc?
|
|
||||||
screwdriver?
|
|
|
@ -11,10 +11,8 @@ local entity_animations = {
|
||||||
},
|
},
|
||||||
chest = {
|
chest = {
|
||||||
speed = 25,
|
speed = 25,
|
||||||
open = {x = 0, y = 10},
|
open = {x = 0, y = 7},
|
||||||
open_partly = {x = 0, y = 7},
|
close = {x = 13, y = 20},
|
||||||
close = {x = 10, y = 20},
|
|
||||||
close_partly = {x = 13, y = 20},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,15 +32,14 @@ minetest.register_entity("mcl_chests:chest", {
|
||||||
self.object:set_animation(anim, anim_table.speed, 0, false)
|
self.object:set_animation(anim, anim_table.speed, 0, false)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
open = function(self, playername, partly)
|
open = function(self, playername)
|
||||||
self.players[playername] = true
|
self.players[playername] = true
|
||||||
if not self.is_open then
|
if not self.is_open then
|
||||||
self:set_animation(partly and "open_partly" or "open")
|
self:set_animation("open")
|
||||||
minetest.sound_play(self.sound_prefix .. "_open", {
|
minetest.sound_play(self.sound_prefix .. "_open", {
|
||||||
pos = self.node_pos,
|
pos = self.node_pos,
|
||||||
})
|
})
|
||||||
self.is_open = true
|
self.is_open = true
|
||||||
self.opened_partly = partly
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -53,12 +50,11 @@ minetest.register_entity("mcl_chests:chest", {
|
||||||
for _ in pairs(playerlist) do
|
for _ in pairs(playerlist) do
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self:set_animation(self.opened_partly and "close_partly" or "close")
|
self:set_animation("close")
|
||||||
minetest.sound_play(self.sound_prefix .. "_close", {
|
minetest.sound_play(self.sound_prefix .. "_close", {
|
||||||
pos = self.node_pos,
|
pos = self.node_pos,
|
||||||
})
|
})
|
||||||
self.is_open = false
|
self.is_open = false
|
||||||
self.opened_partly = false
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -118,7 +114,7 @@ local function get_entity_pos(pos, dir, double)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function find_entity(pos)
|
local function find_entity(pos)
|
||||||
for _, obj in ipairs(minetest.get_objects_inside_radius(pos, 0)) do
|
for _, obj in pairs(minetest.get_objects_inside_radius(pos, 0)) do
|
||||||
local luaentity = obj:get_luaentity()
|
local luaentity = obj:get_luaentity()
|
||||||
if luaentity and luaentity.name == "mcl_chests:chest" then
|
if luaentity and luaentity.name == "mcl_chests:chest" then
|
||||||
return luaentity
|
return luaentity
|
||||||
|
@ -179,8 +175,7 @@ local player_chest_open = function(player, pos, node_name, textures, param2, dou
|
||||||
open_chests[name] = {pos = pos, node_name = node_name, textures = textures, param2 = param2, double = double, sound = sound, mesh = mesh, shulker = shulker}
|
open_chests[name] = {pos = pos, node_name = node_name, textures = textures, param2 = param2, double = double, sound = sound, mesh = mesh, shulker = shulker}
|
||||||
if animate_chests then
|
if animate_chests then
|
||||||
local dir = minetest.facedir_to_dir(param2)
|
local dir = minetest.facedir_to_dir(param2)
|
||||||
local blocked = not shulker and (back_is_blocked(pos, dir) or double and back_is_blocked(mcl_util.get_double_container_neighbor_pos(pos, param2, node_name:sub(-4)), dir))
|
find_or_create_entity(pos, node_name, textures, param2, double, sound, mesh, shulker and "shulker" or "chest", dir):open(name)
|
||||||
find_or_create_entity(pos, node_name, textures, param2, double, sound, mesh, shulker and "shulker" or "chest", dir):open(name, blocked)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
name = mcl_chests
|
||||||
|
depends = mcl_init, mcl_formspec, mcl_core, mcl_sounds, mcl_end, mesecons
|
||||||
|
optional_depends = doc, screwdriver
|
|
@ -1,4 +0,0 @@
|
||||||
mcl_init
|
|
||||||
mcl_worlds
|
|
||||||
mesecons
|
|
||||||
doc?
|
|
|
@ -1 +0,0 @@
|
||||||
A fantasy clock item roughly shows the time of day.
|
|
|
@ -94,9 +94,8 @@ minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
watch.old_time = now
|
watch.old_time = now
|
||||||
|
|
||||||
local players = minetest.get_connected_players()
|
for p, player in pairs(minetest.get_connected_players()) do
|
||||||
for p, player in ipairs(players) do
|
for s, stack in pairs(player:get_inventory():get_list("main")) do
|
||||||
for s, stack in ipairs(player:get_inventory():get_list("main")) do
|
|
||||||
local dim = mcl_worlds.pos_to_dimension(player:get_pos())
|
local dim = mcl_worlds.pos_to_dimension(player:get_pos())
|
||||||
local frame
|
local frame
|
||||||
-- Clocks do not work in certain zones
|
-- Clocks do not work in certain zones
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
name = mcl_clock
|
name = mcl_clock
|
||||||
|
description = A fantasy clock item roughly shows the time of day.
|
||||||
|
depends = mcl_init, mcl_worlds, mesecons
|
||||||
|
optional_depends = doc
|
||||||
|
|
|
@ -19,7 +19,7 @@ function mcl_cocoas.place(itemstack, placer, pt, plantname)
|
||||||
-- Am I right-clicking on something that has a custom on_rightclick set?
|
-- Am I right-clicking on something that has a custom on_rightclick set?
|
||||||
if placer and not placer:get_player_control().sneak then
|
if placer and not placer:get_player_control().sneak then
|
||||||
if minetest.registered_nodes[under.name] and minetest.registered_nodes[under.name].on_rightclick then
|
if minetest.registered_nodes[under.name] and minetest.registered_nodes[under.name].on_rightclick then
|
||||||
return minetest.registered_nodes[under.name].on_rightclick(pointed_thing.under, under, placer, itemstack) or itemstack
|
return minetest.registered_nodes[under.name].on_rightclick(pt.under, under, placer, itemstack) or itemstack
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
mcl_core
|
|
||||||
mcl_sounds
|
|
||||||
mcl_dye
|
|
||||||
doc?
|
|
||||||
screwdriver?
|
|
|
@ -1 +0,0 @@
|
||||||
Adds blocks which can be colored, namely hardened clay.
|
|
|
@ -1 +1,4 @@
|
||||||
name = mcl_colorblocks
|
name = mcl_colorblocks
|
||||||
|
description = Adds blocks which can be colored, namely hardened clay.
|
||||||
|
depends = mcl_core, mcl_sounds, mcl_dye
|
||||||
|
optional_depends = doc, screwdriver
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
mcl_core
|
|
||||||
mcl_worlds
|
|
||||||
mesecons
|
|
||||||
doc?
|
|
|
@ -1 +0,0 @@
|
||||||
A compass item which points towards the world origin.
|
|
|
@ -14,15 +14,14 @@ local random_frame = math.random(0, compass_frames-1)
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
random_timer = random_timer + dtime
|
random_timer = random_timer + dtime
|
||||||
local players = minetest.get_connected_players()
|
|
||||||
|
|
||||||
if random_timer >= random_timer_trigger then
|
if random_timer >= random_timer_trigger then
|
||||||
random_frame = (random_frame + math.random(-1, 1)) % compass_frames
|
random_frame = (random_frame + math.random(-1, 1)) % compass_frames
|
||||||
random_timer = 0
|
random_timer = 0
|
||||||
end
|
end
|
||||||
for i,player in ipairs(players) do
|
for i,player in pairs(minetest.get_connected_players()) do
|
||||||
local function has_compass(player)
|
local function has_compass(player)
|
||||||
for _,stack in ipairs(player:get_inventory():get_list("main")) do
|
for _,stack in pairs(player:get_inventory():get_list("main")) do
|
||||||
if minetest.get_item_group(stack:get_name(), "compass") ~= 0 then
|
if minetest.get_item_group(stack:get_name(), "compass") ~= 0 then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -53,7 +52,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
compass_image = math.floor((angle_relative/11.25) + 0.5) % compass_frames
|
compass_image = math.floor((angle_relative/11.25) + 0.5) % compass_frames
|
||||||
end
|
end
|
||||||
|
|
||||||
for j,stack in ipairs(player:get_inventory():get_list("main")) do
|
for j,stack in pairs(player:get_inventory():get_list("main")) do
|
||||||
if minetest.get_item_group(stack:get_name(), "compass") ~= 0 and
|
if minetest.get_item_group(stack:get_name(), "compass") ~= 0 and
|
||||||
minetest.get_item_group(stack:get_name(), "compass")-1 ~= compass_image then
|
minetest.get_item_group(stack:get_name(), "compass")-1 ~= compass_image then
|
||||||
local itemname = "mcl_compass:"..compass_image
|
local itemname = "mcl_compass:"..compass_image
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
name = mcl_compass
|
name = mcl_compass
|
||||||
|
description = A compass item which points towards the world origin.
|
||||||
|
depends = mcl_core, mcl_worlds, mesecons
|
||||||
|
optional_depends = doc
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
mcl_init
|
|
||||||
mcl_sounds
|
|
||||||
mcl_particles
|
|
||||||
mcl_util
|
|
||||||
mcl_worlds
|
|
||||||
doc_items
|
|
||||||
doc?
|
|
||||||
mcl_enchanting
|
|
|
@ -1 +0,0 @@
|
||||||
Core items of MineClone 2: Basic biome blocks (dirt, sand, stones, etc.), derived items, glass, sugar cane, cactus, barrier, mining tools, hand, craftitems, and misc. items which don't really fit anywhere else.
|
|
|
@ -1378,7 +1378,7 @@ minetest.register_abm({
|
||||||
if not do_preserve then
|
if not do_preserve then
|
||||||
-- Drop stuff other than the node itself
|
-- Drop stuff other than the node itself
|
||||||
local itemstacks = minetest.get_node_drops(n0.name)
|
local itemstacks = minetest.get_node_drops(n0.name)
|
||||||
for _, itemname in ipairs(itemstacks) do
|
for _, itemname in pairs(itemstacks) do
|
||||||
local p_drop = {
|
local p_drop = {
|
||||||
x = p0.x - 0.5 + math.random(),
|
x = p0.x - 0.5 + math.random(),
|
||||||
y = p0.y - 0.5 + math.random(),
|
y = p0.y - 0.5 + math.random(),
|
||||||
|
|
|
@ -3,6 +3,19 @@ mcl_core = {}
|
||||||
-- Repair percentage for toolrepair
|
-- Repair percentage for toolrepair
|
||||||
mcl_core.repair = 0.05
|
mcl_core.repair = 0.05
|
||||||
|
|
||||||
|
mcl_autogroup.register_diggroup("handy")
|
||||||
|
mcl_autogroup.register_diggroup("pickaxey", {
|
||||||
|
levels = { "wood", "gold", "stone", "iron", "diamond" }
|
||||||
|
})
|
||||||
|
mcl_autogroup.register_diggroup("axey")
|
||||||
|
mcl_autogroup.register_diggroup("shovely")
|
||||||
|
mcl_autogroup.register_diggroup("shearsy")
|
||||||
|
mcl_autogroup.register_diggroup("shearsy_wool")
|
||||||
|
mcl_autogroup.register_diggroup("shearsy_cobweb")
|
||||||
|
mcl_autogroup.register_diggroup("swordy")
|
||||||
|
mcl_autogroup.register_diggroup("swordy_cobweb")
|
||||||
|
mcl_autogroup.register_diggroup("hoey")
|
||||||
|
|
||||||
-- Load files
|
-- Load files
|
||||||
local modpath = minetest.get_modpath("mcl_core")
|
local modpath = minetest.get_modpath("mcl_core")
|
||||||
dofile(modpath.."/functions.lua")
|
dofile(modpath.."/functions.lua")
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
name = mcl_core
|
name = mcl_core
|
||||||
|
description = Core items of MineClone 2: Basic biome blocks (dirt, sand, stones, etc.), derived items, glass, sugar cane, cactus, barrier, mining tools, hand, craftitems, and misc. items which don't really fit anywhere else.
|
||||||
|
depends = mcl_autogroup, mcl_init, mcl_sounds, mcl_particles, mcl_util, mcl_worlds, doc_items, mcl_enchanting
|
||||||
|
optional_depends = doc
|
||||||
|
|
|
@ -108,7 +108,7 @@ minetest.register_node("mcl_core:cobweb", {
|
||||||
liquid_renewable = false,
|
liquid_renewable = false,
|
||||||
liquid_range = 0,
|
liquid_range = 0,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
groups = {swordy_cobweb=1,shearsy=1, fake_liquid=1, disable_jump=1, deco_block=1, dig_by_piston=1, dig_by_water=1,destroy_by_lava_flow=1,},
|
groups = {swordy_cobweb=1, shearsy_cobweb=1, fake_liquid=1, disable_jump=1, deco_block=1, dig_by_piston=1, dig_by_water=1,destroy_by_lava_flow=1,},
|
||||||
drop = "mcl_mobitems:string",
|
drop = "mcl_mobitems:string",
|
||||||
_mcl_shears_drop = true,
|
_mcl_shears_drop = true,
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
|
|
|
@ -108,7 +108,19 @@ local register_leaves = function(subname, description, longdesc, tiles, sapling,
|
||||||
tiles = tiles,
|
tiles = tiles,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
groups = {handy=1,shearsy=1,swordy=1, leafdecay=leafdecay_distance, flammable=2, leaves=1, deco_block=1, dig_by_piston=1, fire_encouragement=30, fire_flammability=60},
|
groups = {
|
||||||
|
handy=1,
|
||||||
|
hoey=1,
|
||||||
|
shearsy=1,
|
||||||
|
swordy=1,
|
||||||
|
leafdecay=leafdecay_distance,
|
||||||
|
flammable=2,
|
||||||
|
leaves=1,
|
||||||
|
deco_block=1,
|
||||||
|
dig_by_piston=1,
|
||||||
|
fire_encouragement=30,
|
||||||
|
fire_flammability=60
|
||||||
|
},
|
||||||
drop = get_drops(0),
|
drop = get_drops(0),
|
||||||
_mcl_shears_drop = true,
|
_mcl_shears_drop = true,
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
|
|
|
@ -4,7 +4,7 @@ local S = minetest.get_translator("mcl_doors")
|
||||||
local function on_place_node(place_to, newnode,
|
local function on_place_node(place_to, newnode,
|
||||||
placer, oldnode, itemstack, pointed_thing)
|
placer, oldnode, itemstack, pointed_thing)
|
||||||
-- Run script hook
|
-- Run script hook
|
||||||
for _, callback in ipairs(minetest.registered_on_placenodes) do
|
for _, callback in pairs(minetest.registered_on_placenodes) do
|
||||||
-- Deep-copy pos, node and pointed_thing because callback can modify them
|
-- Deep-copy pos, node and pointed_thing because callback can modify them
|
||||||
local place_to_copy = {x = place_to.x, y = place_to.y, z = place_to.z}
|
local place_to_copy = {x = place_to.x, y = place_to.y, z = place_to.z}
|
||||||
local newnode_copy =
|
local newnode_copy =
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue