Compare commits
1 Commits
master
...
wallmounte
Author | SHA1 | Date |
---|---|---|
MysticTempest | 72eb1d6c3c |
|
@ -56,7 +56,6 @@ Please read <http://minecraft.gamepedia.com/Breaking> to learn how digging times
|
|||
* `no_eat_delay=1`: Only for foodstuffs. When eating this, all eating delays are ignored.
|
||||
* `can_eat_when_full=1`: Only for foodstuffs. This item can be eaten when the user has a full hunger bar
|
||||
* `attached_node_facedir=1`: Like `attached_node`, but for facedir nodes
|
||||
* `supported_node=1`: Like `attached_node`, but can be placed on any nodes that do not have the `drawtype="airlike"` attribute.
|
||||
* `cauldron`: Cauldron. 1: Empty. 2-4: Water height
|
||||
* `anvil`: Anvil. 1: No damage. 2-3: Higher damage levels
|
||||
* `no_rename=1`: Item cannot be renamed by anvil
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
An unofficial Minecraft-like game for Minetest. Forked from MineClone by davedevils.
|
||||
Developed by many people. Not developed or endorsed by Mojang AB.
|
||||
|
||||
Version: 0.73.0 (in development)
|
||||
Version: 0.72.0
|
||||
|
||||
### Gameplay
|
||||
You start in a randomly-generated world made entirely of cubes. You can explore
|
||||
|
@ -66,7 +66,7 @@ Use the `/giveme` chat command to obtain them. See the in-game help for
|
|||
an explanation.
|
||||
|
||||
## Installation
|
||||
This game requires [Minetest](http://minetest.net) to run (version 5.4.1 or
|
||||
This game requires [Minetest](http://minetest.net) to run (version 5.3.0 or
|
||||
later). So you need to install Minetest first. Only stable versions of Minetest
|
||||
are officially supported.
|
||||
There is no support for running MineClone2 in development versions of Minetest.
|
||||
|
|
|
@ -1,93 +1,29 @@
|
|||
-- Overrides the builtin minetest.check_single_for_falling.
|
||||
-- We need to do this in order to handle nodes in mineclone specific groups
|
||||
-- "supported_node" and "attached_node_facedir".
|
||||
--
|
||||
-- Nodes in group "supported_node" can be placed on any node that does not
|
||||
-- have the "airlike" drawtype. Carpets are an example of this type.
|
||||
|
||||
local vector = vector
|
||||
|
||||
local facedir_to_dir = minetest.facedir_to_dir
|
||||
local get_item_group = minetest.get_item_group
|
||||
local remove_node = minetest.remove_node
|
||||
local get_node = minetest.get_node
|
||||
local get_meta = minetest.get_meta
|
||||
local registered_nodes = minetest.registered_nodes
|
||||
local get_node_drops = minetest.get_node_drops
|
||||
local add_item = minetest.add_item
|
||||
|
||||
-- drop_attached_node(p)
|
||||
--
|
||||
-- This function is copied verbatim from minetest/builtin/game/falling.lua
|
||||
-- We need this to do the exact same dropping node handling in our override
|
||||
-- minetest.check_single_for_falling() function as in the builtin function.
|
||||
--
|
||||
local function drop_attached_node(p)
|
||||
local n = get_node(p)
|
||||
local drops = get_node_drops(n, "")
|
||||
local def = registered_nodes[n.name]
|
||||
if def and def.preserve_metadata then
|
||||
local oldmeta = get_meta(p):to_table().fields
|
||||
-- Copy pos and node because the callback can modify them.
|
||||
local pos_copy = vector.new(p)
|
||||
local node_copy = {name=n.name, param1=n.param1, param2=n.param2}
|
||||
local drop_stacks = {}
|
||||
for k, v in pairs(drops) do
|
||||
drop_stacks[k] = ItemStack(v)
|
||||
end
|
||||
drops = drop_stacks
|
||||
def.preserve_metadata(pos_copy, node_copy, oldmeta, drops)
|
||||
end
|
||||
if def and def.sounds and def.sounds.fall then
|
||||
core.sound_play(def.sounds.fall, {pos = p}, true)
|
||||
end
|
||||
remove_node(p)
|
||||
for _, item in pairs(drops) do
|
||||
local pos = {
|
||||
x = p.x + math.random()/2 - 0.25,
|
||||
y = p.y + math.random()/2 - 0.25,
|
||||
z = p.z + math.random()/2 - 0.25,
|
||||
}
|
||||
add_item(pos, item)
|
||||
end
|
||||
end
|
||||
|
||||
-- minetest.check_single_for_falling(pos)
|
||||
--
|
||||
-- * causes an unsupported `group:falling_node` node to fall and causes an
|
||||
-- unattached `group:attached_node` or `group:attached_node_facedir` node
|
||||
-- or unsupported `group:supported_node` node to drop.
|
||||
-- * does not spread these updates to neighbours.
|
||||
--
|
||||
-- Returns true if the node at <pos> has spawned a falling node or has been
|
||||
-- dropped as item(s).
|
||||
--
|
||||
local original_function = minetest.check_single_for_falling
|
||||
|
||||
function minetest.check_single_for_falling(pos)
|
||||
if original_function(pos) then
|
||||
return true
|
||||
end
|
||||
|
||||
local node = get_node(pos)
|
||||
local ret_o = original_function(pos)
|
||||
local ret = false
|
||||
local node = minetest.get_node(pos)
|
||||
if get_item_group(node.name, "attached_node_facedir") ~= 0 then
|
||||
local dir = facedir_to_dir(node.param2)
|
||||
if dir then
|
||||
if get_item_group(get_node(vector.add(pos, dir)).name, "solid") == 0 then
|
||||
drop_attached_node(pos)
|
||||
return true
|
||||
remove_node(pos)
|
||||
local drops = minetest.get_node_drops(node.name, "")
|
||||
for dr=1, #drops do
|
||||
minetest.add_item(pos, drops[dr])
|
||||
end
|
||||
ret = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if get_item_group(node.name, "supported_node") ~= 0 then
|
||||
local def = registered_nodes[get_node(vector.offset(pos, 0, -1, 0)).name]
|
||||
if def and def.drawtype == "airlike" then
|
||||
drop_attached_node(pos)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
return ret_o or ret
|
||||
end
|
||||
|
||||
|
|
|
@ -131,6 +131,17 @@ function mcl_burning.set_on_fire(obj, burn_time)
|
|||
if obj:is_player() then
|
||||
mcl_burning.update_hud(obj)
|
||||
end
|
||||
|
||||
-- FIXME: does this code make sense? It removes attached fire luaentities from
|
||||
-- another object that happen to be at the same position.
|
||||
local fire_luaentity = fire_entity:get_luaentity()
|
||||
for _, other in pairs(minetest.get_objects_inside_radius(fire_entity:get_pos(), 0)) do
|
||||
local other_luaentity = other:get_luaentity()
|
||||
if other_luaentity and other_luaentity.name == "mcl_burning:fire" and other_luaentity ~= fire_luaentity then
|
||||
other:remove()
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function mcl_burning.extinguish(obj)
|
||||
|
|
|
@ -57,7 +57,7 @@ minetest.register_on_joinplayer(function(player)
|
|||
local storage = {}
|
||||
local burn_data = player:get_meta():get_string("mcl_burning:data")
|
||||
if burn_data ~= "" then
|
||||
storage = minetest.deserialize(burn_data) or storage
|
||||
storage = minetest.deserialize(burn_data)
|
||||
end
|
||||
mcl_burning.storage[player] = storage
|
||||
if storage.burn_time and storage.burn_time > 0 then
|
||||
|
@ -98,7 +98,8 @@ minetest.register_entity("mcl_burning:fire", {
|
|||
glow = -1,
|
||||
backface_culling = false,
|
||||
},
|
||||
_mcl_animation_timer = 0,
|
||||
animation_frame = 0,
|
||||
animation_timer = 0,
|
||||
on_activate = function(self)
|
||||
self.object:set_sprite({x = 0, y = 0}, animation_frames, 1.0 / animation_frames)
|
||||
end,
|
||||
|
@ -114,9 +115,9 @@ minetest.register_entity("mcl_burning:fire", {
|
|||
return
|
||||
end
|
||||
if parent:is_player() then
|
||||
self._mcl_animation_timer = self._mcl_animation_timer + dtime
|
||||
if self._mcl_animation_timer >= 0.1 then
|
||||
self._mcl_animation_timer = 0
|
||||
self.animation_timer = self.animation_timer + dtime
|
||||
if self.animation_timer >= 0.1 then
|
||||
self.animation_timer = 0
|
||||
mcl_burning.update_hud(parent)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -222,8 +222,8 @@ local collision = function(self)
|
|||
|
||||
for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do
|
||||
|
||||
local ent = object:get_luaentity()
|
||||
if object:is_player() or (ent and ent._cmi_is_mob and object ~= self.object) then
|
||||
if object:is_player()
|
||||
or (object:get_luaentity()._cmi_is_mob == true and object ~= self.object) then
|
||||
|
||||
local pos2 = object:get_pos()
|
||||
local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z}
|
||||
|
|
|
@ -570,22 +570,12 @@ if mobs_spawn then
|
|||
break
|
||||
end
|
||||
|
||||
local gotten_node = get_node(spawning_position)
|
||||
local gotten_node_name = gotten_node.name
|
||||
local gotten_node_def = minetest.registered_nodes[gotten_node_name]
|
||||
local gotten_node = get_node(spawning_position).name
|
||||
|
||||
if not gotten_node_name or not gotten_node_def or gotten_node_name == "air" then --skip air nodes
|
||||
if not gotten_node or gotten_node == "air" then --skip air nodes
|
||||
break
|
||||
end
|
||||
|
||||
if gotten_node_def.use_texture_alpha and gotten_node_def.use_texture_alpha ~= "opaque" then
|
||||
break
|
||||
end --don't spawn on nonopaque nodes
|
||||
|
||||
local leaf = minetest.get_item_group(gotten_node_name,"leaves")
|
||||
if leaf ~= 0 then
|
||||
break end --don't spawn on treetops
|
||||
|
||||
local gotten_biome = minetest.get_biome_data(spawning_position)
|
||||
|
||||
if not gotten_biome then
|
||||
|
@ -626,8 +616,8 @@ if mobs_spawn then
|
|||
break
|
||||
end
|
||||
|
||||
local is_water = get_item_group(gotten_node_name, "water") ~= 0
|
||||
local is_lava = get_item_group(gotten_node_name, "lava") ~= 0
|
||||
local is_water = get_item_group(gotten_node, "water") ~= 0
|
||||
local is_lava = get_item_group(gotten_node, "lava") ~= 0
|
||||
|
||||
if mob_def.type_of_spawning == "ground" and is_water then
|
||||
break
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
-- NOTE: Most strings intentionally not marked for translation, other mods already have these items.
|
||||
-- TODO: Remove this file eventually, most items are already outsourced in other mods.
|
||||
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
local S = minetest.get_translator("mobs_mc")
|
||||
|
||||
local c = mobs_mc.is_item_variable_overridden
|
||||
|
||||
|
@ -234,8 +234,8 @@ end
|
|||
if c("ender_eye") and c("blaze_powder") and c("blaze_rod") then
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "mobs_mc:ender_eye",
|
||||
recipe = { "mobs_mc:blaze_powder", "mobs_mc:blaze_rod"},
|
||||
output = 'mobs_mc:ender_eye',
|
||||
recipe = { 'mobs_mc:blaze_powder', 'mobs_mc:blaze_rod'},
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -525,7 +525,7 @@ if c("totem") then
|
|||
inventory_image = "mcl_totems_totem.png",
|
||||
wield_image = "mcl_totems_totem.png",
|
||||
stack_max = 1,
|
||||
groups = {combat_item = 1, offhand_item = 1},
|
||||
groups = {combat_item=1},
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
@ -106,42 +106,22 @@ mobs:spawn_specific(
|
|||
"overworld",
|
||||
"ground",
|
||||
{
|
||||
"flat",
|
||||
"IcePlainsSpikes",
|
||||
"ColdTaiga",
|
||||
"ColdTaiga_beach",
|
||||
"ColdTaiga_beach_water",
|
||||
"MegaTaiga",
|
||||
"MegaSpruceTaiga",
|
||||
"ExtremeHills",
|
||||
"ExtremeHills_beach",
|
||||
"ExtremeHillsM",
|
||||
"ExtremeHills+",
|
||||
"ExtremeHills+_snowtop",
|
||||
"StoneBeach",
|
||||
"Plains",
|
||||
"Plains_beach",
|
||||
"SunflowerPlains",
|
||||
"Taiga",
|
||||
"Taiga_beach",
|
||||
"Forest",
|
||||
"Forest_beach",
|
||||
"FlowerForest",
|
||||
"FlowerForest_beach",
|
||||
"BirchForest",
|
||||
"BirchForestM",
|
||||
"RoofedForest",
|
||||
"Savanna",
|
||||
"Savanna_beach",
|
||||
"SavannaM",
|
||||
"Jungle",
|
||||
"Jungle_shore",
|
||||
"JungleM",
|
||||
"JungleM_shore",
|
||||
"JungleEdge",
|
||||
"JungleEdgeM",
|
||||
"Swampland",
|
||||
"Swampland_shore"
|
||||
"FlowerForest",
|
||||
"Swampland",
|
||||
"Taiga",
|
||||
"ExtremeHills",
|
||||
"BirchForest",
|
||||
"MegaSpruceTaiga",
|
||||
"MegaTaiga",
|
||||
"ExtremeHills+",
|
||||
"Forest",
|
||||
"Plains",
|
||||
"ColdTaiga",
|
||||
"SunflowerPlains",
|
||||
"RoofedForest",
|
||||
"MesaPlateauFM_grasstop",
|
||||
"ExtremeHillsM",
|
||||
"BirchForestM",
|
||||
},
|
||||
9,
|
||||
minetest.LIGHT_MAX+1,
|
||||
|
|
|
@ -151,42 +151,22 @@ mobs:spawn_specific(
|
|||
"overworld",
|
||||
"ground",
|
||||
{
|
||||
"flat",
|
||||
"IcePlainsSpikes",
|
||||
"ColdTaiga",
|
||||
"ColdTaiga_beach",
|
||||
"ColdTaiga_beach_water",
|
||||
"MegaTaiga",
|
||||
"MegaSpruceTaiga",
|
||||
"ExtremeHills",
|
||||
"ExtremeHills_beach",
|
||||
"ExtremeHillsM",
|
||||
"ExtremeHills+",
|
||||
"ExtremeHills+_snowtop",
|
||||
"StoneBeach",
|
||||
"Plains",
|
||||
"Plains_beach",
|
||||
"SunflowerPlains",
|
||||
"Taiga",
|
||||
"Taiga_beach",
|
||||
"Forest",
|
||||
"Forest_beach",
|
||||
"FlowerForest",
|
||||
"FlowerForest_beach",
|
||||
"BirchForest",
|
||||
"BirchForestM",
|
||||
"RoofedForest",
|
||||
"Savanna",
|
||||
"Savanna_beach",
|
||||
"SavannaM",
|
||||
"Jungle",
|
||||
"Jungle_shore",
|
||||
"JungleM",
|
||||
"JungleM_shore",
|
||||
"JungleEdge",
|
||||
"JungleEdgeM",
|
||||
"Swampland",
|
||||
"Swampland_shore"
|
||||
"FlowerForest",
|
||||
"Swampland",
|
||||
"Taiga",
|
||||
"ExtremeHills",
|
||||
"BirchForest",
|
||||
"MegaSpruceTaiga",
|
||||
"MegaTaiga",
|
||||
"ExtremeHills+",
|
||||
"Forest",
|
||||
"Plains",
|
||||
"ColdTaiga",
|
||||
"SunflowerPlains",
|
||||
"RoofedForest",
|
||||
"MesaPlateauFM_grasstop",
|
||||
"ExtremeHillsM",
|
||||
"BirchForestM",
|
||||
},
|
||||
9,
|
||||
minetest.LIGHT_MAX+1,
|
||||
|
|
|
@ -520,42 +520,22 @@ mobs:spawn_specific(
|
|||
"overworld",
|
||||
"ground",
|
||||
{
|
||||
"flat",
|
||||
"IcePlainsSpikes",
|
||||
"ColdTaiga",
|
||||
"ColdTaiga_beach",
|
||||
"ColdTaiga_beach_water",
|
||||
"MegaTaiga",
|
||||
"MegaSpruceTaiga",
|
||||
"ExtremeHills",
|
||||
"ExtremeHills_beach",
|
||||
"ExtremeHillsM",
|
||||
"ExtremeHills+",
|
||||
"ExtremeHills+_snowtop",
|
||||
"StoneBeach",
|
||||
"Plains",
|
||||
"Plains_beach",
|
||||
"SunflowerPlains",
|
||||
"Taiga",
|
||||
"Taiga_beach",
|
||||
"Forest",
|
||||
"Forest_beach",
|
||||
"FlowerForest",
|
||||
"FlowerForest_beach",
|
||||
"BirchForest",
|
||||
"BirchForestM",
|
||||
"RoofedForest",
|
||||
"Savanna",
|
||||
"Savanna_beach",
|
||||
"SavannaM",
|
||||
"Jungle",
|
||||
"Jungle_shore",
|
||||
"JungleM",
|
||||
"JungleM_shore",
|
||||
"JungleEdge",
|
||||
"JungleEdgeM",
|
||||
"Swampland",
|
||||
"Swampland_shore"
|
||||
"FlowerForest",
|
||||
"Swampland",
|
||||
"Taiga",
|
||||
"ExtremeHills",
|
||||
"BirchForest",
|
||||
"MegaSpruceTaiga",
|
||||
"MegaTaiga",
|
||||
"ExtremeHills+",
|
||||
"Forest",
|
||||
"Plains",
|
||||
"ColdTaiga",
|
||||
"SunflowerPlains",
|
||||
"RoofedForest",
|
||||
"MesaPlateauFM_grasstop",
|
||||
"ExtremeHillsM",
|
||||
"BirchForestM",
|
||||
},
|
||||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
|
|
|
@ -223,18 +223,12 @@ mobs:spawn_specific(
|
|||
"overworld",
|
||||
"ground",
|
||||
{
|
||||
"Mesa",
|
||||
"MesaPlateauFM_grasstop",
|
||||
"MesaPlateauF",
|
||||
"MesaPlateauFM",
|
||||
"MesaPlateauF_grasstop",
|
||||
"MesaBryce",
|
||||
"Jungle",
|
||||
"Jungle_shore",
|
||||
"JungleM",
|
||||
"JungleM_shore",
|
||||
"JungleEdge",
|
||||
"JungleEdgeM",
|
||||
"Mesa",
|
||||
"MesaPlateauFM_grasstop",
|
||||
"MesaPlateauF",
|
||||
"MesaPlateauFM",
|
||||
"MesaPlateauF_grasstop",
|
||||
"MesaBryce",
|
||||
},
|
||||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
|
|
|
@ -188,42 +188,22 @@ mobs:spawn_specific(
|
|||
"overworld",
|
||||
"ground",
|
||||
{
|
||||
"flat",
|
||||
"IcePlainsSpikes",
|
||||
"ColdTaiga",
|
||||
"ColdTaiga_beach",
|
||||
"ColdTaiga_beach_water",
|
||||
"MegaTaiga",
|
||||
"MegaSpruceTaiga",
|
||||
"ExtremeHills",
|
||||
"ExtremeHills_beach",
|
||||
"ExtremeHillsM",
|
||||
"ExtremeHills+",
|
||||
"ExtremeHills+_snowtop",
|
||||
"StoneBeach",
|
||||
"Plains",
|
||||
"Plains_beach",
|
||||
"SunflowerPlains",
|
||||
"Taiga",
|
||||
"Taiga_beach",
|
||||
"Forest",
|
||||
"Forest_beach",
|
||||
"FlowerForest",
|
||||
"FlowerForest_beach",
|
||||
"BirchForest",
|
||||
"BirchForestM",
|
||||
"RoofedForest",
|
||||
"Savanna",
|
||||
"Savanna_beach",
|
||||
"SavannaM",
|
||||
"Jungle",
|
||||
"Jungle_shore",
|
||||
"JungleM",
|
||||
"JungleM_shore",
|
||||
"JungleEdge",
|
||||
"JungleEdgeM",
|
||||
"Swampland",
|
||||
"Swampland_shore"
|
||||
"FlowerForest",
|
||||
"Swampland",
|
||||
"Taiga",
|
||||
"ExtremeHills",
|
||||
"BirchForest",
|
||||
"MegaSpruceTaiga",
|
||||
"MegaTaiga",
|
||||
"ExtremeHills+",
|
||||
"Forest",
|
||||
"Plains",
|
||||
"ColdTaiga",
|
||||
"SunflowerPlains",
|
||||
"RoofedForest",
|
||||
"MesaPlateauFM_grasstop",
|
||||
"ExtremeHillsM",
|
||||
"BirchForestM",
|
||||
},
|
||||
9,
|
||||
minetest.LIGHT_MAX+1,
|
||||
|
|
|
@ -309,42 +309,22 @@ mobs:spawn_specific(
|
|||
"overworld",
|
||||
"ground",
|
||||
{
|
||||
"flat",
|
||||
"IcePlainsSpikes",
|
||||
"ColdTaiga",
|
||||
"ColdTaiga_beach",
|
||||
"ColdTaiga_beach_water",
|
||||
"MegaTaiga",
|
||||
"MegaSpruceTaiga",
|
||||
"ExtremeHills",
|
||||
"ExtremeHills_beach",
|
||||
"ExtremeHillsM",
|
||||
"ExtremeHills+",
|
||||
"ExtremeHills+_snowtop",
|
||||
"StoneBeach",
|
||||
"Plains",
|
||||
"Plains_beach",
|
||||
"SunflowerPlains",
|
||||
"Taiga",
|
||||
"Taiga_beach",
|
||||
"Forest",
|
||||
"Forest_beach",
|
||||
"FlowerForest",
|
||||
"FlowerForest_beach",
|
||||
"BirchForest",
|
||||
"BirchForestM",
|
||||
"RoofedForest",
|
||||
"Savanna",
|
||||
"Savanna_beach",
|
||||
"SavannaM",
|
||||
"Jungle",
|
||||
"Jungle_shore",
|
||||
"JungleM",
|
||||
"JungleM_shore",
|
||||
"JungleEdge",
|
||||
"JungleEdgeM",
|
||||
"Swampland",
|
||||
"Swampland_shore"
|
||||
"FlowerForest",
|
||||
"Swampland",
|
||||
"Taiga",
|
||||
"ExtremeHills",
|
||||
"BirchForest",
|
||||
"MegaSpruceTaiga",
|
||||
"MegaTaiga",
|
||||
"ExtremeHills+",
|
||||
"Forest",
|
||||
"Plains",
|
||||
"ColdTaiga",
|
||||
"SunflowerPlains",
|
||||
"RoofedForest",
|
||||
"MesaPlateauFM_grasstop",
|
||||
"ExtremeHillsM",
|
||||
"BirchForestM",
|
||||
},
|
||||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
|
|
|
@ -363,10 +363,6 @@ function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size,
|
|||
armor_slot_imgs = armor_slot_imgs .. "image[5.5,2.75;1,1;mcl_inventory_empty_armor_slot_boots.png]"
|
||||
end
|
||||
|
||||
if inv:get_stack("offhand", 1):is_empty() then
|
||||
armor_slot_imgs = armor_slot_imgs .. "image[1.5,2.025;1,1;mcl_inventory_empty_armor_slot_shield.png]"
|
||||
end
|
||||
|
||||
local stack_size = get_stack_size(player)
|
||||
|
||||
-- Survival inventory slots
|
||||
|
@ -381,8 +377,6 @@ function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size,
|
|||
mcl_formspec.get_itemslot_bg(2.5,2.75,1,1)..
|
||||
mcl_formspec.get_itemslot_bg(5.5,1.3,1,1)..
|
||||
mcl_formspec.get_itemslot_bg(5.5,2.75,1,1)..
|
||||
"list[current_player;offhand;1.5,2.025;1,1]"..
|
||||
mcl_formspec.get_itemslot_bg(1.5,2.025,1,1)..
|
||||
armor_slot_imgs..
|
||||
-- player preview
|
||||
player_preview..
|
||||
|
|
|
@ -76,10 +76,6 @@ local function set_inventory(player, armor_change_only)
|
|||
end
|
||||
end
|
||||
|
||||
if inv:get_stack("offhand", 1):is_empty() then
|
||||
armor_slot_imgs = armor_slot_imgs .. "image[3,2;1,1;mcl_inventory_empty_armor_slot_shield.png]"
|
||||
end
|
||||
|
||||
local form = "size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png]"..
|
||||
player_preview..
|
||||
|
@ -92,8 +88,6 @@ local function set_inventory(player, armor_change_only)
|
|||
mcl_formspec.get_itemslot_bg(0,1,1,1)..
|
||||
mcl_formspec.get_itemslot_bg(0,2,1,1)..
|
||||
mcl_formspec.get_itemslot_bg(0,3,1,1)..
|
||||
"list[current_player;offhand;3,2;1,1]"..
|
||||
mcl_formspec.get_itemslot_bg(3,2,1,1)..
|
||||
armor_slot_imgs..
|
||||
-- craft and inventory
|
||||
"label[0,4;"..F(minetest.colorize("#313131", S("Inventory"))).."]"..
|
||||
|
@ -154,10 +148,8 @@ end)
|
|||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
--init inventory
|
||||
local inv = player:get_inventory()
|
||||
inv:set_width("main", 9)
|
||||
inv:set_size("main", 36)
|
||||
inv:set_size("offhand", 1)
|
||||
player:get_inventory():set_width("main", 9)
|
||||
player:get_inventory():set_size("main", 36)
|
||||
|
||||
--set hotbar size
|
||||
player:hud_set_hotbar_itemcount(9)
|
||||
|
|
|
@ -1,171 +0,0 @@
|
|||
local minetest, math = minetest, math
|
||||
mcl_offhand = {}
|
||||
|
||||
local max_offhand_px = 128
|
||||
-- only supports up to 128px textures
|
||||
|
||||
function mcl_offhand.get_offhand(player)
|
||||
return player:get_inventory():get_stack("offhand", 1)
|
||||
end
|
||||
|
||||
local function offhand_get_wear(player)
|
||||
return mcl_offhand.get_offhand(player):get_wear()
|
||||
end
|
||||
|
||||
local function offhand_get_count(player)
|
||||
return mcl_offhand.get_offhand(player):get_count()
|
||||
end
|
||||
|
||||
minetest.register_on_joinplayer(function(player, last_login)
|
||||
mcl_offhand[player] = {
|
||||
hud = {},
|
||||
last_wear = offhand_get_wear(player),
|
||||
last_count = offhand_get_count(player),
|
||||
}
|
||||
end)
|
||||
|
||||
local function remove_hud(player, hud)
|
||||
local offhand_hud = mcl_offhand[player].hud[hud]
|
||||
if offhand_hud then
|
||||
player:hud_remove(offhand_hud)
|
||||
mcl_offhand[player].hud[hud] = nil
|
||||
end
|
||||
end
|
||||
|
||||
function rgb_to_hex(r, g, b)
|
||||
return string.format("%02x%02x%02x", r, g, b)
|
||||
end
|
||||
|
||||
local function update_wear_bar(player, itemstack)
|
||||
local wear_bar_percent = (65535 - offhand_get_wear(player)) / 65535
|
||||
|
||||
local color = {255, 255, 255}
|
||||
local wear = itemstack:get_wear() / 65535;
|
||||
local wear_i = math.min(math.floor(wear * 600), 511);
|
||||
wear_i = math.min(wear_i + 10, 511);
|
||||
if wear_i <= 255 then
|
||||
color = {wear_i, 255, 0}
|
||||
else
|
||||
color = {255, 511 - wear_i, 0}
|
||||
end
|
||||
local wear_bar = mcl_offhand[player].hud.wear_bar
|
||||
player:hud_change(wear_bar, "text", "mcl_wear_bar.png^[colorize:#" .. rgb_to_hex(color[1], color[2], color[3]))
|
||||
player:hud_change(wear_bar, "scale", {x = 40 * wear_bar_percent, y = 3})
|
||||
player:hud_change(wear_bar, "offset", {x = -320 - (20 - player:hud_get(wear_bar).scale.x / 2), y = -13})
|
||||
end
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local itemstack = mcl_offhand.get_offhand(player)
|
||||
local offhand_item = itemstack:get_name()
|
||||
local offhand_hud = mcl_offhand[player].hud
|
||||
if offhand_item ~= "" then
|
||||
local item_texture = minetest.registered_items[offhand_item].inventory_image .. "^[resize:" .. max_offhand_px .. "x" .. max_offhand_px
|
||||
local position = {x = 0.5, y = 1}
|
||||
local offset = {x = -320, y = -32}
|
||||
|
||||
if not offhand_hud.slot then
|
||||
offhand_hud.slot = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = position,
|
||||
offset = offset,
|
||||
scale = {x = 2.75, y = 2.75},
|
||||
text = "mcl_offhand_slot.png",
|
||||
z_index = 0,
|
||||
})
|
||||
end
|
||||
if not offhand_hud.item then
|
||||
offhand_hud.item = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = position,
|
||||
offset = offset,
|
||||
scale = {x = 0.4, y = 0.4},
|
||||
text = item_texture,
|
||||
z_index = 1,
|
||||
})
|
||||
else
|
||||
player:hud_change(offhand_hud.item, "text", item_texture)
|
||||
end
|
||||
if not offhand_hud.wear_bar_bg and minetest.registered_tools[offhand_item] then
|
||||
if offhand_get_wear(player) > 0 then
|
||||
local texture = "mcl_wear_bar.png^[colorize:#000000"
|
||||
offhand_hud.wear_bar_bg = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0.5, y = 1},
|
||||
offset = {x = -320, y = -13},
|
||||
scale = {x = 40, y = 3},
|
||||
text = texture,
|
||||
z_index = 2,
|
||||
})
|
||||
offhand_hud.wear_bar = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0.5, y = 1},
|
||||
offset = {x = -320, y = -13},
|
||||
scale = {x = 10, y = 3},
|
||||
text = texture,
|
||||
z_index = 3,
|
||||
})
|
||||
update_wear_bar(player, itemstack)
|
||||
end
|
||||
end
|
||||
|
||||
if not offhand_hud.item_count and offhand_get_count(player) > 1 then
|
||||
offhand_hud.item_count = player:hud_add({
|
||||
hud_elem_type = "text",
|
||||
position = {x = 0.5, y = 1},
|
||||
offset = {x = -298, y = -18},
|
||||
scale = {x = 1, y = 1},
|
||||
alignment = {x = -1, y = 0},
|
||||
text = offhand_get_count(player),
|
||||
z_index = 4,
|
||||
number = 0xFFFFFF,
|
||||
})
|
||||
end
|
||||
|
||||
if offhand_hud.wear_bar then
|
||||
if offhand_hud.last_wear ~= offhand_get_wear(player) then
|
||||
update_wear_bar(player, itemstack)
|
||||
offhand_hud.last_wear = offhand_get_wear(player)
|
||||
end
|
||||
if offhand_get_wear(player) <= 0 or not minetest.registered_tools[offhand_item] then
|
||||
remove_hud(player, "wear_bar_bg")
|
||||
remove_hud(player, "wear_bar")
|
||||
end
|
||||
end
|
||||
|
||||
if offhand_hud.item_count then
|
||||
if offhand_hud.last_count ~= offhand_get_count(player) then
|
||||
player:hud_change(offhand_hud.item_count, "text", offhand_get_count(player))
|
||||
offhand_hud.last_count = offhand_get_count(player)
|
||||
end
|
||||
if offhand_get_count(player) <= 1 then
|
||||
remove_hud(player, "item_count")
|
||||
end
|
||||
end
|
||||
|
||||
elseif offhand_hud.slot then
|
||||
for index, _ in pairs(mcl_offhand[player].hud) do
|
||||
remove_hud(player, index)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_allow_player_inventory_action(function(player, action, inventory, inventory_info)
|
||||
if action == "move" and inventory_info.to_list == "offhand" then
|
||||
local itemstack = inventory:get_stack(inventory_info.from_list, inventory_info.from_index)
|
||||
if not (minetest.get_item_group(itemstack:get_name(), "offhand_item") > 0) then
|
||||
return 0
|
||||
else
|
||||
return itemstack:get_stack_max()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_player_inventory_action(function(player, action, inventory, inventory_info)
|
||||
local from_offhand = inventory_info.from_list == "offhand"
|
||||
local to_offhand = inventory_info.to_list == "offhand"
|
||||
if action == "move" and from_offhand or to_offhand then
|
||||
mcl_inventory.update_inventory_formspec(player)
|
||||
end
|
||||
end)
|
|
@ -1,3 +0,0 @@
|
|||
name = mcl_offhand
|
||||
author = NO11
|
||||
depends = mcl_inventory
|
Before Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 168 B |
|
@ -88,10 +88,6 @@ for k,v in pairs(mcl_banners.colors) do
|
|||
colors_reverse["mcl_banners:banner_item_"..v[1]] = k
|
||||
end
|
||||
|
||||
function mcl_banners.color_reverse(itemname)
|
||||
return colors_reverse[itemname]
|
||||
end
|
||||
|
||||
-- Add pattern/emblazoning crafting recipes
|
||||
dofile(modpath.."/patterncraft.lua")
|
||||
|
||||
|
@ -153,7 +149,7 @@ local function on_destruct_hanging_banner(pos)
|
|||
return on_destruct_banner(pos, true)
|
||||
end
|
||||
|
||||
function mcl_banners.make_banner_texture(base_color, layers)
|
||||
local function make_banner_texture(base_color, layers)
|
||||
local colorize
|
||||
if mcl_banners.colors[base_color] then
|
||||
colorize = mcl_banners.colors[base_color][4]
|
||||
|
@ -175,11 +171,11 @@ function mcl_banners.make_banner_texture(base_color, layers)
|
|||
|
||||
finished_banner = finished_banner .. "^" .. layer
|
||||
end
|
||||
return finished_banner
|
||||
return { finished_banner }
|
||||
end
|
||||
return base
|
||||
return { base }
|
||||
else
|
||||
return "mcl_banners_banner_base.png"
|
||||
return { "mcl_banners_banner_base.png" }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -196,7 +192,7 @@ local function spawn_banner_entity(pos, hanging, itemstack)
|
|||
local imeta = itemstack:get_meta()
|
||||
local layers_raw = imeta:get_string("layers")
|
||||
local layers = minetest.deserialize(layers_raw)
|
||||
local colorid = mcl_banners.color_reverse(itemstack:get_name())
|
||||
local colorid = colors_reverse[itemstack:get_name()]
|
||||
banner:get_luaentity():_set_textures(colorid, layers)
|
||||
local mname = imeta:get_string("name")
|
||||
if mname and mname ~= "" then
|
||||
|
@ -608,7 +604,7 @@ local entity_standing = {
|
|||
visual = "mesh",
|
||||
mesh = "amc_banner.b3d",
|
||||
visual_size = { x=2.499, y=2.499 },
|
||||
textures = {mcl_banners.make_banner_texture()},
|
||||
textures = make_banner_texture(),
|
||||
pointable = false,
|
||||
|
||||
_base_color = nil, -- base color of banner
|
||||
|
@ -628,7 +624,7 @@ local entity_standing = {
|
|||
self._layers = inp._layers
|
||||
self._name = inp._name
|
||||
self.object:set_properties({
|
||||
textures = {mcl_banners.make_banner_texture(self._base_color, self._layers)},
|
||||
textures = make_banner_texture(self._base_color, self._layers),
|
||||
})
|
||||
end
|
||||
-- Make banner slowly swing
|
||||
|
@ -639,7 +635,7 @@ local entity_standing = {
|
|||
-- Set the banner textures. This function can be used by external mods.
|
||||
-- Meaning of parameters:
|
||||
-- * self: Lua entity reference to entity.
|
||||
-- * other parameters: Same meaning as in mcl_banners.make_banner_texture
|
||||
-- * other parameters: Same meaning as in make_banner_texture
|
||||
_set_textures = function(self, base_color, layers)
|
||||
if base_color then
|
||||
self._base_color = base_color
|
||||
|
@ -647,7 +643,7 @@ local entity_standing = {
|
|||
if layers then
|
||||
self._layers = layers
|
||||
end
|
||||
self.object:set_properties({textures = {mcl_banners.make_banner_texture(self._base_color, self._layers)}})
|
||||
self.object:set_properties({textures = make_banner_texture(self._base_color, self._layers)})
|
||||
end,
|
||||
}
|
||||
minetest.register_entity("mcl_banners:standing_banner", entity_standing)
|
||||
|
|
|
@ -14,27 +14,6 @@ local function on_blast(pos)
|
|||
minetest.remove_node(pos)
|
||||
end
|
||||
|
||||
-- Simple protection checking functions
|
||||
local function protection_check_move(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local name = player:get_player_name()
|
||||
if minetest.is_protected(pos, name) then
|
||||
minetest.record_protection_violation(pos, name)
|
||||
return 0
|
||||
else
|
||||
return count
|
||||
end
|
||||
end
|
||||
|
||||
local function protection_check_put_take(pos, listname, index, stack, player)
|
||||
local name = player:get_player_name()
|
||||
if minetest.is_protected(pos, name) then
|
||||
minetest.record_protection_violation(pos, name)
|
||||
return 0
|
||||
else
|
||||
return stack:get_count()
|
||||
end
|
||||
end
|
||||
|
||||
local function barrel_open(pos, node, clicker)
|
||||
local name = minetest.get_meta(pos):get_string("name")
|
||||
|
||||
|
@ -103,6 +82,7 @@ minetest.register_node("mcl_barrels:barrel_closed", {
|
|||
tiles = {"mcl_barrels_barrel_top.png^[transformR270", "mcl_barrels_barrel_bottom.png", "mcl_barrels_barrel_side.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
--on_place = mcl_util.rotate_axis,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
minetest.rotate_and_place(itemstack, placer, pointed_thing, minetest.is_creative_enabled(placer:get_player_name()), {}, false)
|
||||
return itemstack
|
||||
|
@ -118,21 +98,6 @@ minetest.register_node("mcl_barrels:barrel_closed", {
|
|||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
minetest.get_meta(pos):set_string("name", itemstack:get_meta():get_string("name"))
|
||||
end,
|
||||
allow_metadata_inventory_move = protection_check_move,
|
||||
allow_metadata_inventory_take = protection_check_put_take,
|
||||
allow_metadata_inventory_put = protection_check_put_take,
|
||||
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" moves stuff in barrel at "..minetest.pos_to_string(pos))
|
||||
end,
|
||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" moves stuff to barrel at "..minetest.pos_to_string(pos))
|
||||
end,
|
||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" takes stuff from barrel at "..minetest.pos_to_string(pos))
|
||||
end,
|
||||
after_dig_node = drop_content,
|
||||
on_blast = on_blast,
|
||||
on_rightclick = barrel_open,
|
||||
|
@ -154,21 +119,6 @@ minetest.register_node("mcl_barrels:barrel_open", {
|
|||
stack_max = 64,
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
groups = {handy = 1, axey = 1, container = 2, material_wood = 1, flammable = -1, deco_block = 1, not_in_creative_inventory = 1},
|
||||
allow_metadata_inventory_move = protection_check_move,
|
||||
allow_metadata_inventory_take = protection_check_put_take,
|
||||
allow_metadata_inventory_put = protection_check_put_take,
|
||||
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" moves stuff in barrel at "..minetest.pos_to_string(pos))
|
||||
end,
|
||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" moves stuff to barrel at "..minetest.pos_to_string(pos))
|
||||
end,
|
||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" takes stuff from barrel at "..minetest.pos_to_string(pos))
|
||||
end,
|
||||
after_dig_node = drop_content,
|
||||
on_blast = on_blast,
|
||||
on_rightclick = barrel_open,
|
||||
|
|
|
@ -76,7 +76,6 @@ local ARROW_ENTITY={
|
|||
_shooter=nil, -- ObjectRef of player or mob who shot it
|
||||
_is_arrow = true,
|
||||
_in_player = false,
|
||||
_blocked = false,
|
||||
_viscosity=0, -- Viscosity of node the arrow is currently in
|
||||
_deflection_cooloff=0, -- Cooloff timer after an arrow deflection, to prevent many deflections in quick succession
|
||||
}
|
||||
|
@ -85,7 +84,7 @@ local ARROW_ENTITY={
|
|||
local function spawn_item(self, pos)
|
||||
if not minetest.is_creative_enabled("") then
|
||||
local item = minetest.add_item(pos, "mcl_bows:arrow")
|
||||
item:set_velocity(vector.new(0, 0, 0))
|
||||
item:set_velocity({x=0, y=0, z=0})
|
||||
item:set_yaw(self.object:get_yaw())
|
||||
end
|
||||
mcl_burning.extinguish(self.object)
|
||||
|
@ -97,10 +96,12 @@ local function damage_particles(pos, is_critical)
|
|||
minetest.add_particlespawner({
|
||||
amount = 15,
|
||||
time = 0.1,
|
||||
minpos = vector.offset(pos, -0.5, -0.5, -0.5),
|
||||
maxpos = vector.offset(pos, 0.5, 0.5, 0.5),
|
||||
minvel = vector.new(-0.1, -0.1, -0.1),
|
||||
maxvel = vector.new(0.1, 0.1, 0.1),
|
||||
minpos = {x=pos.x-0.5, y=pos.y-0.5, z=pos.z-0.5},
|
||||
maxpos = {x=pos.x+0.5, y=pos.y+0.5, z=pos.z+0.5},
|
||||
minvel = {x=-0.1, y=-0.1, z=-0.1},
|
||||
maxvel = {x=0.1, y=0.1, z=0.1},
|
||||
minacc = {x=0, y=0, z=0},
|
||||
maxacc = {x=0, y=0, z=0},
|
||||
minexptime = 1,
|
||||
maxexptime = 2,
|
||||
minsize = 1.5,
|
||||
|
@ -248,59 +249,50 @@ function ARROW_ENTITY.on_step(self, dtime)
|
|||
|
||||
-- Punch target object but avoid hurting enderman.
|
||||
if not lua or lua.name ~= "mobs_mc:enderman" then
|
||||
if not self._in_player then
|
||||
if self._in_player == false then
|
||||
damage_particles(self.object:get_pos(), self._is_critical)
|
||||
end
|
||||
if mcl_burning.is_burning(self.object) then
|
||||
mcl_burning.set_on_fire(obj, 5)
|
||||
end
|
||||
if not self._in_player and not self._blocked then
|
||||
if self._in_player == false then
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval=1.0,
|
||||
damage_groups={fleshy=self._damage},
|
||||
}, self.object:get_velocity())
|
||||
if obj:is_player() then
|
||||
if not mcl_shields.is_blocking(obj) 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,
|
||||
vector.new(self._x_position, self._y_position, random_arrow_positions("z", placement)),
|
||||
vector.new(0, self._rotation_station + self._y_rotation, self._z_rotation)
|
||||
)
|
||||
local placement
|
||||
self._placement = math.random(1, 2)
|
||||
if self._placement == 1 then
|
||||
placement = "front"
|
||||
else
|
||||
self._blocked = true
|
||||
self.object:set_velocity(vector.multiply(self.object:get_velocity(), -0.25))
|
||||
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)
|
||||
|
@ -310,7 +302,7 @@ function ARROW_ENTITY.on_step(self, dtime)
|
|||
|
||||
|
||||
if is_player then
|
||||
if self._shooter and self._shooter:is_player() and not self._in_player and not self._blocked then
|
||||
if self._shooter and self._shooter:is_player() and self._in_player == false then
|
||||
-- “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)
|
||||
end
|
||||
|
@ -327,7 +319,7 @@ function ARROW_ENTITY.on_step(self, dtime)
|
|||
end
|
||||
end
|
||||
end
|
||||
if not self._in_player and not self._blocked then
|
||||
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
|
||||
|
@ -353,9 +345,9 @@ function ARROW_ENTITY.on_step(self, dtime)
|
|||
local dir
|
||||
if math.abs(vel.y) < 0.00001 then
|
||||
if self._lastpos.y < pos.y then
|
||||
dir = vector.new(0, 1, 0)
|
||||
dir = {x=0, y=1, z=0}
|
||||
else
|
||||
dir = vector.new(0, -1, 0)
|
||||
dir = {x=0, y=-1, z=0}
|
||||
end
|
||||
else
|
||||
dir = minetest.facedir_to_dir(minetest.dir_to_facedir(minetest.yaw_to_dir(self.object:get_yaw()-YAW_OFFSET)))
|
||||
|
@ -383,8 +375,8 @@ function ARROW_ENTITY.on_step(self, dtime)
|
|||
self._stucktimer = 0
|
||||
self._stuckrechecktimer = 0
|
||||
|
||||
self.object:set_velocity(vector.new(0, 0, 0))
|
||||
self.object:set_acceleration(vector.new(0, 0, 0))
|
||||
self.object:set_velocity({x=0, y=0, z=0})
|
||||
self.object:set_acceleration({x=0, y=0, z=0})
|
||||
|
||||
minetest.sound_play({name="mcl_bows_hit_other", gain=0.3}, {pos=self.object:get_pos(), max_hear_distance=16}, true)
|
||||
|
||||
|
@ -434,7 +426,7 @@ function ARROW_ENTITY.on_step(self, dtime)
|
|||
end
|
||||
|
||||
-- Update internal variable
|
||||
self._lastpos = pos
|
||||
self._lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
end
|
||||
|
||||
-- Force recheck of stuck arrows when punched.
|
||||
|
|
|
@ -116,7 +116,7 @@ end
|
|||
|
||||
-- Bow item, uncharged state
|
||||
minetest.register_tool("mcl_bows:crossbow", {
|
||||
description = S("Crossbow"),
|
||||
description = S("Corssbow"),
|
||||
_tt_help = S("Launches arrows"),
|
||||
_doc_items_longdesc = S("Bows are ranged weapons to shoot arrows at your foes.").."\n"..
|
||||
S("The speed and damage of the arrow increases the longer you charge. The regular damage of the arrow is between 1 and 9. At full charge, there's also a 20% of a critical hit, dealing 10 damage instead."),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name = mcl_bows
|
||||
author = Arcelmi
|
||||
description = This mod adds bows and arrows for MineClone 2.
|
||||
depends = controls, mcl_particles, mcl_enchanting, mcl_init, mcl_util, mcl_shields
|
||||
depends = controls, mcl_particles, mcl_enchanting, mcl_init, mcl_util
|
||||
optional_depends = awards, mcl_achievements, mcl_core, mcl_mobitems, playerphysics, doc, doc_identifier, mesecons_button
|
||||
|
||||
|
|
|
@ -389,7 +389,6 @@ mcl_experience.register_on_add_xp(function(player, xp)
|
|||
{list = "armor", index = 3},
|
||||
{list = "armor", index = 4},
|
||||
{list = "armor", index = 5},
|
||||
{list = "offhand", index = 1},
|
||||
}
|
||||
|
||||
local final_candidates = {}
|
||||
|
|
|
@ -74,12 +74,8 @@ function mcl_enchanting.is_enchanted(itemname)
|
|||
return minetest.get_item_group(itemname, "enchanted") > 0
|
||||
end
|
||||
|
||||
function mcl_enchanting.not_enchantable_on_enchanting_table(itemname)
|
||||
return mcl_enchanting.get_enchantability(itemname) == -1
|
||||
end
|
||||
|
||||
function mcl_enchanting.is_enchantable(itemname)
|
||||
return mcl_enchanting.get_enchantability(itemname) > 0 or mcl_enchanting.not_enchantable_on_enchanting_table(itemname)
|
||||
return mcl_enchanting.get_enchantability(itemname) > 0
|
||||
end
|
||||
|
||||
function mcl_enchanting.can_enchant_freshly(itemname)
|
||||
|
@ -332,7 +328,7 @@ end
|
|||
function mcl_enchanting.generate_random_enchantments(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted, pr)
|
||||
local itemname = itemstack:get_name()
|
||||
|
||||
if (not mcl_enchanting.can_enchant_freshly(itemname) and not ignore_already_enchanted) or mcl_enchanting.not_enchantable_on_enchanting_table(itemname) then
|
||||
if not mcl_enchanting.can_enchant_freshly(itemname) and not ignore_already_enchanted then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -458,7 +454,7 @@ function mcl_enchanting.generate_random_table_slots(itemstack, num_bookshelves)
|
|||
end
|
||||
|
||||
function mcl_enchanting.get_table_slots(player, itemstack, num_bookshelves)
|
||||
if (not mcl_enchanting.can_enchant_freshly(itemstack:get_name())) or mcl_enchanting.not_enchantable_on_enchanting_table(itemname) then
|
||||
if not mcl_enchanting.can_enchant_freshly(itemstack:get_name()) then
|
||||
return {false, false, false}
|
||||
end
|
||||
local itemname = itemstack:get_name()
|
||||
|
|
|
@ -1,510 +0,0 @@
|
|||
local minetest, math, vector = minetest, math, vector
|
||||
local modname = minetest.get_current_modname()
|
||||
local S = minetest.get_translator(modname)
|
||||
|
||||
mcl_shields = {
|
||||
types = {
|
||||
mob = true,
|
||||
player = true,
|
||||
arrow = true,
|
||||
generic = true,
|
||||
explosion = true, -- ghasts don't work
|
||||
dragon_breath = true,
|
||||
},
|
||||
enchantments = {"mending", "unbreaking"},
|
||||
players = {},
|
||||
}
|
||||
|
||||
local interact_priv = minetest.registered_privileges.interact
|
||||
interact_priv.give_to_singleplayer = false
|
||||
interact_priv.give_to_admin = false
|
||||
|
||||
local overlay = mcl_enchanting.overlay
|
||||
local hud = "mcl_shield_hud.png"
|
||||
|
||||
minetest.register_tool("mcl_shields:shield", {
|
||||
description = S("Shield"),
|
||||
_doc_items_longdesc = S("A shield is a tool used for protecting the player against attacks."),
|
||||
inventory_image = "mcl_shield.png",
|
||||
stack_max = 1,
|
||||
groups = {
|
||||
shield = 1,
|
||||
weapon = 1,
|
||||
enchantability = -1,
|
||||
no_wieldview = 1,
|
||||
offhand_item = 1,
|
||||
},
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
_repair_material = "group:wood",
|
||||
wield_scale = vector.new(2, 2, 2),
|
||||
})
|
||||
|
||||
local function wielded_item(obj, i)
|
||||
local itemstack = obj:get_wielded_item()
|
||||
if i == 1 then
|
||||
itemstack = obj:get_inventory():get_stack("offhand", 1)
|
||||
end
|
||||
return itemstack:get_name()
|
||||
end
|
||||
|
||||
function mcl_shields.wielding_shield(obj, i)
|
||||
return wielded_item(obj, i):find("mcl_shields:shield")
|
||||
end
|
||||
|
||||
local function shield_is_enchanted(obj, i)
|
||||
return mcl_enchanting.is_enchanted(wielded_item(obj, i))
|
||||
end
|
||||
|
||||
minetest.register_entity("mcl_shields:shield_entity", {
|
||||
initial_properties = {
|
||||
visual = "mesh",
|
||||
mesh = "mcl_shield.obj",
|
||||
physical = false,
|
||||
pointable = false,
|
||||
collide_with_objects = false,
|
||||
textures = {"mcl_shield_base_nopattern.png"},
|
||||
visual_size = vector.new(1, 1, 1),
|
||||
},
|
||||
_blocking = false,
|
||||
_shield_number = 2,
|
||||
_texture_copy = "",
|
||||
on_step = function(self, dtime, moveresult)
|
||||
local player = self.object:get_attach()
|
||||
if not player then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
local shield_texture = "mcl_shield_base_nopattern.png"
|
||||
local i = self._shield_number
|
||||
local item = wielded_item(player, i)
|
||||
|
||||
if item ~= "mcl_shields:shield" and item ~= "mcl_shields:shield_enchanted" then
|
||||
local itemstack = player:get_wielded_item()
|
||||
if i == 1 then
|
||||
itemstack = player:get_inventory():get_stack("offhand", 1)
|
||||
end
|
||||
local meta_texture = itemstack:get_meta():get_string("mcl_shields:shield_custom_pattern_texture")
|
||||
if meta_texture ~= "" then
|
||||
shield_texture = meta_texture
|
||||
else
|
||||
local color = minetest.registered_items[item]._shield_color
|
||||
if color then
|
||||
shield_texture = "mcl_shield_base_nopattern.png^(mcl_shield_pattern_base.png^[colorize:" .. color .. ")"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if shield_is_enchanted(player, i) then
|
||||
shield_texture = shield_texture .. overlay
|
||||
end
|
||||
|
||||
if self._texture_copy ~= shield_texture then
|
||||
self.object:set_properties({textures = {shield_texture}})
|
||||
end
|
||||
|
||||
self._texture_copy = shield_texture
|
||||
end,
|
||||
})
|
||||
|
||||
for _, e in pairs(mcl_shields.enchantments) do
|
||||
mcl_enchanting.enchantments[e].secondary.shield = true
|
||||
end
|
||||
|
||||
function mcl_shields.is_blocking(obj)
|
||||
if not obj:is_player() then return end
|
||||
local blocking = mcl_shields.players[obj].blocking
|
||||
if blocking <= 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local shieldstack = obj:get_wielded_item()
|
||||
if blocking == 1 then
|
||||
shieldstack = obj:get_inventory():get_stack("offhand", 1)
|
||||
end
|
||||
return blocking, shieldstack
|
||||
end
|
||||
|
||||
mcl_damage.register_modifier(function(obj, damage, reason)
|
||||
local type = reason.type
|
||||
local damager = reason.direct
|
||||
local blocking, shieldstack = mcl_shields.is_blocking(obj)
|
||||
if not (obj:is_player() and blocking and mcl_shields.types[type] and damager) then
|
||||
return
|
||||
end
|
||||
|
||||
local entity = damager:get_luaentity()
|
||||
if entity and (type == "arrow" or type == "generic") then
|
||||
damager = entity._shooter
|
||||
end
|
||||
|
||||
if not damager then
|
||||
return
|
||||
end
|
||||
|
||||
if vector.dot(obj:get_look_dir(), vector.subtract(damager:get_pos(), obj:get_pos())) < 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local durability = 336
|
||||
local unbreaking = mcl_enchanting.get_enchantment(shieldstack, mcl_shields.enchantments[2])
|
||||
if unbreaking > 0 then
|
||||
durability = durability * (unbreaking + 1)
|
||||
end
|
||||
if not minetest.is_creative_enabled(obj:get_player_name()) and damage >= 3 then
|
||||
shieldstack:add_wear(65535 / durability)
|
||||
if blocking == 2 then
|
||||
obj:set_wielded_item(shieldstack)
|
||||
else
|
||||
obj:get_inventory():set_stack("offhand", 1, shieldstack)
|
||||
mcl_inventory.update_inventory_formspec(obj)
|
||||
end
|
||||
end
|
||||
minetest.sound_play({name = "mcl_block"})
|
||||
return 0
|
||||
end)
|
||||
|
||||
local function modify_shield(player, vpos, vrot, i)
|
||||
local arm = "Right"
|
||||
if i == 1 then
|
||||
arm = "Left"
|
||||
end
|
||||
local shield = mcl_shields.players[player].shields[i]
|
||||
if shield then
|
||||
shield:set_attach(player, "Arm_" .. arm, vpos, vrot, false)
|
||||
end
|
||||
end
|
||||
|
||||
local function set_shield(player, block, i)
|
||||
if block then
|
||||
if i == 1 then
|
||||
modify_shield(player, vector.new(-9, 4, 0.5), vector.new(80, 100, 0), i) -- TODO
|
||||
else
|
||||
modify_shield(player, vector.new(-8, 4, -2.5), vector.new(80, 80, 0), i)
|
||||
end
|
||||
else
|
||||
if i == 1 then
|
||||
modify_shield(player, vector.new(-3, -5, 0), vector.new(0, 180, 0), i)
|
||||
else
|
||||
modify_shield(player, vector.new(3, -5, 0), vector.new(0, 0, 0), i)
|
||||
end
|
||||
end
|
||||
local shield = mcl_shields.players[player].shields[i]
|
||||
if not shield then return end
|
||||
|
||||
local luaentity = shield:get_luaentity()
|
||||
if not luaentity then return end
|
||||
|
||||
luaentity._blocking = block
|
||||
end
|
||||
|
||||
local function set_interact(player, interact)
|
||||
local player_name = player:get_player_name()
|
||||
local privs = minetest.get_player_privs(player_name)
|
||||
if privs.interact == interact then
|
||||
return
|
||||
end
|
||||
local meta = player:get_meta()
|
||||
if meta:get_int("mcl_privs:interact_revoked") ~= 1 then
|
||||
privs.interact = interact
|
||||
minetest.set_player_privs(player_name, privs)
|
||||
meta:set_int("mcl_privs:interact_revoked",0)
|
||||
end
|
||||
end
|
||||
|
||||
local shield_hud = {}
|
||||
|
||||
local function remove_shield_hud(player)
|
||||
if shield_hud[player] then
|
||||
player:hud_remove(shield_hud[player])
|
||||
shield_hud[player] = nil
|
||||
set_shield(player, false, 1)
|
||||
set_shield(player, false, 2)
|
||||
end
|
||||
|
||||
local hf = player:hud_get_flags()
|
||||
if not hf.wielditem then
|
||||
player:hud_set_flags({wielditem = true})
|
||||
end
|
||||
|
||||
playerphysics.remove_physics_factor(player, "speed", "shield_speed")
|
||||
set_interact(player, true)
|
||||
end
|
||||
|
||||
local function add_shield_entity(player, i)
|
||||
local shield = minetest.add_entity(player:get_pos(), "mcl_shields:shield_entity")
|
||||
shield:get_luaentity()._shield_number = i
|
||||
mcl_shields.players[player].shields[i] = shield
|
||||
set_shield(player, false, i)
|
||||
end
|
||||
|
||||
local function remove_shield_entity(player, i)
|
||||
local shields = mcl_shields.players[player].shields
|
||||
if shields[i] then
|
||||
shields[i]:remove()
|
||||
shields[i] = nil
|
||||
end
|
||||
end
|
||||
|
||||
local function handle_blocking(player)
|
||||
local player_shield = mcl_shields.players[player]
|
||||
local rmb = player:get_player_control().RMB
|
||||
if not rmb then
|
||||
player_shield.blocking = 0
|
||||
return
|
||||
end
|
||||
|
||||
local shield_in_offhand = mcl_shields.wielding_shield(player, 1)
|
||||
local shield_in_hand = mcl_shields.wielding_shield(player)
|
||||
local not_blocking = player_shield.blocking == 0
|
||||
|
||||
local pos = player:get_pos()
|
||||
if shield_in_hand then
|
||||
if not_blocking then
|
||||
minetest.after(0.25, function()
|
||||
if (not_blocking or not shield_in_offhand) and shield_in_hand and rmb then
|
||||
player_shield.blocking = 2
|
||||
set_shield(player, true, 2)
|
||||
end
|
||||
end)
|
||||
elseif not shield_in_offhand then
|
||||
player_shield.blocking = 2
|
||||
end
|
||||
elseif shield_in_offhand then
|
||||
local offhand_can_block = (wielded_item(player) == "" or not mcl_util.get_pointed_thing(player, true))
|
||||
and (minetest.get_item_group(wielded_item(player), "bow") ~= 1 and minetest.get_item_group(wielded_item(player), "crossbow") ~= 1)
|
||||
|
||||
if not offhand_can_block then
|
||||
return
|
||||
end
|
||||
if not_blocking then
|
||||
minetest.after(0.25, function()
|
||||
if (not_blocking or not shield_in_hand) and shield_in_offhand and rmb and offhand_can_block then
|
||||
player_shield.blocking = 1
|
||||
set_shield(player, true, 1)
|
||||
end
|
||||
end)
|
||||
elseif not shield_in_hand then
|
||||
player_shield.blocking = 1
|
||||
end
|
||||
else
|
||||
player_shield.blocking = 0
|
||||
end
|
||||
end
|
||||
|
||||
local function update_shield_entity(player, blocking, i)
|
||||
local shield = mcl_shields.players[player].shields[i]
|
||||
if mcl_shields.wielding_shield(player, i) then
|
||||
if not shield then
|
||||
add_shield_entity(player, i)
|
||||
else
|
||||
if blocking == i then
|
||||
if shield:get_luaentity() and not shield:get_luaentity()._blocking then
|
||||
set_shield(player, true, i)
|
||||
end
|
||||
else
|
||||
set_shield(player, false, i)
|
||||
end
|
||||
end
|
||||
elseif shield then
|
||||
remove_shield_entity(player, i)
|
||||
end
|
||||
end
|
||||
|
||||
local function add_shield_hud(shieldstack, player, blocking)
|
||||
local texture = hud
|
||||
if mcl_enchanting.is_enchanted(shieldstack:get_name()) then
|
||||
texture = texture .. overlay
|
||||
end
|
||||
local offset = 100
|
||||
if blocking == 1 then
|
||||
texture = texture .. "^[transform4"
|
||||
offset = -100
|
||||
else
|
||||
player:hud_set_flags({wielditem = false})
|
||||
end
|
||||
shield_hud[player] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0.5, y = 0.5},
|
||||
scale = {x = -101, y = -101},
|
||||
offset = {x = offset, y = 0},
|
||||
text = texture,
|
||||
z_index = -200,
|
||||
})
|
||||
playerphysics.add_physics_factor(player, "speed", "shield_speed", 0.5)
|
||||
set_interact(player, nil)
|
||||
end
|
||||
|
||||
local function update_shield_hud(player, blocking, shieldstack)
|
||||
local shieldhud = shield_hud[player]
|
||||
if not shieldhud then
|
||||
add_shield_hud(shieldstack, player, blocking)
|
||||
return
|
||||
end
|
||||
|
||||
local wielditem = player:hud_get_flags().wielditem
|
||||
if blocking == 1 then
|
||||
if not wielditem then
|
||||
player:hud_change(shieldhud, "text", hud .. "^[transform4")
|
||||
player:hud_change(shieldhud, "offset", {x = -100, y = 0})
|
||||
player:hud_set_flags({wielditem = true})
|
||||
end
|
||||
elseif wielditem then
|
||||
player:hud_change(shieldhud, "text", hud)
|
||||
player:hud_change(shieldhud, "offset", {x = 100, y = 0})
|
||||
player:hud_set_flags({wielditem = false})
|
||||
end
|
||||
|
||||
local image = player:hud_get(shieldhud).text
|
||||
local enchanted = hud .. overlay
|
||||
local enchanted1 = image == enchanted
|
||||
local enchanted2 = image == enchanted .. "^[transform4"
|
||||
if mcl_enchanting.is_enchanted(shieldstack:get_name()) then
|
||||
if not enchanted1 and not enchanted2 then
|
||||
if blocking == 1 then
|
||||
player:hud_change(shieldhud, "text", hud .. overlay .. "^[transform4")
|
||||
else
|
||||
player:hud_change(shieldhud, "text", hud .. overlay)
|
||||
end
|
||||
end
|
||||
elseif enchanted1 or enchanted2 then
|
||||
if blocking == 1 then
|
||||
player:hud_change(shieldhud, "text", hud .. "^[transform4")
|
||||
else
|
||||
player:hud_change(shieldhud, "text", hud)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
|
||||
handle_blocking(player)
|
||||
|
||||
local blocking, shieldstack = mcl_shields.is_blocking(player)
|
||||
|
||||
if blocking then
|
||||
update_shield_hud(player, blocking, shieldstack)
|
||||
else
|
||||
remove_shield_hud(player)
|
||||
end
|
||||
|
||||
for i = 1, 2 do
|
||||
update_shield_entity(player, blocking, i)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_dieplayer(function(player)
|
||||
remove_shield_hud(player)
|
||||
if not minetest.settings:get_bool("mcl_keepInventory") then
|
||||
remove_shield_entity(player, 1)
|
||||
remove_shield_entity(player, 2)
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
shield_hud[player] = nil
|
||||
mcl_shields.players[player] = nil
|
||||
end)
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_shields:shield",
|
||||
recipe = {
|
||||
{"group:wood", "mcl_core:iron_ingot", "group:wood"},
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
{"", "group:wood", ""},
|
||||
}
|
||||
})
|
||||
|
||||
for _, colortab in pairs(mcl_banners.colors) do
|
||||
local color = colortab[1]
|
||||
minetest.register_tool("mcl_shields:shield_" .. color, {
|
||||
description = S(colortab[6] .. " Shield"),
|
||||
_doc_items_longdesc = S("A shield is a tool used for protecting the player against attacks."),
|
||||
inventory_image = "mcl_shield.png^(mcl_shield_item_overlay.png^[colorize:" .. colortab[4] ..")",
|
||||
stack_max = 1,
|
||||
groups = {
|
||||
shield = 1,
|
||||
weapon = 1,
|
||||
enchantability = -1,
|
||||
no_wieldview = 1,
|
||||
not_in_creative_inventory = 1,
|
||||
offhand_item = 1,
|
||||
},
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
_repair_material = "group:wood",
|
||||
wield_scale = vector.new(2, 2, 2),
|
||||
_shield_color = colortab[4],
|
||||
})
|
||||
|
||||
local banner = "mcl_banners:banner_item_" .. color
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "mcl_shields:shield_" .. color,
|
||||
recipe = {"mcl_shields:shield", banner},
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "mcl_shields:shield_" .. color .. "_enchanted",
|
||||
recipe = {"mcl_shields:shield_enchanted", banner},
|
||||
})
|
||||
end
|
||||
|
||||
local function to_shield_texture(banner_texture)
|
||||
return banner_texture
|
||||
:gsub("mcl_banners_base_inverted.png", "mcl_shield_base_nopattern.png^mcl_shield_pattern_base.png")
|
||||
:gsub("mcl_banners_banner_base.png", "mcl_shield_base_nopattern.png^mcl_shield_pattern_base.png")
|
||||
:gsub("mcl_banners_base", "mcl_shield_pattern_base")
|
||||
:gsub("mcl_banners", "mcl_shield_pattern")
|
||||
end
|
||||
|
||||
local function craft_banner_on_shield(itemstack, player, old_craft_grid, craft_inv)
|
||||
if not string.find(itemstack:get_name(), "mcl_shields:shield_") then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local shield_stack
|
||||
for i = 1, player:get_inventory():get_size("craft") do
|
||||
local stack = old_craft_grid[i]
|
||||
local name = stack:get_name()
|
||||
if minetest.get_item_group(name, "shield") then
|
||||
shield_stack = stack
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, player:get_inventory():get_size("craft") do
|
||||
local banner_stack = old_craft_grid[i]
|
||||
local banner_name = banner_stack:get_name()
|
||||
if string.find(banner_name, "mcl_banners:banner") and shield_stack then
|
||||
local banner_meta = banner_stack:get_meta()
|
||||
local layers_meta = banner_meta:get_string("layers")
|
||||
local new_shield_meta = itemstack:get_meta()
|
||||
if layers_meta ~= "" then
|
||||
local color = mcl_banners.color_reverse(banner_name)
|
||||
local layers = minetest.deserialize(layers_meta)
|
||||
local texture = mcl_banners.make_banner_texture(color, layers)
|
||||
new_shield_meta:set_string("description", mcl_banners.make_advanced_banner_description(itemstack:get_description(), layers))
|
||||
new_shield_meta:set_string("mcl_shields:shield_custom_pattern_texture", to_shield_texture(texture))
|
||||
end
|
||||
itemstack:set_wear(shield_stack:get_wear())
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_craft_predict(function(itemstack, player, old_craft_grid, craft_inv)
|
||||
return craft_banner_on_shield(itemstack, player, old_craft_grid, craft_inv)
|
||||
end)
|
||||
|
||||
minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv)
|
||||
return craft_banner_on_shield(itemstack, player, old_craft_grid, craft_inv)
|
||||
end)
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
mcl_shields.players[player] = {
|
||||
shields = {},
|
||||
blocking = 0,
|
||||
}
|
||||
remove_shield_hud(player)
|
||||
end)
|
|
@ -1,19 +0,0 @@
|
|||
# textdomain: mcl_shields
|
||||
Shield=Schild
|
||||
A shield is a tool used for protecting the player against attacks.=Der Schild ist eine Schutzwaffe, die den Spieler vor Angriffen schützt.
|
||||
White Shield=Weißer Schild
|
||||
Grey Shield=Grauer Schild
|
||||
Light Grey Shield=Hellgrauer Schild
|
||||
Black Shield=Schwarzer Schild
|
||||
Red Shield=Roter Schild
|
||||
Yellow Shield=Gelber Schild
|
||||
Green Shield=Grüner Schild
|
||||
Cyan Shield=Türkiser Schild
|
||||
Blue Shield=Blauer Schild
|
||||
Magenta Shield=Magenta Schild
|
||||
Orange Shield=Oranger Schild
|
||||
Purple Shield=Violetter Schild
|
||||
Brown Shield=Brauner Schild
|
||||
Pink Shield=Rosa Schild
|
||||
Lime Shield=Hellgrüner Schild
|
||||
Light Blue Shield=Hellblauer Schild
|
|
@ -1,19 +0,0 @@
|
|||
# textdomain: mcl_shields
|
||||
Shield=
|
||||
A shield is a tool used for protecting the player against attacks.=
|
||||
White Shield=
|
||||
Grey Shield=
|
||||
Light Grey Shield=
|
||||
Black Shield=
|
||||
Red Shield=
|
||||
Yellow Shield=
|
||||
Green Shield=
|
||||
Cyan Shield=
|
||||
Blue Shield=
|
||||
Magenta Shield=
|
||||
Orange Shield=
|
||||
Purple Shield=
|
||||
Brown Shield=
|
||||
Pink Shield=
|
||||
Lime Shield=
|
||||
Light Blue Shield=
|
|
@ -1,3 +0,0 @@
|
|||
name = mcl_shields
|
||||
author = NO11
|
||||
depends = mcl_damage, mcl_enchanting, mcl_banners, mcl_util, playerphysics
|
|
@ -1,88 +0,0 @@
|
|||
# Blender v3.0.0 OBJ File: ''
|
||||
# www.blender.org
|
||||
mtllib mcl_shield.mtl
|
||||
o Cube.002_Cube.003
|
||||
v 4.663009 11.096291 6.387994
|
||||
v 4.663009 4.596560 5.241916
|
||||
v 5.213008 4.596560 5.241916
|
||||
v 5.213008 11.096291 6.387994
|
||||
v 5.213007 13.197435 -5.528180
|
||||
v 5.213007 6.697705 -6.674258
|
||||
v 4.663008 6.697705 -6.674258
|
||||
v 4.663008 13.197435 -5.528180
|
||||
v 4.663008 8.641873 -1.863572
|
||||
v 4.663008 8.068833 1.386293
|
||||
v 1.363008 8.068833 1.386294
|
||||
v 1.363008 8.641873 -1.863572
|
||||
v 1.363008 9.152122 1.577307
|
||||
v 1.363008 9.725162 -1.672559
|
||||
v 4.663008 9.152122 1.577306
|
||||
v 4.663008 9.725162 -1.672559
|
||||
vt 0.015625 0.984375
|
||||
vt 0.203125 0.984375
|
||||
vt 0.203125 1.000000
|
||||
vt 0.015625 1.000000
|
||||
vt 0.203125 0.640625
|
||||
vt 0.203125 0.984375
|
||||
vt 0.015625 0.984375
|
||||
vt 0.015625 0.640625
|
||||
vt 0.015625 0.984375
|
||||
vt 0.015625 0.640625
|
||||
vt -0.000000 0.640625
|
||||
vt -0.000000 0.984375
|
||||
vt 0.203125 0.984375
|
||||
vt 0.390625 0.984375
|
||||
vt 0.390625 1.000000
|
||||
vt 0.203125 1.000000
|
||||
vt 0.203125 0.984375
|
||||
vt 0.203125 0.640625
|
||||
vt 0.218750 0.640625
|
||||
vt 0.218750 0.984375
|
||||
vt 0.406250 0.640625
|
||||
vt 0.406250 0.984375
|
||||
vt 0.218750 0.984375
|
||||
vt 0.218750 0.640625
|
||||
vt 0.531250 0.812500
|
||||
vt 0.625000 0.812500
|
||||
vt 0.625000 0.906250
|
||||
vt 0.531250 0.906250
|
||||
vt 0.500000 0.906250
|
||||
vt 0.500000 0.812500
|
||||
vt 0.531250 0.812500
|
||||
vt 0.531250 0.906250
|
||||
vt 0.406250 0.812500
|
||||
vt 0.500000 0.812500
|
||||
vt 0.500000 0.906250
|
||||
vt 0.406250 0.906250
|
||||
vt 0.625000 0.812500
|
||||
vt 0.656250 0.812500
|
||||
vt 0.656250 0.906250
|
||||
vt 0.625000 0.906250
|
||||
vt 0.562500 1.000000
|
||||
vt 0.531250 1.000000
|
||||
vt 0.531250 0.906250
|
||||
vt 0.562500 0.906250
|
||||
vt 0.531250 1.000000
|
||||
vt 0.500000 1.000000
|
||||
vt 0.500000 0.906250
|
||||
vt 0.531250 0.906250
|
||||
vn 0.0000 -0.1736 0.9848
|
||||
vn 1.0000 0.0000 -0.0000
|
||||
vn 0.0000 -0.9848 -0.1736
|
||||
vn 0.0000 0.1736 -0.9848
|
||||
vn 0.0000 0.9848 0.1736
|
||||
vn -1.0000 -0.0000 0.0000
|
||||
usemtl Material.002
|
||||
s 1
|
||||
f 1/1/1 2/2/1 3/3/1 4/4/1
|
||||
f 5/5/2 4/6/2 3/7/2 6/8/2
|
||||
f 6/9/3 3/10/3 2/11/3 7/12/3
|
||||
f 7/13/4 8/14/4 5/15/4 6/16/4
|
||||
f 8/17/5 1/18/5 4/19/5 5/20/5
|
||||
f 7/21/6 2/22/6 1/23/6 8/24/6
|
||||
f 9/25/3 10/26/3 11/27/3 12/28/3
|
||||
f 12/29/6 11/30/6 13/31/6 14/32/6
|
||||
f 14/33/5 13/34/5 15/35/5 16/36/5
|
||||
f 16/37/2 15/38/2 10/39/2 9/40/2
|
||||
f 12/41/4 14/42/4 16/43/4 9/44/4
|
||||
f 13/45/1 11/46/1 10/47/1 15/48/1
|
Before Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 639 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 878 B |
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 4.3 KiB |
|
@ -12,14 +12,6 @@ mcl_damage.register_modifier(function(obj, damage, reason)
|
|||
local hp = obj:get_hp()
|
||||
if hp - damage <= 0 then
|
||||
local wield = obj:get_wielded_item()
|
||||
local in_offhand = false
|
||||
if not (wield:get_name() == "mobs_mc:totem") then
|
||||
local inv = obj:get_inventory()
|
||||
if inv then
|
||||
wield = obj:get_inventory():get_stack("offhand", 1)
|
||||
in_offhand = true
|
||||
end
|
||||
end
|
||||
if wield:get_name() == "mobs_mc:totem" then
|
||||
local ppos = obj:get_pos()
|
||||
local pnname = minetest.get_node(ppos).name
|
||||
|
@ -36,12 +28,7 @@ mcl_damage.register_modifier(function(obj, damage, reason)
|
|||
|
||||
if not minetest.is_creative_enabled(obj:get_player_name()) then
|
||||
wield:take_item()
|
||||
if in_offhand then
|
||||
obj:get_inventory():set_stack("offhand", 1, wield)
|
||||
mcl_inventory.update_inventory_formspec(obj)
|
||||
else
|
||||
obj:set_wielded_item(wield)
|
||||
end
|
||||
obj:set_wielded_item(wield)
|
||||
end
|
||||
|
||||
-- Effects
|
||||
|
|
|
@ -71,21 +71,21 @@ for _, row in ipairs(wool.dyes) do
|
|||
_doc_items_entry_name = name_carpet,
|
||||
_doc_items_longdesc = longdesc_carpet,
|
||||
|
||||
drawtype = "nodebox",
|
||||
is_ground_content = false,
|
||||
tiles = {texture..".png"},
|
||||
wield_image = texture..".png",
|
||||
wield_scale = { x=1, y=1, z=0.5 },
|
||||
groups = {handy=1, carpet=1,supported_node=1,flammable=1,fire_encouragement=60, fire_flammability=20, dig_by_water=1,deco_block=1,[color_group]=1},
|
||||
groups = {handy=1, carpet=1,attached_node=1,flammable=1,fire_encouragement=60, fire_flammability=20, dig_by_water=1,deco_block=1,[color_group]=1},
|
||||
sounds = mcl_sounds.node_sound_wool_defaults(),
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
sunlight_propagates = true,
|
||||
stack_max = 64,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-8/16, -8/16, -8/16, 8/16, -7/16, 8/16},
|
||||
},
|
||||
type = "wallmounted",
|
||||
wall_top = {-8/16, -8/16, -8/16, 8/16, -7/16, 8/16},
|
||||
wall_side = {-8/16, -8/16, -8/16, 8/16, -7/16, 8/16},
|
||||
},
|
||||
_mcl_hardness = 0.1,
|
||||
_mcl_blast_resistance = 0.1,
|
||||
|
|
|
@ -7,7 +7,7 @@ minetest.register_privilege("maphack", {
|
|||
minetest.register_on_joinplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
local meta = player:get_meta()
|
||||
if meta:get_int("mcl_privs:fly_changed") == 1 then return end
|
||||
if meta:get_int("fly_changed") == 1 then return end
|
||||
|
||||
local fly = nil
|
||||
if minetest.is_creative_enabled(name) then
|
||||
|
@ -20,27 +20,10 @@ end)
|
|||
|
||||
for _, action in pairs({"grant", "revoke"}) do
|
||||
minetest["register_on_priv_" .. action](function(name, _, priv)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if not player then
|
||||
return
|
||||
end
|
||||
|
||||
local meta = player:get_meta()
|
||||
|
||||
if priv == "fly" then
|
||||
meta:set_int("mcl_privs:fly_changed", 1)
|
||||
end
|
||||
|
||||
--[[
|
||||
so e.g. hackers who have been revoked of the interact privilege
|
||||
will not automatically get the interact privilege through the mcl shields code back
|
||||
]]
|
||||
if priv == "interact" then
|
||||
if action == "revoke" then
|
||||
meta:set_int("mcl_privs:interact_revoked", 1)
|
||||
else
|
||||
meta:set_int("mcl_privs:interact_revoked", 0)
|
||||
end
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local meta = player:get_meta()
|
||||
meta:set_int("fly_changed", 1)
|
||||
end
|
||||
end)
|
||||
end
|
|
@ -13,7 +13,6 @@ end
|
|||
mcl_death_drop.register_dropped_list("PLAYER", "main", true)
|
||||
mcl_death_drop.register_dropped_list("PLAYER", "craft", true)
|
||||
mcl_death_drop.register_dropped_list("PLAYER", "armor", true)
|
||||
mcl_death_drop.register_dropped_list("PLAYER", "offhand", true)
|
||||
|
||||
minetest.register_on_dieplayer(function(player)
|
||||
local keep = minetest.settings:get_bool("mcl_keepInventory", false)
|
||||
|
|
|
@ -9,8 +9,7 @@ local animation_blend = 0
|
|||
local function get_mouse_button(player)
|
||||
local controls = player:get_player_control()
|
||||
local get_wielded_item_name = player:get_wielded_item():get_name()
|
||||
if controls.RMB and not string.find(get_wielded_item_name, "mcl_bows:bow") and not string.find(get_wielded_item_name, "mcl_bows:crossbow") and
|
||||
not mcl_shields.wielding_shield(player, 1) and not mcl_shields.wielding_shield(player, 2) or controls.LMB then
|
||||
if controls.RMB and not string.find(get_wielded_item_name, "mcl_bows:bow") and not string.find(get_wielded_item_name, "mcl_bows:crossbow") or controls.LMB then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
|
@ -189,9 +188,7 @@ minetest.register_globalstep(function(dtime)
|
|||
animation_speed_mod = animation_speed_mod / 2
|
||||
end
|
||||
|
||||
if mcl_shields.is_blocking(player) then
|
||||
animation_speed_mod = animation_speed_mod / 2
|
||||
end
|
||||
|
||||
|
||||
-- ask if player is swiming
|
||||
local head_in_water = minetest.get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0
|
||||
|
@ -207,8 +204,6 @@ minetest.register_globalstep(function(dtime)
|
|||
or walking and velocity.x < -0.35
|
||||
or walking and velocity.z > 0.35
|
||||
or walking and velocity.z < -0.35 then
|
||||
local wielded_itemname = player:get_wielded_item():get_name()
|
||||
local no_arm_moving = string.find(wielded_itemname, "mcl_bows:bow") or mcl_shields.wielding_shield(player, 1) or mcl_shields.wielding_shield(player, 2)
|
||||
if player_sneak[name] ~= controls.sneak then
|
||||
player_anim[name] = nil
|
||||
player_sneak[name] = controls.sneak
|
||||
|
@ -217,9 +212,9 @@ minetest.register_globalstep(function(dtime)
|
|||
player_set_animation(player, "swim_walk_mine", animation_speed_mod)
|
||||
elseif not controls.sneak and head_in_water and is_sprinting == true then
|
||||
player_set_animation(player, "swim_walk", animation_speed_mod)
|
||||
elseif no_arm_moving and controls.RMB and controls.sneak or string.find(wielded_itemname, "mcl_bows:crossbow_") and controls.sneak then
|
||||
elseif string.find(player:get_wielded_item():get_name(), "mcl_bows:bow") and controls.RMB and controls.sneak or string.find(player:get_wielded_item():get_name(), "mcl_bows:crossbow_") and controls.sneak then
|
||||
player_set_animation(player, "bow_sneak", animation_speed_mod)
|
||||
elseif no_arm_moving and controls.RMB or string.find(wielded_itemname, "mcl_bows:crossbow_") then
|
||||
elseif string.find(player:get_wielded_item():get_name(), "mcl_bows:bow") and controls.RMB or string.find(player:get_wielded_item():get_name(), "mcl_bows:crossbow_") then
|
||||
player_set_animation(player, "bow_walk", animation_speed_mod)
|
||||
elseif is_sprinting == true and get_mouse_button(player) == true and not controls.sneak and not head_in_water then
|
||||
player_set_animation(player, "run_walk_mine", animation_speed_mod)
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
name = mcl_player
|
||||
author = celeron55
|
||||
description = Adds the 3D player model, taken from Minetest Game 0.4.16.
|
||||
depends = mcl_shields
|
|
@ -35,8 +35,8 @@ local function player_collision(player)
|
|||
|
||||
for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do
|
||||
|
||||
local ent = object:get_luaentity()
|
||||
if (object:is_player() or (ent and ent._cmi_is_mob and object ~= player)) then
|
||||
if object and (object:is_player()
|
||||
or (object:get_luaentity()._cmi_is_mob == true and object ~= player)) then
|
||||
|
||||
local pos2 = object:get_pos()
|
||||
local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z}
|
||||
|
@ -321,12 +321,8 @@ minetest.register_globalstep(function(dtime)
|
|||
player_velocity_old = player:get_velocity() or player:get_player_velocity()
|
||||
|
||||
|
||||
-- controls right and left arms pitch when shooting a bow or blocking
|
||||
if mcl_shields.is_blocking(player) == 2 then
|
||||
set_bone_position_conditional(player, "Arm_Right_Pitch_Control", vector.new(-3, 5.785, 0), vector.new(20, -20, 0))
|
||||
elseif mcl_shields.is_blocking(player) == 1 then
|
||||
set_bone_position_conditional(player, "Arm_Left_Pitch_Control", vector.new(3, 5.785, 0), vector.new(20, 20, 0))
|
||||
elseif string.find(wielded:get_name(), "mcl_bows:bow") and control.RMB then
|
||||
-- controls right and left arms pitch when shooting a bow
|
||||
if string.find(wielded:get_name(), "mcl_bows:bow") and control.RMB then
|
||||
set_bone_position_conditional(player,"Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch+90,-30,pitch * -1 * .35))
|
||||
set_bone_position_conditional(player,"Arm_Left_Pitch_Control", vector.new(3.5,5.785,0), vector.new(pitch+90,43,pitch * .35))
|
||||
-- controls right and left arms pitch when holing a loaded crossbow
|
||||
|
@ -334,7 +330,7 @@ minetest.register_globalstep(function(dtime)
|
|||
set_bone_position_conditional(player,"Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch+90,-30,pitch * -1 * .35))
|
||||
set_bone_position_conditional(player,"Arm_Left_Pitch_Control", vector.new(3.5,5.785,0), vector.new(pitch+90,43,pitch * .35))
|
||||
-- controls right and left arms pitch when loading a crossbow
|
||||
elseif string.find(wielded:get_name(), "mcl_bows:crossbow_") then
|
||||
elseif string.find(wielded:get_name(), "mcl_bows:crossbow_") then
|
||||
set_bone_position_conditional(player,"Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(45,-20,25))
|
||||
set_bone_position_conditional(player,"Arm_Left_Pitch_Control", vector.new(3,5.785,0), vector.new(55,20,-45))
|
||||
-- when punching
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name = mcl_playerplus
|
||||
author = TenPlus1
|
||||
description = Adds some simple player-related gameplay effects: Hurt by touching a cactus, suffocation and more.
|
||||
depends = mcl_init, mcl_core, mcl_particles, mcl_hunger, playerphysics, mcl_playerinfo, mcl_weather, mcl_spawn, mcl_enchanting, mcl_damage, mcl_sprint, mcl_util, mcl_shields
|
||||
depends = mcl_init, mcl_core, mcl_particles, mcl_hunger, playerphysics, mcl_playerinfo, mcl_weather, mcl_spawn, mcl_enchanting, mcl_damage, mcl_sprint
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ mcl_wieldview = {
|
|||
}
|
||||
|
||||
function mcl_wieldview.get_item_texture(itemname)
|
||||
if itemname == "" or minetest.get_item_group(itemname, "no_wieldview") ~= 0 then
|
||||
if itemname == "" then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -113,10 +113,6 @@ minetest.register_entity("mcl_wieldview:wieldnode", {
|
|||
self.object:set_properties({textures = {""}})
|
||||
end
|
||||
|
||||
if minetest.get_item_group(itemstring, "no_wieldview") ~= 0 then
|
||||
self.object:set_properties({textures = {""}})
|
||||
end
|
||||
|
||||
self.itemstring = itemstring
|
||||
end
|
||||
else
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
CORE/_mcl_autogroup/init.lua:
|
||||
-> Enumerates entries of the registered_nodes table. Safe.
|
||||
|
||||
CORE/flowlib/init.lua:
|
||||
-> All instances are checked before use.
|
||||
|
||||
CORE/mcl_explosions/init.lua:
|
||||
-> Enumerates entries of the registered_nodes table. Safe.
|
||||
|
||||
CORE/walkover/init.lua:
|
||||
-> Enumerates entries of the registered_nodes table. Safe.
|
||||
|
||||
CORE/mcl_util/init.lua:
|
||||
-> All instances are checked before use.
|
||||
- should use local.
|
||||
- defines mcl_util.call_on_rightclick, but does not use it.
|
|
@ -0,0 +1,61 @@
|
|||
ENTITIES/mcl_boats/init.lua:
|
||||
-> All instances are checked before use.
|
||||
- one use in stray comment.
|
||||
- should use local or should use mcl_util.call_on_rightclick.
|
||||
|
||||
ENTITIES/mcl_dripping/init.lua:
|
||||
-> Only references one directly indexed entry. Safe.
|
||||
|
||||
ENTITIES/mcl_mobs/api.lua:
|
||||
-> Uses node_ok() that checks and always returns valid nodes. Safe.
|
||||
- line 1331 minetest.registered_items? Fixed
|
||||
- should use locals.
|
||||
|
||||
ENTITIES/mcl_mobs/spawning.lua:
|
||||
-> Only instances in commented out spawning code. Safe.
|
||||
|
||||
ENTITIES/mcl_mobs/mount.lua:
|
||||
-> All instances shielded by node_ok(). Safe.
|
||||
|
||||
ENTITIES/mobs_mc/snowman.lua:
|
||||
-> All instances checked. Safe.
|
||||
- line 107 belowdef.nod_box == nil ?
|
||||
|
||||
ENTITIES/mobs_mc/2_throwing.lua:
|
||||
-> All instances checked. Safe.
|
||||
|
||||
ENTITIES/mobs_mc/3_shared.lua:
|
||||
-> Unchecked accesses. Fixed.
|
||||
|
||||
ENTITIES/mobs_mc/enderman.lua:
|
||||
-> Unchecked accesses. Fixed.
|
||||
- line 69: use indexed registered_nodes.
|
||||
- line 259: weird but works.
|
||||
- line 409 and onwards: restricted to takable_nodes.
|
||||
|
||||
ENTITIES/mobs_mc/blaze.lua:
|
||||
-> Unchecked access. Fixed.
|
||||
|
||||
ENTITIES/mobs_mc/slime+magma_cube.lua:
|
||||
-> Unchecked accesses. Fixed.
|
||||
|
||||
ENTITIES/mobs_mc/5_spawn_abm_check.lua:
|
||||
-> Does not appear to be used at all.
|
||||
- unchecked access. Unfixed.
|
||||
|
||||
ENTITIES/mcl_paintings/init.lua:
|
||||
-> All instances checked. Safe.
|
||||
|
||||
ENTITIES/mcl_item_entity/init.lua:
|
||||
-> Unchecked access. Fixed.
|
||||
|
||||
ENTITIES/mcl_falling_nodes/init.lua:
|
||||
-> All instances checked. Safe.
|
||||
- line 170: minetest.registered_nodes[self.node.name] is the same as bcd set on line 155
|
||||
because of condition on line 164, therefore this access is safe. Sloppy code though.
|
||||
|
||||
ENTITIES/mcl_minecarts/init.lua:
|
||||
-> Unchecked access. Fixed.
|
||||
|
||||
ENTITIES/mobs_mc_gameconfig/init.lua:
|
||||
-> Only explicit indexing of registered_nodes. Safe
|
|
@ -0,0 +1,156 @@
|
|||
ITEMS/mcl_portals/portal_nether.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_portals/portal_gateway.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_portals/portal_end.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_sponges/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_beds/api.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_beds/functions.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_torches/api.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_tools/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_ocean/seagrass.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_ocean/kelp.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_ocean/corals.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_ocean/sea_pickle.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_lanterns/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_stairs/api.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_stairs/cornerstair.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_dye/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_bows/crossbow.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_bows/bow.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_bows/rocket.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_bows/arrow.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_buckets/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_buckets/register.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_throwing/register.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_flowers/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_tnt/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_cocoas/init.lua
|
||||
-> not checked.
|
||||
ITEMS/xpanes/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_potions/tipped_arrow.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_potions/potions.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_potions/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_end/end_crystal.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_end/chorus_plant.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_walls/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_fishing/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_composters/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_heads/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mclx_fences/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_mobspawners/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mclx_stairs/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mclx_core/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_core/nodes_base.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_core/nodes_misc.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_core/nodes_cactuscane.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_core/nodes_climb.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_core/craftitems.lua
|
||||
-> not checked.
|
||||
|
||||
ITEMS/mcl_core/functions.lua
|
||||
-> Unchecked accesses. Fixed.
|
||||
|
||||
ITEMS/mcl_fire/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_fire/fire_charge.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_fire/flint_and_steel.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_banners/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_farming/shared_functions.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_farming/hoes.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_farming/soil.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_signs/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_maps/init.lua
|
||||
-> not checked.
|
||||
ITEMS/screwdriver/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_nether/lava.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_nether/nether_wart.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_books/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_chests/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_hoppers/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_colorblocks/init.lua
|
||||
-> not checked.
|
||||
ITEMS/REDSTONE/mcl_dispensers/init.lua
|
||||
-> not checked.
|
||||
ITEMS/REDSTONE/mcl_droppers/init_new.lua
|
||||
-> not checked.
|
||||
ITEMS/REDSTONE/mcl_droppers/init.lua
|
||||
-> not checked.
|
||||
ITEMS/REDSTONE/mcl_comparators/init.lua
|
||||
-> not checked.
|
||||
ITEMS/REDSTONE/mesecons_pressureplates/init.lua
|
||||
-> not checked.
|
||||
ITEMS/REDSTONE/mesecons_walllever/init.lua
|
||||
-> not checked.
|
||||
ITEMS/REDSTONE/mesecons_button/init.lua
|
||||
-> not checked.
|
||||
ITEMS/REDSTONE/mesecons/internal.lua
|
||||
-> not checked.
|
||||
ITEMS/REDSTONE/mesecons/util.lua
|
||||
-> not checked.
|
||||
ITEMS/REDSTONE/mesecons_mvps/init.lua
|
||||
-> not checked.
|
||||
ITEMS/REDSTONE/mesecons_wires/init.lua
|
||||
-> not checked.
|
||||
ITEMS/REDSTONE/mesecons_delayer/init.lua
|
||||
-> not checked.
|
||||
ITEMS/REDSTONE/mesecons_pistons/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_itemframes/init.lua
|
||||
-> not checked.
|
||||
ITEMS/mcl_doors/api_doors.lua
|
||||
-> not checked.
|
|
@ -0,0 +1,17 @@
|
|||
MAPGEN/mcl_villages/buildings.lua
|
||||
-> Only use is checked. Safe.
|
||||
|
||||
MAPGEN/mcl_villages/utils.lua
|
||||
-> Only indexed uses. Safe.
|
||||
|
||||
MAPGEN/tsm_railcorridors/init.lua
|
||||
-> Unchecked accesses. Fixed.
|
||||
|
||||
MAPGEN/mcl_structures/init.lua
|
||||
-> Unchecked access. Fixed.
|
||||
|
||||
MAPGEN/mcl_dungeons/init.lua
|
||||
-> Unchecked accesses. Fixed.
|
||||
|
||||
MAPGEN/mcl_mapgen_core/init.lua
|
||||
-> All uses are checked. Safe.
|