mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 04:21:07 +01:00
Bane of Arthropods; Smite; Lure
This commit is contained in:
parent
479dfd6c0d
commit
3d7bb69e81
17 changed files with 60 additions and 45 deletions
|
@ -56,7 +56,6 @@ for m=1, #materials do
|
||||||
mcl_autogroup.creativetimes[basegroups[g].."_dig_"..materials[m]] = {}
|
mcl_autogroup.creativetimes[basegroups[g].."_dig_"..materials[m]] = {}
|
||||||
for e=1, max_efficiency_level do
|
for e=1, max_efficiency_level do
|
||||||
mcl_autogroup.digtimes[basegroups[g].."_dig_"..materials[m].."_efficiency_"..e] = {}
|
mcl_autogroup.digtimes[basegroups[g].."_dig_"..materials[m].."_efficiency_"..e] = {}
|
||||||
mcl_autogroup.creativetimes[basegroups[g].."_dig_"..materials[m].."_efficiency_"..e] = {}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -109,7 +108,9 @@ local overwrite = function()
|
||||||
time = math.ceil(time * 20) / 20
|
time = math.ceil(time * 20) / 20
|
||||||
end
|
end
|
||||||
table.insert(mcl_autogroup.digtimes[diggroup], time)
|
table.insert(mcl_autogroup.digtimes[diggroup], time)
|
||||||
table.insert(mcl_autogroup.creativetimes[diggroup], 0)
|
if not efficiency then
|
||||||
|
table.insert(mcl_autogroup.creativetimes[diggroup], 0)
|
||||||
|
end
|
||||||
newgroups[diggroup] = #mcl_autogroup.digtimes[diggroup]
|
newgroups[diggroup] = #mcl_autogroup.digtimes[diggroup]
|
||||||
return newgroups
|
return newgroups
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,9 +15,17 @@
|
||||||
requires_tool = false,
|
requires_tool = false,
|
||||||
}]]--
|
}]]--
|
||||||
|
|
||||||
-- unimplemented
|
local function increase_damage(damage_group, factor)
|
||||||
mcl_enchanting.enchantments.bane_of_anthropods = {
|
return function(itemstack, level)
|
||||||
name = "Bane of Anthropods",
|
local tool_capabilities = itemstack:get_tool_capabilities()
|
||||||
|
tool_capabilities.damage_groups[damage_group] = (tool_capabilities.damage_groups[damage_group] or 0) + level * factor
|
||||||
|
itemstack:get_meta():set_tool_capabilities(tool_capabilities)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- implemented via on_enchant and additions in mobs_mc; Slowness IV part unimplemented
|
||||||
|
mcl_enchanting.enchantments.bane_of_arthropods = {
|
||||||
|
name = "Bane of Arthropods",
|
||||||
max_level = 5,
|
max_level = 5,
|
||||||
primary = {sword = true},
|
primary = {sword = true},
|
||||||
secondary = {axe = true},
|
secondary = {axe = true},
|
||||||
|
@ -26,7 +34,7 @@ mcl_enchanting.enchantments.bane_of_anthropods = {
|
||||||
weight = 5,
|
weight = 5,
|
||||||
description = "Increases damage and applies Slowness IV to arthropod mobs (spiders, cave spiders, silverfish and endermites).",
|
description = "Increases damage and applies Slowness IV to arthropod mobs (spiders, cave spiders, silverfish and endermites).",
|
||||||
curse = false,
|
curse = false,
|
||||||
on_enchant = function() end,
|
on_enchant = increase_damage("anthropod", 2.5),
|
||||||
requires_tool = false,
|
requires_tool = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,7 +305,7 @@ mcl_enchanting.enchantments.luck_of_the_sea = {
|
||||||
requires_tool = false,
|
requires_tool = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- unimplemented
|
-- implemented in mcl_fishing
|
||||||
mcl_enchanting.enchantments.lure = {
|
mcl_enchanting.enchantments.lure = {
|
||||||
name = "Lure",
|
name = "Lure",
|
||||||
max_level = 3,
|
max_level = 3,
|
||||||
|
@ -409,19 +417,11 @@ mcl_enchanting.enchantments.sharpness = {
|
||||||
primary = {sword = true},
|
primary = {sword = true},
|
||||||
secondary = {axe = true},
|
secondary = {axe = true},
|
||||||
disallow = {},
|
disallow = {},
|
||||||
incompatible = {bane_of_anthropods = true, smite = true},
|
incompatible = {bane_of_arthropods = true, smite = true},
|
||||||
weight = 5,
|
weight = 5,
|
||||||
description = "Increases damage.",
|
description = "Increases damage.",
|
||||||
curse = false,
|
curse = false,
|
||||||
on_enchant = function(itemstack, level)
|
on_enchant = increase_damage("fleshy", 0.5),
|
||||||
local tool_capabilities = itemstack:get_tool_capabilities()
|
|
||||||
local damage_groups = {}
|
|
||||||
for group, damage in pairs(tool_capabilities.damage_groups) do
|
|
||||||
damage_groups[group] = damage + level * 0.5
|
|
||||||
end
|
|
||||||
tool_capabilities.damage_groups = damage_groups
|
|
||||||
itemstack:get_meta():set_tool_capabilities(tool_capabilities)
|
|
||||||
end,
|
|
||||||
requires_tool = false,
|
requires_tool = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,18 +440,18 @@ mcl_enchanting.enchantments.silk_touch = {
|
||||||
requires_tool = false,
|
requires_tool = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- unimplemented
|
-- implemented via on_enchant and additions in mobs_mc
|
||||||
mcl_enchanting.enchantments.smite = {
|
mcl_enchanting.enchantments.smite = {
|
||||||
name = "Smite",
|
name = "Smite",
|
||||||
max_level = 5,
|
max_level = 5,
|
||||||
primary = {sword = true},
|
primary = {sword = true},
|
||||||
secondary = {axe = true},
|
secondary = {axe = true},
|
||||||
disallow = {},
|
disallow = {},
|
||||||
incompatible = {bane_of_anthropods = true, sharpness = true},
|
incompatible = {bane_of_arthropods = true, sharpness = true},
|
||||||
weight = 5,
|
weight = 5,
|
||||||
description = "Increases damage to undead mobs.",
|
description = "Increases damage to undead mobs.",
|
||||||
curse = false,
|
curse = false,
|
||||||
on_enchant = function() end,
|
on_enchant = increase_damage("undead", 2.5),
|
||||||
requires_tool = false,
|
requires_tool = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,11 @@ end
|
||||||
|
|
||||||
function mcl_enchanting.initialize()
|
function mcl_enchanting.initialize()
|
||||||
local all_groups = {}
|
local all_groups = {}
|
||||||
|
local weighted = {}
|
||||||
|
local accum_weight = 0
|
||||||
for enchantment, enchantment_def in pairs(mcl_enchanting.enchantments) do
|
for enchantment, enchantment_def in pairs(mcl_enchanting.enchantments) do
|
||||||
|
accum_weight = accum_weight + enchantment_def.weight
|
||||||
|
weighted[#weighted + 1] = {enchantment = enchantment, weight = accum_weight}
|
||||||
for primary in pairs(enchantment_def.primary) do
|
for primary in pairs(enchantment_def.primary) do
|
||||||
all_groups[primary] = true
|
all_groups[primary] = true
|
||||||
end
|
end
|
||||||
|
@ -183,6 +187,8 @@ function mcl_enchanting.initialize()
|
||||||
all_groups[secondary] = true
|
all_groups[secondary] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
mcl_enchanting.accumulated_weight = accum_weight
|
||||||
|
mcl_enchanting.accumulated_weight = weighted
|
||||||
local register_tool_list = {}
|
local register_tool_list = {}
|
||||||
local register_item_list = {}
|
local register_item_list = {}
|
||||||
for itemname, itemdef in pairs(minetest.registered_items) do
|
for itemname, itemdef in pairs(minetest.registered_items) do
|
||||||
|
@ -238,4 +244,3 @@ function mcl_enchanting.initialize()
|
||||||
minetest.register_tool(new_name, new_def)
|
minetest.register_tool(new_name, new_def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@ mcl_enchanting = {
|
||||||
book_offset = vector.new(0, 0.75, 0),
|
book_offset = vector.new(0, 0.75, 0),
|
||||||
roman_numerals = dofile(modpath .. "/roman_numerals.lua"), -- https://exercism.io/tracks/lua/exercises/roman-numerals/solutions/73c2fb7521e347209312d115f872fa49
|
roman_numerals = dofile(modpath .. "/roman_numerals.lua"), -- https://exercism.io/tracks/lua/exercises/roman-numerals/solutions/73c2fb7521e347209312d115f872fa49
|
||||||
enchantments = {},
|
enchantments = {},
|
||||||
|
weighted_enchantments = {},
|
||||||
|
accumulated_weight = 0,
|
||||||
debug = false,
|
debug = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ mobs:register_mob("mobs_mc:endermite", {
|
||||||
passive = false,
|
passive = false,
|
||||||
hp_min = 8,
|
hp_min = 8,
|
||||||
hp_max = 8,
|
hp_max = 8,
|
||||||
armor = 100,
|
armor = {fleshy = 100, arthropod = 100},
|
||||||
group_attack = true,
|
group_attack = true,
|
||||||
collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.29, 0.2},
|
collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.29, 0.2},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
|
|
|
@ -352,6 +352,7 @@ mobs:register_mob("mobs_mc:horse", horse)
|
||||||
-- Skeleton horse
|
-- Skeleton horse
|
||||||
local skeleton_horse = table.copy(horse)
|
local skeleton_horse = table.copy(horse)
|
||||||
skeleton_horse.breath_max = -1
|
skeleton_horse.breath_max = -1
|
||||||
|
skeleton_horse.armor = {undead = 100, fleshy = 100}
|
||||||
skeleton_horse.textures = {{"blank.png", "mobs_mc_horse_skeleton.png", "blank.png"}}
|
skeleton_horse.textures = {{"blank.png", "mobs_mc_horse_skeleton.png", "blank.png"}}
|
||||||
skeleton_horse.drops = {
|
skeleton_horse.drops = {
|
||||||
{name = mobs_mc.items.bone,
|
{name = mobs_mc.items.bone,
|
||||||
|
@ -371,6 +372,7 @@ mobs:register_mob("mobs_mc:skeleton_horse", skeleton_horse)
|
||||||
-- Zombie horse
|
-- Zombie horse
|
||||||
local zombie_horse = table.copy(horse)
|
local zombie_horse = table.copy(horse)
|
||||||
zombie_horse.breath_max = -1
|
zombie_horse.breath_max = -1
|
||||||
|
zombie_horse.armor = {undead = 100, fleshy = 100}
|
||||||
zombie_horse.textures = {{"blank.png", "mobs_mc_horse_zombie.png", "blank.png"}}
|
zombie_horse.textures = {{"blank.png", "mobs_mc_horse_zombie.png", "blank.png"}}
|
||||||
zombie_horse.drops = {
|
zombie_horse.drops = {
|
||||||
{name = mobs_mc.items.rotten_flesh,
|
{name = mobs_mc.items.rotten_flesh,
|
||||||
|
|
|
@ -12,6 +12,7 @@ mobs:register_mob("mobs_mc:silverfish", {
|
||||||
reach = 1,
|
reach = 1,
|
||||||
hp_min = 8,
|
hp_min = 8,
|
||||||
hp_max = 8,
|
hp_max = 8,
|
||||||
|
armor = {fleshy = 100, arthropod = 100},
|
||||||
collisionbox = {-0.4, -0.01, -0.4, 0.4, 0.44, 0.4},
|
collisionbox = {-0.4, -0.01, -0.4, 0.4, 0.44, 0.4},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "mobs_mc_silverfish.b3d",
|
mesh = "mobs_mc_silverfish.b3d",
|
||||||
|
|
|
@ -18,6 +18,7 @@ local skeleton = {
|
||||||
hp_min = 20,
|
hp_min = 20,
|
||||||
hp_max = 20,
|
hp_max = 20,
|
||||||
breath_max = -1,
|
breath_max = -1,
|
||||||
|
armor = {undead = 100, fleshy = 100},
|
||||||
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.98, 0.3},
|
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.98, 0.3},
|
||||||
pathfinding = 1,
|
pathfinding = 1,
|
||||||
group_attack = true,
|
group_attack = true,
|
||||||
|
|
|
@ -15,6 +15,7 @@ mobs:register_mob("mobs_mc:witherskeleton", {
|
||||||
hp_min = 20,
|
hp_min = 20,
|
||||||
hp_max = 20,
|
hp_max = 20,
|
||||||
breath_max = -1,
|
breath_max = -1,
|
||||||
|
armor = {undead = 100, fleshy = 100},
|
||||||
pathfinding = 1,
|
pathfinding = 1,
|
||||||
group_attack = true,
|
group_attack = true,
|
||||||
collisionbox = {-0.35, -0.01, -0.35, 0.35, 2.39, 0.35},
|
collisionbox = {-0.35, -0.01, -0.35, 0.35, 2.39, 0.35},
|
||||||
|
|
|
@ -23,6 +23,7 @@ local spider = {
|
||||||
reach = 2,
|
reach = 2,
|
||||||
hp_min = 16,
|
hp_min = 16,
|
||||||
hp_max = 16,
|
hp_max = 16,
|
||||||
|
armor = {fleshy = 100, arthropod = 100},
|
||||||
collisionbox = {-0.7, -0.01, -0.7, 0.7, 0.89, 0.7},
|
collisionbox = {-0.7, -0.01, -0.7, 0.7, 0.89, 0.7},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "mobs_mc_spider.b3d",
|
mesh = "mobs_mc_spider.b3d",
|
||||||
|
|
|
@ -18,7 +18,7 @@ mobs:register_mob("mobs_mc:villager_zombie", {
|
||||||
hp_min = 20,
|
hp_min = 20,
|
||||||
hp_max = 20,
|
hp_max = 20,
|
||||||
breath_max = -1,
|
breath_max = -1,
|
||||||
armor = 90,
|
armor = {undead = 90, fleshy = 90},
|
||||||
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.94, 0.3},
|
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.94, 0.3},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "mobs_mc_villager_zombie.b3d",
|
mesh = "mobs_mc_villager_zombie.b3d",
|
||||||
|
|
|
@ -14,7 +14,7 @@ mobs:register_mob("mobs_mc:wither", {
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
hp_max = 300,
|
hp_max = 300,
|
||||||
hp_min = 300,
|
hp_min = 300,
|
||||||
armor = 80,
|
armor = {undead = 80, fleshy = 80},
|
||||||
-- This deviates from MC Wiki's size, which makes no sense
|
-- This deviates from MC Wiki's size, which makes no sense
|
||||||
collisionbox = {-0.9, 0.4, -0.9, 0.9, 2.45, 0.9},
|
collisionbox = {-0.9, 0.4, -0.9, 0.9, 2.45, 0.9},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
|
|
|
@ -44,7 +44,7 @@ local zombie = {
|
||||||
hp_min = 20,
|
hp_min = 20,
|
||||||
hp_max = 20,
|
hp_max = 20,
|
||||||
breath_max = -1,
|
breath_max = -1,
|
||||||
armor = 90,
|
armor = {undead = 90, fleshy = 90},
|
||||||
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.94, 0.3},
|
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.94, 0.3},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "mobs_mc_zombie.b3d",
|
mesh = "mobs_mc_zombie.b3d",
|
||||||
|
|
|
@ -18,7 +18,7 @@ local pigman = {
|
||||||
hp_min = 20,
|
hp_min = 20,
|
||||||
hp_max = 20,
|
hp_max = 20,
|
||||||
breath_max = -1,
|
breath_max = -1,
|
||||||
armor = 90,
|
armor = {undead = 90, fleshy = 90},
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
group_attack = { "mobs_mc:pigman", "mobs_mc:baby_pigman" },
|
group_attack = { "mobs_mc:pigman", "mobs_mc:baby_pigman" },
|
||||||
damage = 9,
|
damage = 9,
|
||||||
|
|
|
@ -116,7 +116,7 @@ tt.register_snippet(function(itemstring, toolcaps)
|
||||||
-- Weapon stats
|
-- Weapon stats
|
||||||
if toolcaps.damage_groups then
|
if toolcaps.damage_groups then
|
||||||
for group, damage in pairs(toolcaps.damage_groups) do
|
for group, damage in pairs(toolcaps.damage_groups) do
|
||||||
local msg
|
local msg = ""
|
||||||
if group == "fleshy" then
|
if group == "fleshy" then
|
||||||
if damage >= 0 then
|
if damage >= 0 then
|
||||||
msg = S("Damage: @1", damage)
|
msg = S("Damage: @1", damage)
|
||||||
|
|
|
@ -2,3 +2,4 @@ mcl_core
|
||||||
mcl_sounds
|
mcl_sounds
|
||||||
mcl_loot
|
mcl_loot
|
||||||
mcl_mobs
|
mcl_mobs
|
||||||
|
mcl_enchanting
|
||||||
|
|
|
@ -18,8 +18,8 @@ local bobber_ENTITY={
|
||||||
|
|
||||||
_lastpos={},
|
_lastpos={},
|
||||||
_dive = false,
|
_dive = false,
|
||||||
_waittick = nil,
|
_waittime = nil,
|
||||||
_tick = 0,
|
_time = 0,
|
||||||
player=nil,
|
player=nil,
|
||||||
_oldy = nil,
|
_oldy = nil,
|
||||||
objtype="fishing",
|
objtype="fishing",
|
||||||
|
@ -179,11 +179,10 @@ local bobber_on_step = function(self, dtime)
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local wield = player:get_wielded_item()
|
||||||
--Check if player is nearby
|
--Check if player is nearby
|
||||||
if self._tick % 5 == 0 and self.player ~= nil and player ~= nil then
|
if self.player ~= nil and player ~= nil then
|
||||||
--Destroy bobber if item not wielded.
|
--Destroy bobber if item not wielded.
|
||||||
local wield = player:get_wielded_item()
|
|
||||||
if ((not wield) or (minetest.get_item_group(wield:get_name(), "fishing_rod") <= 0)) then
|
if ((not wield) or (minetest.get_item_group(wield:get_name(), "fishing_rod") <= 0)) then
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
return
|
return
|
||||||
|
@ -232,33 +231,34 @@ local bobber_on_step = function(self, dtime)
|
||||||
pos = {x=epos["x"]+math.random(-1,1)*math.random()/2,y=epos["y"]+0.1,z=epos["z"]+math.random(-1,1)*math.random()/2},
|
pos = {x=epos["x"]+math.random(-1,1)*math.random()/2,y=epos["y"]+0.1,z=epos["z"]+math.random(-1,1)*math.random()/2},
|
||||||
velocity = {x=0, y=4, z=0},
|
velocity = {x=0, y=4, z=0},
|
||||||
acceleration = {x=0, y=-5, z=0},
|
acceleration = {x=0, y=-5, z=0},
|
||||||
expirationtime = math.random(),
|
expirationtime = math.random() * 0.5,
|
||||||
size = math.random()+0.5,
|
size = math.random(),
|
||||||
collisiondetection = true,
|
collisiondetection = true,
|
||||||
vertical = false,
|
vertical = false,
|
||||||
texture = "mcl_particles_bubble.png",
|
texture = "mcl_particles_bubble.png",
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
if self._tick ~= self._waittick then
|
if self._time < self._waittime then
|
||||||
self._tick = self._tick + 1
|
self._time = self._time + dtime
|
||||||
else
|
else
|
||||||
self._waittick = nil
|
self._waittime = 0
|
||||||
self._tick = 0
|
self._time = 0
|
||||||
self._dive = false
|
self._dive = false
|
||||||
end
|
end
|
||||||
else if self._waittick == nil then
|
else if not self._waittime or self._waittime <= 0 then
|
||||||
-- wait for random number of ticks.
|
-- wait for random number of ticks.
|
||||||
self._waittick = math.random(50,333)
|
local lure_enchantment = wield and mcl_enchanting.get_enchantment(wield, "lure") or 0
|
||||||
|
self._waittime = math.random(5, 30) - lure_enchantment * 5
|
||||||
else
|
else
|
||||||
if self._tick ~= self._waittick then
|
if self._time < self._waittime then
|
||||||
self._tick = self._tick + 1
|
self._time = self._time + dtime
|
||||||
else
|
else
|
||||||
--wait time is over time to dive.
|
-- wait time is over time to dive.
|
||||||
self._dive = true
|
self._dive = true
|
||||||
self.object:set_velocity({x=0,y=-2,z=0})
|
self.object:set_velocity({x=0,y=-2,z=0})
|
||||||
self.object:set_acceleration({x=0,y=5,z=0})
|
self.object:set_acceleration({x=0,y=5,z=0})
|
||||||
self._waittick = 30
|
self._waittime = 0.8
|
||||||
self._tick = 0
|
self._time = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue