Compare commits
80 Commits
b4c693bb20
...
3d7155c1b9
Author | SHA1 | Date |
---|---|---|
the-real-herowl | 3d7155c1b9 | |
chmodsayshello | e3ab94809e | |
Dark | a66be39d9b | |
ancientmarinerdev | 3564f6ebde | |
chmodsayshello | f99ae93bf6 | |
Freedom | 8d440252a4 | |
the-real-herowl | d706833f21 | |
the-real-herowl | c874e01cf9 | |
the-real-herowl | 7ce82b9dcb | |
the-real-herowl | 645072507f | |
the-real-herowl | 924a6c1c47 | |
the-real-herowl | 20b0f0748d | |
the-real-herowl | d7c76e33d8 | |
the-real-herowl | 966712f4ff | |
the-real-herowl | e4102e6124 | |
the-real-herowl | 17c8f220e6 | |
the-real-herowl | df17688b7d | |
the-real-herowl | 729d8ec9e0 | |
the-real-herowl | c9dc12b081 | |
Nauta Turbidus | a1b6819756 | |
the-real-herowl | f1568483b3 | |
ThePython10110 | d7fa24ebf8 | |
chmodsayshello | 712a6d6c66 | |
𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 | a620d24ec8 | |
ancientmarinerdev | 178b24886f | |
ancientmarinerdev | 8333281b4f | |
Nicu | 6d3e55ce12 | |
ancientmarinerdev | 2c2f5595f3 | |
chmodsayshello | 8936313fb3 | |
ancientmarinerdev | c51442704c | |
𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 | 2bd6678b08 | |
Codiac | e0c44244f9 | |
Codiac | 5b7352a23a | |
Michieal | e8c658658d | |
Michieal | e9d994b74d | |
Michieal | eafe6627d8 | |
chmodsayshello | 4046a68fbf | |
Blockhead | 882c3ef339 | |
Michieal | b2ebcf5d4f | |
Michieal | f57220f784 | |
Eliy21 | 2d9bffaa43 | |
Eliy21 | eb658a4996 | |
Julien Palard | 878480d010 | |
chmodsayshello | 49bd28e109 | |
chmodsayshello | 6c107ce990 | |
chmodsayshello | 7c43c15fda | |
chmodsayshello | 291cbaf434 | |
chmodsayshello | fb74689f3d | |
chmodsayshello | da024bb4b8 | |
chmodsayshello | 2f8bb9726b | |
chmodsayshello | 8176e7319f | |
chmodsayshello | 64bc57c6a4 | |
chmodsayshello | d346aa07ee | |
chmodsayshello | 9d1840f4ca | |
chmodsayshello | 5cc9038169 | |
chmodsayshello | 460ef23b50 | |
chmodsayshello | 1e16647fe9 | |
chmodsayshello | 16415ae577 | |
chmodsayshello | 2665980007 | |
chmodsayshello | bb2ce9ef92 | |
chmodsayshello | bc29e4dd95 | |
chmodsayshello | b76ed92aba | |
chmodsayshello | 703f1f46fc | |
chmodsayshello | 0b118c170e | |
chmodsayshello | 8431ac34d0 | |
chmodsayshello | 049128972f | |
chmodsayshello | 0c65d9d11a | |
chmodsayshello | 311beeb31c | |
chmodsayshello | bc3da8dab8 | |
chmodsayshello | ed5232411b | |
chmodsayshello | 6c6a27320d | |
chmodsayshello | 82f2f4784e | |
chmodsayshello | 8476865ea7 | |
chmodsayshello | b4273af245 | |
chmodsayshello | 483285a612 | |
chmodsayshello | b154f2def1 | |
chmodsayshello | c62195662c | |
chmodsayshello | 4dc5ad3bdb | |
chmodsayshello | cc186cc588 | |
chmodsayshello | df8c9625e4 |
|
@ -178,6 +178,7 @@
|
||||||
* Faerraven / Michieal
|
* Faerraven / Michieal
|
||||||
* Nicu
|
* Nicu
|
||||||
* Exhale
|
* Exhale
|
||||||
|
* Aeonix_Aeon
|
||||||
* Wbjitscool
|
* Wbjitscool
|
||||||
* SmokeyDope
|
* SmokeyDope
|
||||||
|
|
||||||
|
@ -208,4 +209,4 @@
|
||||||
## Special thanks
|
## Special thanks
|
||||||
* The Minetest team for making and supporting an engine, and distribution infrastructure that makes this all possible
|
* The Minetest team for making and supporting an engine, and distribution infrastructure that makes this all possible
|
||||||
* The workaholics who spent way too much time writing for the Minecraft Wiki. It's an invaluable resource for creating this game
|
* The workaholics who spent way too much time writing for the Minecraft Wiki. It's an invaluable resource for creating this game
|
||||||
* Notch and Jeb for being the major forces behind Minecraft
|
* Notch and Jeb for being the major forces behind Minecraft
|
||||||
|
|
4
LEGAL.md
|
@ -42,6 +42,10 @@ The glazed terracotta textures have been created by [MysticTempest](https://gith
|
||||||
Source: <https://www.planetminecraft.com/texture_pack/131pixel-perfection/>
|
Source: <https://www.planetminecraft.com/texture_pack/131pixel-perfection/>
|
||||||
License: [CC BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)
|
License: [CC BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)
|
||||||
|
|
||||||
|
Armor trim models were created by Aeonix_Aeon
|
||||||
|
Source: <https://www.curseforge.com/minecraft/texture-packs/ozocraft-remix>
|
||||||
|
License: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
|
||||||
|
|
||||||
The main menu images are released under: [CC0](https://creativecommons.org/publicdomain/zero/1.0/)
|
The main menu images are released under: [CC0](https://creativecommons.org/publicdomain/zero/1.0/)
|
||||||
|
|
||||||
All other files, unless mentioned otherwise, fall under:
|
All other files, unless mentioned otherwise, fall under:
|
||||||
|
|
|
@ -11,4 +11,4 @@ For example, Copper Blocks have the definition arguement of `_mcl_waxed_variant
|
||||||
|
|
||||||
For waxed nodes, scraping is easy. Start by putting `waxed = 1` into the list of groups of the waxed node.
|
For waxed nodes, scraping is easy. Start by putting `waxed = 1` into the list of groups of the waxed node.
|
||||||
Next put `_mcl_stripped_variant = item string of the unwaxed variant of the node` into the defintion table.
|
Next put `_mcl_stripped_variant = item string of the unwaxed variant of the node` into the defintion table.
|
||||||
Wxaed Copper Blocks can be scrapped into normal Copper Blocks because of the definition `_mcl_stripped_variant = "mcl_copper:block"`.
|
Waxed Copper Blocks can be scrapped into normal Copper Blocks because of the definition `_mcl_stripped_variant = "mcl_copper:block"`.
|
||||||
|
|
|
@ -74,6 +74,18 @@ function mcl_util.check_dtime_timer(self, dtime, timer_name, threshold)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- While we should always favour the new minetest vector functions such as vector.new or vector.offset which validate on
|
||||||
|
-- creation. There may be cases where state gets corrupted and we may have to check the vector is valid if created the
|
||||||
|
-- old way. This allows us to do this as a tactical solution until old style vectors are completely removed.
|
||||||
|
function mcl_util.validate_vector (vect)
|
||||||
|
if vect then
|
||||||
|
if tonumber(vect.x) and tonumber(vect.y) and tonumber(vect.z) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
-- Minetest 5.3.0 or less can only measure the light level. This came in at 5.4
|
-- Minetest 5.3.0 or less can only measure the light level. This came in at 5.4
|
||||||
-- This function has been known to fail in multiple places so the error handling is added increase safety and improve
|
-- This function has been known to fail in multiple places so the error handling is added increase safety and improve
|
||||||
-- debugging. See:
|
-- debugging. See:
|
||||||
|
@ -612,7 +624,7 @@ function mcl_util.deal_damage(target, damage, mcl_reason)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
elseif not target:is_player() then return end
|
||||||
|
|
||||||
local is_immortal = target:get_armor_groups().immortal or 0
|
local is_immortal = target:get_armor_groups().immortal or 0
|
||||||
if is_immortal>0 then
|
if is_immortal>0 then
|
||||||
|
|
|
@ -21,6 +21,8 @@ local function atan(x)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mcl_mobs.effect_functions = {}
|
||||||
|
|
||||||
|
|
||||||
-- check if daytime and also if mob is docile during daylight hours
|
-- check if daytime and also if mob is docile during daylight hours
|
||||||
function mob_class:day_docile()
|
function mob_class:day_docile()
|
||||||
|
@ -382,7 +384,8 @@ function mob_class:monster_attack()
|
||||||
-- find specific mob to attack, failing that attack player/npc/animal
|
-- find specific mob to attack, failing that attack player/npc/animal
|
||||||
if specific_attack(self.specific_attack, name)
|
if specific_attack(self.specific_attack, name)
|
||||||
and (type == "player" or ( type == "npc" and self.attack_npcs )
|
and (type == "player" or ( type == "npc" and self.attack_npcs )
|
||||||
or (type == "animal" and self.attack_animals == true)) then
|
or (type == "animal" and self.attack_animals == true)
|
||||||
|
or (self.extra_hostile and not self.attack_exception(player))) then
|
||||||
p = player:get_pos()
|
p = player:get_pos()
|
||||||
sp = s
|
sp = s
|
||||||
|
|
||||||
|
@ -1103,6 +1106,11 @@ function mob_class:do_states_attack (dtime)
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
damage_groups = {fleshy = self.damage}
|
damage_groups = {fleshy = self.damage}
|
||||||
}, nil)
|
}, nil)
|
||||||
|
if self.dealt_effect then
|
||||||
|
mcl_mobs.effect_functions[self.dealt_effect.name](
|
||||||
|
self.attack, self.dealt_effect.factor, self.dealt_effect.dur
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self.custom_attack(self, p)
|
self.custom_attack(self, p)
|
||||||
|
@ -1209,6 +1217,9 @@ function mob_class:do_states_attack (dtime)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
elseif self.attack_type == "custom" and self.attack_state then
|
||||||
|
self.attack_state(self, dtime)
|
||||||
else
|
else
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
local math, tonumber, vector, minetest, mcl_mobs = math, tonumber, vector, minetest, mcl_mobs
|
local math, tonumber, vector, minetest, mcl_mobs = math, tonumber, vector, minetest, mcl_mobs
|
||||||
local mob_class = mcl_mobs.mob_class
|
local mob_class = mcl_mobs.mob_class
|
||||||
|
local validate_vector = mcl_util.validate_vector
|
||||||
|
|
||||||
local active_particlespawners = {}
|
local active_particlespawners = {}
|
||||||
local disable_blood = minetest.settings:get_bool("mobs_disable_blood")
|
local disable_blood = minetest.settings:get_bool("mobs_disable_blood")
|
||||||
local DEFAULT_FALL_SPEED = -9.81*1.5
|
local DEFAULT_FALL_SPEED = -9.81*1.5
|
||||||
|
@ -9,16 +11,6 @@ local PATHFINDING = "gowp"
|
||||||
local player_transfer_distance = tonumber(minetest.settings:get("player_transfer_distance")) or 128
|
local player_transfer_distance = tonumber(minetest.settings:get("player_transfer_distance")) or 128
|
||||||
if player_transfer_distance == 0 then player_transfer_distance = math.huge end
|
if player_transfer_distance == 0 then player_transfer_distance = math.huge end
|
||||||
|
|
||||||
|
|
||||||
local function validate_vector (vect)
|
|
||||||
if vect then
|
|
||||||
if tonumber(vect.x) and tonumber(vect.y) and tonumber(vect.z) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
-- custom particle effects
|
-- custom particle effects
|
||||||
function mcl_mobs.effect(pos, amount, texture, min_size, max_size, radius, gravity, glow, go_down)
|
function mcl_mobs.effect(pos, amount, texture, min_size, max_size, radius, gravity, glow, go_down)
|
||||||
|
|
||||||
|
|
|
@ -297,6 +297,7 @@ function mcl_mobs.register_mob(name, def)
|
||||||
return false, true, {}
|
return false, true, {}
|
||||||
end,
|
end,
|
||||||
do_punch = def.do_punch,
|
do_punch = def.do_punch,
|
||||||
|
deal_damage = def.deal_damage,
|
||||||
on_breed = def.on_breed,
|
on_breed = def.on_breed,
|
||||||
on_grown = def.on_grown,
|
on_grown = def.on_grown,
|
||||||
on_pick_up = def.on_pick_up,
|
on_pick_up = def.on_pick_up,
|
||||||
|
@ -311,8 +312,15 @@ function mcl_mobs.register_mob(name, def)
|
||||||
|
|
||||||
return self:mob_activate(staticdata, def, dtime)
|
return self:mob_activate(staticdata, def, dtime)
|
||||||
end,
|
end,
|
||||||
|
attack_state = def.attack_state,
|
||||||
harmed_by_heal = def.harmed_by_heal,
|
harmed_by_heal = def.harmed_by_heal,
|
||||||
on_lightning_strike = def.on_lightning_strike
|
is_boss = def.is_boss,
|
||||||
|
dealt_effect = def.dealt_effect,
|
||||||
|
on_lightning_strike = def.on_lightning_strike,
|
||||||
|
extra_hostile = def.extra_hostile,
|
||||||
|
attack_exception = def.attack_exception or function(p) return false end,
|
||||||
|
|
||||||
|
_spawner = def._spawner,
|
||||||
}
|
}
|
||||||
minetest.register_entity(name, setmetatable(final_def,mcl_mobs.mob_class_meta))
|
minetest.register_entity(name, setmetatable(final_def,mcl_mobs.mob_class_meta))
|
||||||
|
|
||||||
|
@ -343,9 +351,10 @@ function mcl_mobs.register_arrow(name, def)
|
||||||
collisionbox = {0, 0, 0, 0, 0, 0}, -- remove box around arrows
|
collisionbox = {0, 0, 0, 0, 0, 0}, -- remove box around arrows
|
||||||
timer = 0,
|
timer = 0,
|
||||||
switch = 0,
|
switch = 0,
|
||||||
|
_lifetime = def._lifetime or 150,
|
||||||
owner_id = def.owner_id,
|
owner_id = def.owner_id,
|
||||||
rotate = def.rotate,
|
rotate = def.rotate,
|
||||||
on_punch = function(self)
|
on_punch = def.on_punch or function(self)
|
||||||
local vel = self.object:get_velocity()
|
local vel = self.object:get_velocity()
|
||||||
self.object:set_velocity({x=vel.x * -1, y=vel.y * -1, z=vel.z * -1})
|
self.object:set_velocity({x=vel.x * -1, y=vel.y * -1, z=vel.z * -1})
|
||||||
end,
|
end,
|
||||||
|
@ -362,7 +371,7 @@ function mcl_mobs.register_arrow(name, def)
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
|
|
||||||
if self.switch == 0
|
if self.switch == 0
|
||||||
or self.timer > 150
|
or self.timer > self._lifetime
|
||||||
or not within_limits(pos, 0) then
|
or not within_limits(pos, 0) then
|
||||||
mcl_burning.extinguish(self.object)
|
mcl_burning.extinguish(self.object)
|
||||||
self.object:remove();
|
self.object:remove();
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs
|
local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs
|
||||||
local mob_class = mcl_mobs.mob_class
|
local mob_class = mcl_mobs.mob_class
|
||||||
|
local validate_vector = mcl_util.validate_vector
|
||||||
|
|
||||||
local ENTITY_CRAMMING_MAX = 24
|
local ENTITY_CRAMMING_MAX = 24
|
||||||
local CRAMMING_DAMAGE = 3
|
local CRAMMING_DAMAGE = 3
|
||||||
|
@ -355,7 +356,7 @@ function mob_class:set_yaw(yaw, delay, dtime)
|
||||||
|
|
||||||
if math.abs(target_shortest_path_nums) > 10 then
|
if math.abs(target_shortest_path_nums) > 10 then
|
||||||
self.object:set_yaw(self.object:get_yaw()+(target_shortest_path*(3.6*ddtime)))
|
self.object:set_yaw(self.object:get_yaw()+(target_shortest_path*(3.6*ddtime)))
|
||||||
if self.acc then
|
if validate_vector(self.acc) then
|
||||||
self.acc=vector.rotate_around_axis(self.acc,vector.new(0,1,0), target_shortest_path*(3.6*ddtime))
|
self.acc=vector.rotate_around_axis(self.acc,vector.new(0,1,0), target_shortest_path*(3.6*ddtime))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -681,6 +682,9 @@ function mob_class:do_env_damage()
|
||||||
-- don't fall when on ignore, just stand still
|
-- don't fall when on ignore, just stand still
|
||||||
if self.standing_in == "ignore" then
|
if self.standing_in == "ignore" then
|
||||||
self.object:set_velocity({x = 0, y = 0, z = 0})
|
self.object:set_velocity({x = 0, y = 0, z = 0})
|
||||||
|
-- wither rose effect
|
||||||
|
elseif self.standing_in == "mcl_flowers:wither_rose" then
|
||||||
|
mcl_potions.withering_func(self.object, 1, 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
local nodef = minetest.registered_nodes[self.standing_in]
|
local nodef = minetest.registered_nodes[self.standing_in]
|
||||||
|
|
|
@ -2,6 +2,9 @@ local dim = {"x", "z"}
|
||||||
|
|
||||||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||||
|
|
||||||
|
local anti_troll = minetest.settings:get_bool("wither_anti_troll_measures", false)
|
||||||
|
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
||||||
|
|
||||||
local function load_schem(filename)
|
local function load_schem(filename)
|
||||||
local file = io.open(modpath .. "/schems/" .. filename, "r")
|
local file = io.open(modpath .. "/schems/" .. filename, "r")
|
||||||
local data = minetest.deserialize(file:read())
|
local data = minetest.deserialize(file:read())
|
||||||
|
@ -9,6 +12,14 @@ local function load_schem(filename)
|
||||||
return data
|
return data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local wboss_overworld = 0
|
||||||
|
local wboss_nether = 0
|
||||||
|
local wboss_end = 0
|
||||||
|
|
||||||
|
local LIM_OVERWORLD = tonumber(minetest.settings:get("wither_cap_overworld")) or 3
|
||||||
|
local LIM_NETHER = tonumber(minetest.settings:get("wither_cap_nether")) or 10
|
||||||
|
local LIM_END = tonumber(minetest.settings:get("wither_cap_end")) or 5
|
||||||
|
|
||||||
local wither_spawn_schems = {}
|
local wither_spawn_schems = {}
|
||||||
|
|
||||||
for _, d in pairs(dim) do
|
for _, d in pairs(dim) do
|
||||||
|
@ -16,8 +27,13 @@ for _, d in pairs(dim) do
|
||||||
end
|
end
|
||||||
|
|
||||||
local function check_schem(pos, schem)
|
local function check_schem(pos, schem)
|
||||||
|
local cn_name
|
||||||
for _, n in pairs(schem) do
|
for _, n in pairs(schem) do
|
||||||
if minetest.get_node(vector.add(pos, n)).name ~= n.name then
|
cn_name = minetest.get_node(vector.add(pos, n)).name
|
||||||
|
if string.find(cn_name, "mcl_heads:wither_skeleton") then
|
||||||
|
cn_name = "mcl_heads:wither_skeleton"
|
||||||
|
end
|
||||||
|
if cn_name ~= n.name then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -30,14 +46,32 @@ local function remove_schem(pos, schem)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function wither_spawn(pos)
|
local function check_limit(pos)
|
||||||
|
local dim = mcl_worlds.pos_to_dimension(pos)
|
||||||
|
if dim == "overworld" and wboss_overworld >= LIM_OVERWORLD then return false
|
||||||
|
elseif dim == "end" and wboss_end >= LIM_END then return false
|
||||||
|
elseif wboss_nether >= LIM_NETHER then return false
|
||||||
|
else return true end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function wither_spawn(pos, player)
|
||||||
|
if peaceful then return end
|
||||||
for _, d in pairs(dim) do
|
for _, d in pairs(dim) do
|
||||||
for i = 0, 2 do
|
for i = 0, 2 do
|
||||||
local p = vector.add(pos, {x = 0, y = -2, z = 0, [d] = -i})
|
local p = vector.add(pos, {x = 0, y = -2, z = 0, [d] = -i})
|
||||||
local schem = wither_spawn_schems[d]
|
local schem = wither_spawn_schems[d]
|
||||||
if check_schem(p, schem) then
|
if check_schem(p, schem) and (not anti_troll or check_limit(pos)) then
|
||||||
remove_schem(p, schem)
|
remove_schem(p, schem)
|
||||||
minetest.add_entity(vector.add(p, {x = 0, y = 1, z = 0, [d] = 1}), "mobs_mc:wither")
|
local wither = minetest.add_entity(vector.add(p, {x = 0, y = 1, z = 0, [d] = 1}), "mobs_mc:wither")
|
||||||
|
if not wither then return end
|
||||||
|
local wither_ent = wither:get_luaentity()
|
||||||
|
wither_ent._spawner = player:get_player_name()
|
||||||
|
local dim = mcl_worlds.pos_to_dimension(pos)
|
||||||
|
if dim == "overworld" then
|
||||||
|
wboss_overworld = wboss_overworld + 1
|
||||||
|
elseif dim == "end" then
|
||||||
|
wboss_end = wboss_end + 1
|
||||||
|
else wboss_nether = wboss_nether + 1 end
|
||||||
local objects = minetest.get_objects_inside_radius(pos, 20)
|
local objects = minetest.get_objects_inside_radius(pos, 20)
|
||||||
for _, players in ipairs(objects) do
|
for _, players in ipairs(objects) do
|
||||||
if players:is_player() then
|
if players:is_player() then
|
||||||
|
@ -54,7 +88,19 @@ local old_on_place = wither_head.on_place
|
||||||
function wither_head.on_place(itemstack, placer, pointed)
|
function wither_head.on_place(itemstack, placer, pointed)
|
||||||
local n = minetest.get_node(vector.offset(pointed.above,0,-1,0))
|
local n = minetest.get_node(vector.offset(pointed.above,0,-1,0))
|
||||||
if n and n.name == "mcl_nether:soul_sand" then
|
if n and n.name == "mcl_nether:soul_sand" then
|
||||||
minetest.after(0, wither_spawn, pointed.above)
|
minetest.after(0, wither_spawn, pointed.above, placer)
|
||||||
end
|
end
|
||||||
return old_on_place(itemstack, placer, pointed)
|
return old_on_place(itemstack, placer, pointed)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if anti_troll then
|
||||||
|
-- pull wither counts per dimension
|
||||||
|
minetest.register_globalstep(function(dtime)
|
||||||
|
wboss_overworld = mobs_mc.wither_count_overworld
|
||||||
|
wboss_nether = mobs_mc.wither_count_nether
|
||||||
|
wboss_end = mobs_mc.wither_count_end
|
||||||
|
mobs_mc.wither_count_overworld = 0
|
||||||
|
mobs_mc.wither_count_nether = 0
|
||||||
|
mobs_mc.wither_count_end = 0
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
|
@ -78,7 +78,6 @@ local axolotl = {
|
||||||
attack_animals = true,
|
attack_animals = true,
|
||||||
specific_attack = {
|
specific_attack = {
|
||||||
"extra_mobs_cod",
|
"extra_mobs_cod",
|
||||||
"mobs_mc:sheep",
|
|
||||||
"extra_mobs_glow_squid",
|
"extra_mobs_glow_squid",
|
||||||
"extra_mobs_salmon",
|
"extra_mobs_salmon",
|
||||||
"extra_mobs_tropical_fish",
|
"extra_mobs_tropical_fish",
|
||||||
|
|
|
@ -50,7 +50,7 @@ mcl_mobs.register_mob("mobs_mc:creeper", {
|
||||||
explosion_strength = 3,
|
explosion_strength = 3,
|
||||||
explosion_radius = 3.5,
|
explosion_radius = 3.5,
|
||||||
explosion_damage_radius = 3.5,
|
explosion_damage_radius = 3.5,
|
||||||
explosiontimer_reset_radius = 6,
|
explosiontimer_reset_radius = 3,
|
||||||
reach = 3,
|
reach = 3,
|
||||||
explosion_timer = 1.5,
|
explosion_timer = 1.5,
|
||||||
allow_fuse_reset = true,
|
allow_fuse_reset = true,
|
||||||
|
@ -172,7 +172,7 @@ mcl_mobs.register_mob("mobs_mc:creeper_charged", {
|
||||||
explosion_strength = 6,
|
explosion_strength = 6,
|
||||||
explosion_radius = 8,
|
explosion_radius = 8,
|
||||||
explosion_damage_radius = 8,
|
explosion_damage_radius = 8,
|
||||||
explosiontimer_reset_radius = 6,
|
explosiontimer_reset_radius = 3,
|
||||||
reach = 3,
|
reach = 3,
|
||||||
explosion_timer = 1.5,
|
explosion_timer = 1.5,
|
||||||
allow_fuse_reset = true,
|
allow_fuse_reset = true,
|
||||||
|
|
|
@ -127,7 +127,7 @@ mcl_mobs.register_mob("mobs_mc:enderdragon", {
|
||||||
minetest.set_node(vector.add(self._portal_pos, vector.new(0, 5, 0)), {name = "mcl_end:dragon_egg"})
|
minetest.set_node(vector.add(self._portal_pos, vector.new(0, 5, 0)), {name = "mcl_end:dragon_egg"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Free The End Advancement
|
-- Free The End Advancement
|
||||||
for _,players in pairs(minetest.get_objects_inside_radius(pos,64)) do
|
for _,players in pairs(minetest.get_objects_inside_radius(pos,64)) do
|
||||||
if players:is_player() then
|
if players:is_player() then
|
||||||
|
@ -136,6 +136,7 @@ mcl_mobs.register_mob("mobs_mc:enderdragon", {
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
fire_resistant = true,
|
fire_resistant = true,
|
||||||
|
is_boss = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,4 @@ name = mobs_mc
|
||||||
author = maikerumine
|
author = maikerumine
|
||||||
description = Adds Minecraft-like monsters and animals.
|
description = Adds Minecraft-like monsters and animals.
|
||||||
depends = mcl_init, mcl_particles, mcl_mobs, mcl_wip, mcl_core, mcl_util
|
depends = mcl_init, mcl_particles, mcl_mobs, mcl_wip, mcl_core, mcl_util
|
||||||
optional_depends = default, mcl_tnt, mcl_bows, mcl_throwing, mcl_fishing, bones, mesecons_materials, doc_items
|
optional_depends = default, mcl_tnt, mcl_bows, mcl_throwing, mcl_fishing, bones, mesecons_materials, doc_items, mcl_worlds
|
||||||
|
|
|
@ -96,6 +96,11 @@ mcl_mobs.register_mob("mobs_mc:witherskeleton", {
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
harmed_by_heal = true,
|
harmed_by_heal = true,
|
||||||
fire_resistant = true,
|
fire_resistant = true,
|
||||||
|
dealt_effect = {
|
||||||
|
name = "withering",
|
||||||
|
factor = 1,
|
||||||
|
dur = 10,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
--spawn
|
--spawn
|
||||||
|
|
|
@ -114,9 +114,7 @@ mcl_mobs.register_mob("mobs_mc:spider", spider)
|
||||||
local cave_spider = table.copy(spider)
|
local cave_spider = table.copy(spider)
|
||||||
cave_spider.description = S("Cave Spider")
|
cave_spider.description = S("Cave Spider")
|
||||||
cave_spider.textures = { {"mobs_mc_cave_spider.png^(mobs_mc_spider_eyes.png^[makealpha:0,0,0)"} }
|
cave_spider.textures = { {"mobs_mc_cave_spider.png^(mobs_mc_spider_eyes.png^[makealpha:0,0,0)"} }
|
||||||
-- TODO: Poison damage
|
cave_spider.damage = 2
|
||||||
-- TODO: Revert damage to 2
|
|
||||||
cave_spider.damage = 3 -- damage increased to undo non-existing poison
|
|
||||||
cave_spider.hp_min = 1
|
cave_spider.hp_min = 1
|
||||||
cave_spider.hp_max = 12
|
cave_spider.hp_max = 12
|
||||||
cave_spider.collisionbox = {-0.35, -0.01, -0.35, 0.35, 0.46, 0.35}
|
cave_spider.collisionbox = {-0.35, -0.01, -0.35, 0.35, 0.46, 0.35}
|
||||||
|
@ -138,6 +136,11 @@ cave_spider.walk_velocity = 1.3
|
||||||
cave_spider.run_velocity = 3.2
|
cave_spider.run_velocity = 3.2
|
||||||
cave_spider.sounds = table.copy(spider.sounds)
|
cave_spider.sounds = table.copy(spider.sounds)
|
||||||
cave_spider.sounds.base_pitch = 1.25
|
cave_spider.sounds.base_pitch = 1.25
|
||||||
|
cave_spider.dealt_effect = {
|
||||||
|
name = "poison",
|
||||||
|
factor = 2.5,
|
||||||
|
dur = 7,
|
||||||
|
}
|
||||||
mcl_mobs.register_mob("mobs_mc:cave_spider", cave_spider)
|
mcl_mobs.register_mob("mobs_mc:cave_spider", cave_spider)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,11 @@ mcl_mobs.register_mob("mobs_mc:witch", {
|
||||||
},
|
},
|
||||||
view_range = 16,
|
view_range = 16,
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
|
deal_damage = function(self, damage, mcl_reason)
|
||||||
|
local factor = 1
|
||||||
|
if mcl_reason.type == "magic" then factor = 0.15 end
|
||||||
|
self.health = self.health - factor*damage
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- potion projectile (EXPERIMENTAL)
|
-- potion projectile (EXPERIMENTAL)
|
||||||
|
|
|
@ -1,14 +1,72 @@
|
||||||
--MCmobs v0.4
|
--MCmobs v0.4
|
||||||
--maikerumine
|
--maikerumine
|
||||||
|
--updated by Herowl
|
||||||
--made for MC like Survival game
|
--made for MC like Survival game
|
||||||
--License for code WTFPL and otherwise stated in readmes
|
--License for code WTFPL and otherwise stated in readmes
|
||||||
|
|
||||||
local S = minetest.get_translator("mobs_mc")
|
local S = minetest.get_translator("mobs_mc")
|
||||||
|
local mobs_griefing = minetest.settings:get_bool("mobs_griefing", true)
|
||||||
|
local follow_spawner = minetest.settings:get_bool("wither_follow_spawner", false)
|
||||||
|
local w_strafes = minetest.settings:get_bool("wither_strafes", true)
|
||||||
|
local anti_troll = minetest.settings:get_bool("wither_anti_troll_measures", false)
|
||||||
|
|
||||||
|
local WITHER_INIT_BOOM = 7
|
||||||
|
local WITHER_MELEE_COOLDOWN = 3
|
||||||
|
|
||||||
|
local function atan(x)
|
||||||
|
if not x or x ~= x then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return math.atan(x)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--###################
|
--###################
|
||||||
--################### WITHER
|
--################### WITHER
|
||||||
--###################
|
--###################
|
||||||
|
|
||||||
|
local function wither_unstuck(self)
|
||||||
|
local pos = self.object:get_pos()
|
||||||
|
if mobs_griefing then -- destroy blocks very nearby (basically, colliding with)
|
||||||
|
local col = self.collisionbox
|
||||||
|
local pos1 = vector.offset(pos, col[1], col[2], col[3])
|
||||||
|
local pos2 = vector.offset(pos, col[4], col[5], col[6])
|
||||||
|
for z = pos1.z, pos2.z do for y = pos1.y, pos2.y do for x = pos1.x, pos2.x do
|
||||||
|
local npos = vector.new(x,y,z)
|
||||||
|
local name = minetest.get_node(npos).name
|
||||||
|
if name ~= "air" then
|
||||||
|
local ndef = minetest.registered_nodes[name]
|
||||||
|
if ndef and ndef._mcl_hardness and ndef._mcl_hardness >= 0 then
|
||||||
|
local drops = minetest.get_node_drops(name, "")
|
||||||
|
if minetest.dig_node(npos) then
|
||||||
|
for _, item in ipairs(drops) do
|
||||||
|
if type(item) ~= "string" then
|
||||||
|
item = item:get_name() .. item:get_count()
|
||||||
|
end
|
||||||
|
minetest.add_item(npos, item)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end end end
|
||||||
|
end
|
||||||
|
mcl_mobs.mob_class.safe_boom(self, pos, 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function get_dim_relative_y(pos)
|
||||||
|
if (pos.y >= mcl_vars.mg_realm_barrier_overworld_end_max) then
|
||||||
|
return pos.y
|
||||||
|
elseif (pos.y <= mcl_vars.mg_nether_max + 200) then
|
||||||
|
return (pos.y - mcl_vars.mg_nether_min - 20)
|
||||||
|
else
|
||||||
|
return (pos.y - mcl_vars.mg_end_min - 50)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
mobs_mc.wither_count_overworld = 0
|
||||||
|
mobs_mc.wither_count_nether = 0
|
||||||
|
mobs_mc.wither_count_end = 0
|
||||||
|
|
||||||
mcl_mobs.register_mob("mobs_mc:wither", {
|
mcl_mobs.register_mob("mobs_mc:wither", {
|
||||||
description = S("Wither"),
|
description = S("Wither"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
|
@ -26,11 +84,11 @@ mcl_mobs.register_mob("mobs_mc:wither", {
|
||||||
{"mobs_mc_wither.png"},
|
{"mobs_mc_wither.png"},
|
||||||
},
|
},
|
||||||
visual_size = {x=4, y=4},
|
visual_size = {x=4, y=4},
|
||||||
makes_footstep_sound = true,
|
view_range = 50,
|
||||||
view_range = 16,
|
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
walk_velocity = 2,
|
walk_velocity = 2,
|
||||||
run_velocity = 4,
|
run_velocity = 4,
|
||||||
|
strafes = w_strafes,
|
||||||
sounds = {
|
sounds = {
|
||||||
shoot_attack = "mobs_mc_ender_dragon_shoot",
|
shoot_attack = "mobs_mc_ender_dragon_shoot",
|
||||||
attack = "mobs_mc_ender_dragon_attack",
|
attack = "mobs_mc_ender_dragon_attack",
|
||||||
|
@ -41,9 +99,8 @@ mcl_mobs.register_mob("mobs_mc:wither", {
|
||||||
jump_height = 10,
|
jump_height = 10,
|
||||||
fly = true,
|
fly = true,
|
||||||
makes_footstep_sound = false,
|
makes_footstep_sound = false,
|
||||||
dogshoot_switch = 1,
|
dogshoot_switch = 1, -- unused
|
||||||
dogshoot_count_max = 1,
|
dogshoot_count_max = 1, -- unused
|
||||||
attack_animals = true,
|
|
||||||
can_despawn = false,
|
can_despawn = false,
|
||||||
drops = {
|
drops = {
|
||||||
{name = "mcl_mobitems:nether_star",
|
{name = "mcl_mobitems:nether_star",
|
||||||
|
@ -53,13 +110,13 @@ mcl_mobs.register_mob("mobs_mc:wither", {
|
||||||
},
|
},
|
||||||
lava_damage = 0,
|
lava_damage = 0,
|
||||||
fire_damage = 0,
|
fire_damage = 0,
|
||||||
attack_type = "dogshoot",
|
attack_type = "custom",
|
||||||
explosion_strength = 8,
|
explosion_strength = 8,
|
||||||
dogshoot_stop = true,
|
dogshoot_stop = true,
|
||||||
arrow = "mobs_mc:wither_skull",
|
arrow = "mobs_mc:wither_skull",
|
||||||
reach = 5,
|
reach = 5,
|
||||||
shoot_interval = 0.5,
|
shoot_interval = 1,
|
||||||
shoot_offset = -1,
|
shoot_offset = -0.5,
|
||||||
animation = {
|
animation = {
|
||||||
walk_speed = 12, run_speed = 12, stand_speed = 12,
|
walk_speed = 12, run_speed = 12, stand_speed = 12,
|
||||||
stand_start = 0, stand_end = 20,
|
stand_start = 0, stand_end = 20,
|
||||||
|
@ -67,57 +124,377 @@ mcl_mobs.register_mob("mobs_mc:wither", {
|
||||||
run_start = 0, run_end = 20,
|
run_start = 0, run_end = 20,
|
||||||
},
|
},
|
||||||
harmed_by_heal = true,
|
harmed_by_heal = true,
|
||||||
do_custom = function(self)
|
is_boss = true,
|
||||||
|
extra_hostile = true,
|
||||||
|
attack_exception = function(p)
|
||||||
|
local ent = p:get_luaentity()
|
||||||
|
if p:is_player() then return false end
|
||||||
|
if not ent or not ent.is_mob or ent.harmed_by_heal or string.find(ent.name, "ghast") then return true
|
||||||
|
else return false end
|
||||||
|
end,
|
||||||
|
|
||||||
|
do_custom = function(self, dtime)
|
||||||
|
if self._spawning then
|
||||||
|
-- "loading" bar while spawning
|
||||||
|
if not self._spw_max then self._spw_max = self._spawning end
|
||||||
|
self._spawning = self._spawning - dtime
|
||||||
|
local bardef = {
|
||||||
|
color = "dark_purple",
|
||||||
|
text = "Wither spawning",
|
||||||
|
percentage = math.floor((self._spw_max - self._spawning) / self._spw_max * 100),
|
||||||
|
}
|
||||||
|
|
||||||
|
local pos = self.object:get_pos()
|
||||||
|
for _, player in pairs(minetest.get_connected_players()) do
|
||||||
|
local d = vector.distance(pos, player:get_pos())
|
||||||
|
if d <= 80 then
|
||||||
|
mcl_bossbars.add_bar(player, bardef, true, d)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- turn around and flash while spawning
|
||||||
|
self.object:set_yaw(self._spawning*10)
|
||||||
|
local factor = math.floor((math.sin(self._spawning*10)+1.5) * 85)
|
||||||
|
local str = minetest.colorspec_to_colorstring({r=factor, g=factor, b=factor})
|
||||||
|
self.object:set_texture_mod("^[brighten^[multiply:"..str)
|
||||||
|
|
||||||
|
-- when fully spawned, explode
|
||||||
|
if self._spawning <= 0 then
|
||||||
|
if mobs_griefing and not minetest.is_protected(pos, "") then
|
||||||
|
mcl_explosions.explode(pos, WITHER_INIT_BOOM, { drop_chance = 1.0 }, self.object)
|
||||||
|
else
|
||||||
|
mcl_mobs.mob_class.safe_boom(self, pos, WITHER_INIT_BOOM)
|
||||||
|
end
|
||||||
|
self.object:set_texture_mod("")
|
||||||
|
self._spawning = nil
|
||||||
|
self._spw_max = nil
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- passive regeneration
|
||||||
|
self._custom_timer = self._custom_timer + dtime
|
||||||
|
if self._custom_timer > 1 then
|
||||||
|
self.health = math.min(self.health + 1, self.hp_max)
|
||||||
|
self._custom_timer = self._custom_timer - 1
|
||||||
|
end
|
||||||
|
|
||||||
|
-- anti-troll measures
|
||||||
|
if anti_troll then
|
||||||
|
if self._spawner then
|
||||||
|
local spawner = minetest.get_player_by_name(self._spawner)
|
||||||
|
if follow_spawner and spawner then
|
||||||
|
self._death_timer = 0
|
||||||
|
local pos = self.object:get_pos()
|
||||||
|
local spw = spawner:get_pos()
|
||||||
|
local dist = vector.distance(pos, spw)
|
||||||
|
if dist > 60 then -- teleport to the player who spawned the wither
|
||||||
|
local R = 10
|
||||||
|
pos.x = spw.x + math.random(-R, R)
|
||||||
|
pos.y = spw.y + math.random(-R, R)
|
||||||
|
pos.z = spw.z + math.random(-R, R)
|
||||||
|
self.object:set_pos(pos)
|
||||||
|
end
|
||||||
|
else -- despawn automatically after set time
|
||||||
|
-- HP changes impact timer: taking damage sets it back
|
||||||
|
self._death_timer = self._death_timer + self.health - self._health_old
|
||||||
|
if self.health == self._health_old then self._death_timer = self._death_timer + dtime end
|
||||||
|
if self._death_timer > 100 then
|
||||||
|
self.object:remove()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
self._health_old = self.health
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- count withers per dimension
|
||||||
|
local dim = mcl_worlds.pos_to_dimension(self.object:get_pos())
|
||||||
|
if dim == "overworld" then mobs_mc.wither_count_overworld = mobs_mc.wither_count_overworld + 1
|
||||||
|
elseif dim == "nether" then mobs_mc.wither_count_nether = mobs_mc.wither_count_nether + 1
|
||||||
|
elseif dim == "end" then mobs_mc.wither_count_end = mobs_mc.wither_count_end + 1 end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- update things dependent on HP
|
||||||
|
local rand_factor
|
||||||
if self.health < (self.hp_max / 2) then
|
if self.health < (self.hp_max / 2) then
|
||||||
self.base_texture = "mobs_mc_wither_half_health.png"
|
self.base_texture = "mobs_mc_wither_half_health.png"
|
||||||
self.fly = false
|
self.fly = false
|
||||||
self.object:set_properties({textures={self.base_texture}})
|
self._arrow_resistant = true
|
||||||
self.armor = {undead = 80, fleshy = 80}
|
rand_factor = 3
|
||||||
|
else
|
||||||
|
self.base_texture = "mobs_mc_wither.png"
|
||||||
|
self.fly = true
|
||||||
|
self._arrow_resistant = false
|
||||||
|
rand_factor = 10
|
||||||
end
|
end
|
||||||
|
if not self.attack then
|
||||||
|
local y = get_dim_relative_y(self.object:get_pos())
|
||||||
|
if y > 0 then
|
||||||
|
self.fly = false
|
||||||
|
else
|
||||||
|
self.fly = true
|
||||||
|
local vel = self.object:get_velocity()
|
||||||
|
self.object:set_velocity(vector.new(vel.x, self.walk_velocity, vel.z))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.object:set_properties({textures={self.base_texture}})
|
||||||
mcl_bossbars.update_boss(self.object, "Wither", "dark_purple")
|
mcl_bossbars.update_boss(self.object, "Wither", "dark_purple")
|
||||||
|
if math.random(1, rand_factor) < 2 then
|
||||||
|
self.arrow = "mobs_mc:wither_skull_strong"
|
||||||
|
else
|
||||||
|
self.arrow = "mobs_mc:wither_skull"
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
attack_state = function(self, dtime)
|
||||||
|
local s = self.object:get_pos()
|
||||||
|
local p = self.attack:get_pos() or s
|
||||||
|
|
||||||
|
p.y = p.y - .5
|
||||||
|
s.y = s.y + .5
|
||||||
|
|
||||||
|
local dist = vector.distance(p, s)
|
||||||
|
local vec = {
|
||||||
|
x = p.x - s.x,
|
||||||
|
y = p.y - s.y,
|
||||||
|
z = p.z - s.z
|
||||||
|
}
|
||||||
|
|
||||||
|
local yaw = (atan(vec.z / vec.x) +math.pi/ 2) - self.rotate
|
||||||
|
if p.x > s.x then yaw = yaw +math.pi end
|
||||||
|
yaw = self:set_yaw( yaw, 0, dtime)
|
||||||
|
|
||||||
|
local stay_away_from_player = vector.zero()
|
||||||
|
|
||||||
|
--strafe back and fourth
|
||||||
|
|
||||||
|
--stay away from player so as to shoot them
|
||||||
|
if dist < self.avoid_distance and self.shooter_avoid_enemy then
|
||||||
|
self:set_animation( "shoot")
|
||||||
|
stay_away_from_player=vector.multiply(vector.direction(p, s), 0.33)
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.fly then
|
||||||
|
local vel = self.object:get_velocity()
|
||||||
|
local diff = s.y - p.y
|
||||||
|
local FLY_FACTOR = self.walk_velocity
|
||||||
|
if diff < 10 then
|
||||||
|
self.object:set_velocity({x=vel.x, y= FLY_FACTOR, z=vel.z})
|
||||||
|
elseif diff > 15 then
|
||||||
|
self.object:set_velocity({x=vel.x, y=-FLY_FACTOR, z=vel.z})
|
||||||
|
end
|
||||||
|
for i=1, 15 do
|
||||||
|
if minetest.get_node(vector.offset(s, 0, -i, 0)).name ~= "air" then
|
||||||
|
self.object:set_velocity({x=vel.x, y= FLY_FACTOR, z=vel.z})
|
||||||
|
break
|
||||||
|
elseif minetest.get_node(vector.offset(s, 0, i, 0)).name ~= "air" then
|
||||||
|
self.object:set_velocity({x=vel.x, y=-FLY_FACTOR/i, z=vel.z})
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.strafes then
|
||||||
|
if not self.strafe_direction then
|
||||||
|
self.strafe_direction = 1.57
|
||||||
|
end
|
||||||
|
if math.random(40) == 1 then
|
||||||
|
self.strafe_direction = self.strafe_direction*-1
|
||||||
|
end
|
||||||
|
|
||||||
|
local dir = vector.rotate_around_axis(vector.direction(s, p), vector.new(0,1,0), self.strafe_direction)
|
||||||
|
local dir2 = vector.multiply(dir, 0.3 * self.walk_velocity)
|
||||||
|
|
||||||
|
if dir2 and stay_away_from_player then
|
||||||
|
self.acc = vector.add(dir2, stay_away_from_player)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self:set_velocity(0)
|
||||||
|
end
|
||||||
|
|
||||||
|
if dist > 30 then self.acc = vector.add(self.acc, vector.direction(s, p)*0.01) end
|
||||||
|
|
||||||
|
local side_cor = vector.new(0.7*math.cos(yaw), 0, 0.7*math.sin(yaw))
|
||||||
|
local m = self.object:get_pos() -- position of the middle head
|
||||||
|
local sr = self.object:get_pos() + side_cor -- position of side right head
|
||||||
|
local sl = self.object:get_pos() - side_cor -- position of side left head
|
||||||
|
-- height corrections
|
||||||
|
m.y = m.y + self.collisionbox[5]
|
||||||
|
sr.y = sr.y + self.collisionbox[5] - 0.3
|
||||||
|
sl.y = sl.y + self.collisionbox[5] - 0.3
|
||||||
|
local rand_pos = math.random(1,3)
|
||||||
|
if rand_pos == 1 then m = sr
|
||||||
|
elseif rand_pos == 2 then m = sl end
|
||||||
|
|
||||||
|
-- melee attack
|
||||||
|
if not self._melee_timer then
|
||||||
|
self._melee_timer = 0
|
||||||
|
end
|
||||||
|
if self._melee_timer < WITHER_MELEE_COOLDOWN then
|
||||||
|
self._melee_timer = self._melee_timer + dtime
|
||||||
|
else
|
||||||
|
self._melee_timer = 0
|
||||||
|
local pos = table.copy(s)
|
||||||
|
pos.y = pos.y + 2
|
||||||
|
local objs = minetest.get_objects_inside_radius(pos, self.reach)
|
||||||
|
local obj_pos, dist
|
||||||
|
local hit_some = false
|
||||||
|
for n = 1, #objs do
|
||||||
|
objs[n]:punch(objs[n], 1.0, {
|
||||||
|
full_punch_interval = 1.0,
|
||||||
|
damage_groups = {fleshy = 4},
|
||||||
|
}, pos)
|
||||||
|
local ent = objs[n]:get_luaentity()
|
||||||
|
if objs[n]:is_player() or (ent and ent ~= self and (not ent._shooter or ent._shooter ~= self)) then
|
||||||
|
mcl_util.deal_damage(objs[n], 8, {type = "magic"})
|
||||||
|
hit_some = true
|
||||||
|
end
|
||||||
|
mcl_mobs.effect_functions["withering"](objs[n], 0.5, 10)
|
||||||
|
end
|
||||||
|
if hit_some then
|
||||||
|
mcl_mobs.effect(pos, 32, "mcl_particles_soul_fire_flame.png", 5, 10, self.reach, 1, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if dist < self.reach then
|
||||||
|
self.shoot_interval = 3
|
||||||
|
else
|
||||||
|
self.shoot_interval = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.shoot_interval
|
||||||
|
and self.timer > self.shoot_interval
|
||||||
|
and not minetest.raycast(vector.add(m, vector.new(0,self.shoot_offset,0)), vector.add(self.attack:get_pos(), vector.new(0,1.5,0)), false, false):next()
|
||||||
|
and math.random(1, 100) <= 60 then
|
||||||
|
|
||||||
|
self.timer = 0
|
||||||
|
self:set_animation( "shoot")
|
||||||
|
|
||||||
|
-- play shoot attack sound
|
||||||
|
self:mob_sound("shoot_attack")
|
||||||
|
|
||||||
|
-- Shoot arrow
|
||||||
|
if minetest.registered_entities[self.arrow] then
|
||||||
|
|
||||||
|
local arrow, ent
|
||||||
|
local v = 1
|
||||||
|
if not self.shoot_arrow then
|
||||||
|
self.firing = true
|
||||||
|
minetest.after(1, function()
|
||||||
|
self.firing = false
|
||||||
|
end)
|
||||||
|
arrow = minetest.add_entity(m, self.arrow)
|
||||||
|
ent = arrow:get_luaentity()
|
||||||
|
if ent.velocity then
|
||||||
|
v = ent.velocity
|
||||||
|
end
|
||||||
|
ent.switch = 1
|
||||||
|
ent.owner_id = tostring(self.object) -- add unique owner id to arrow
|
||||||
|
|
||||||
|
-- important for mcl_shields
|
||||||
|
ent._shooter = self.object
|
||||||
|
ent._saved_shooter_pos = self.object:get_pos()
|
||||||
|
end
|
||||||
|
|
||||||
|
local amount = (vec.x * vec.x + vec.y * vec.y + vec.z * vec.z) ^ 0.5
|
||||||
|
-- offset makes shoot aim accurate
|
||||||
|
vec.y = vec.y + self.shoot_offset
|
||||||
|
vec.x = vec.x * (v / amount)
|
||||||
|
vec.y = vec.y * (v / amount)
|
||||||
|
vec.z = vec.z * (v / amount)
|
||||||
|
if self.shoot_arrow then
|
||||||
|
vec = vector.normalize(vec)
|
||||||
|
self:shoot_arrow(m, vec)
|
||||||
|
else
|
||||||
|
arrow:set_velocity(vec)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
do_punch = function(self, hitter, tflp, tool_capabilities, dir)
|
||||||
|
if self._spawning or hitter == self.object then return false end
|
||||||
|
local ent = hitter:get_luaentity()
|
||||||
|
if ent and self._arrow_resistant and (string.find(ent.name, "arrow") or string.find(ent.name, "rocket")) then return false end
|
||||||
|
wither_unstuck(self)
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
deal_damage = function(self, damage, mcl_reason)
|
||||||
|
if self._spawning then return end
|
||||||
|
if self._arrow_resistant and mcl_reason.type == "magic" then return end
|
||||||
|
wither_unstuck(self)
|
||||||
|
self.health = self.health - damage
|
||||||
|
end,
|
||||||
|
|
||||||
on_spawn = function(self)
|
on_spawn = function(self)
|
||||||
minetest.sound_play("mobs_mc_wither_spawn", {object=self.object, gain=1.0, max_hear_distance=64})
|
minetest.sound_play("mobs_mc_wither_spawn", {object=self.object, gain=1.0, max_hear_distance=64})
|
||||||
|
self._custom_timer = 0.0
|
||||||
|
self._death_timer = 0.0
|
||||||
|
self._health_old = self.hp_max
|
||||||
|
self._spawning = 10
|
||||||
|
return true
|
||||||
end,
|
end,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
|
||||||
local wither_rose_soil = { "group:grass_block", "mcl_core:dirt", "mcl_core:coarse_dirt", "mcl_nether:netherrack", "group:soul_block", "mcl_mud:mud", "mcl_moss:moss" }
|
local wither_rose_soil = { "group:grass_block", "mcl_core:dirt", "mcl_core:coarse_dirt", "mcl_nether:netherrack", "group:soul_block", "mcl_mud:mud", "mcl_moss:moss" }
|
||||||
|
local function spawn_wither_rose(obj)
|
||||||
|
local n = minetest.find_node_near(obj:get_pos(),2,wither_rose_soil)
|
||||||
|
if n then
|
||||||
|
local p = vector.offset(n,0,1,0)
|
||||||
|
if minetest.get_node(p).name == "air" then
|
||||||
|
if not ( mobs_griefing and minetest.place_node(p,{name="mcl_flowers:wither_rose"}) ) then
|
||||||
|
minetest.add_item(p,"mcl_flowers:wither_rose")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
mcl_mobs.register_arrow("mobs_mc:wither_skull", {
|
mcl_mobs.register_arrow("mobs_mc:wither_skull", {
|
||||||
visual = "sprite",
|
visual = "cube",
|
||||||
visual_size = {x = 0.75, y = 0.75},
|
visual_size = {x = 0.3, y = 0.3},
|
||||||
-- TODO: 3D projectile, replace tetxture
|
textures = {
|
||||||
textures = {"mobs_mc_TEMP_wither_projectile.png"},
|
"mobs_mc_wither_projectile.png^[verticalframe:6:0", -- top
|
||||||
velocity = 6,
|
"mobs_mc_wither_projectile.png^[verticalframe:6:1", -- bottom
|
||||||
|
"mobs_mc_wither_projectile.png^[verticalframe:6:2", -- left
|
||||||
|
"mobs_mc_wither_projectile.png^[verticalframe:6:3", -- right
|
||||||
|
"mobs_mc_wither_projectile.png^[verticalframe:6:4", -- back
|
||||||
|
"mobs_mc_wither_projectile.png^[verticalframe:6:5", -- front
|
||||||
|
},
|
||||||
|
velocity = 7,
|
||||||
|
rotate = 90,
|
||||||
|
_lifetime = 350,
|
||||||
|
on_punch = function(self) end,
|
||||||
|
|
||||||
-- direct hit
|
-- direct hit
|
||||||
hit_player = function(self, player)
|
hit_player = function(self, player)
|
||||||
|
local pos = vector.new(self.object:get_pos())
|
||||||
|
mcl_mobs.effect_functions["withering"](player, 0.5, 10)
|
||||||
player:punch(self.object, 1.0, {
|
player:punch(self.object, 1.0, {
|
||||||
full_punch_interval = 0.5,
|
full_punch_interval = 0.5,
|
||||||
damage_groups = {fleshy = 8},
|
damage_groups = {fleshy = 8},
|
||||||
}, nil)
|
}, nil)
|
||||||
mcl_mobs.mob_class.boom(self,self.object:get_pos(), 1)
|
mcl_mobs.mob_class.boom(self, pos, 1)
|
||||||
|
if player:get_hp() <= 0 then
|
||||||
|
local shooter = self._shooter:get_luaentity()
|
||||||
|
if shooter then shooter.health = shooter.health + 5 end
|
||||||
|
spawn_wither_rose(player)
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
hit_mob = function(self, mob)
|
hit_mob = function(self, mob)
|
||||||
|
local pos = vector.new(self.object:get_pos())
|
||||||
|
mcl_mobs.effect_functions["withering"](mob, 0.5, 10)
|
||||||
mob:punch(self.object, 1.0, {
|
mob:punch(self.object, 1.0, {
|
||||||
full_punch_interval = 0.5,
|
full_punch_interval = 0.5,
|
||||||
damage_groups = {fleshy = 8},
|
damage_groups = {fleshy = 8},
|
||||||
}, nil)
|
}, nil)
|
||||||
mcl_mobs.mob_class.boom(self,self.object:get_pos(), 1)
|
mcl_mobs.mob_class.boom(self, pos, 1)
|
||||||
local l = mob:get_luaentity()
|
local l = mob:get_luaentity()
|
||||||
if l and l.health - 8 <= 0 then
|
if l and l.health - 8 <= 0 then
|
||||||
local n = minetest.find_node_near(mob:get_pos(),2,wither_rose_soil)
|
local shooter = self._shooter:get_luaentity()
|
||||||
if n then
|
if shooter then shooter.health = shooter.health + 5 end
|
||||||
local p = vector.offset(n,0,1,0)
|
spawn_wither_rose(mob)
|
||||||
if minetest.get_node(p).name == "air" then
|
|
||||||
if not ( mobs_griefing and minetest.place_node(p,{name="mcl_flowers:wither_rose"}) ) then
|
|
||||||
minetest.add_item(p,"mcl_flowers:wither_rose")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -126,10 +503,75 @@ mcl_mobs.register_arrow("mobs_mc:wither_skull", {
|
||||||
mcl_mobs.mob_class.boom(self,pos, 1)
|
mcl_mobs.mob_class.boom(self,pos, 1)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
-- TODO: Add blue wither skull
|
mcl_mobs.register_arrow("mobs_mc:wither_skull_strong", {
|
||||||
|
visual = "cube",
|
||||||
|
visual_size = {x = 0.35, y = 0.35},
|
||||||
|
textures = {
|
||||||
|
"mobs_mc_wither_projectile_strong.png^[verticalframe:6:0", -- top
|
||||||
|
"mobs_mc_wither_projectile_strong.png^[verticalframe:6:1", -- bottom
|
||||||
|
"mobs_mc_wither_projectile_strong.png^[verticalframe:6:2", -- left
|
||||||
|
"mobs_mc_wither_projectile_strong.png^[verticalframe:6:3", -- right
|
||||||
|
"mobs_mc_wither_projectile_strong.png^[verticalframe:6:4", -- back
|
||||||
|
"mobs_mc_wither_projectile_strong.png^[verticalframe:6:5", -- front
|
||||||
|
},
|
||||||
|
velocity = 4,
|
||||||
|
rotate = 90,
|
||||||
|
_lifetime = 500,
|
||||||
|
on_punch = function(self) end,
|
||||||
|
|
||||||
|
-- direct hit
|
||||||
|
hit_player = function(self, player)
|
||||||
|
local pos = vector.new(self.object:get_pos())
|
||||||
|
mcl_mobs.effect_functions["withering"](player, 0.5, 10)
|
||||||
|
player:punch(self.object, 1.0, {
|
||||||
|
full_punch_interval = 0.5,
|
||||||
|
damage_groups = {fleshy = 12},
|
||||||
|
}, nil)
|
||||||
|
if mobs_griefing and not minetest.is_protected(pos, "") then
|
||||||
|
mcl_explosions.explode(pos, 1, { drop_chance = 1.0, max_blast_resistance = 0, }, self.object)
|
||||||
|
else
|
||||||
|
mcl_mobs.mob_class.safe_boom(self, pos, 1) --need to call it this way bc self is the "arrow" object here
|
||||||
|
end
|
||||||
|
if player:get_hp() <= 0 then
|
||||||
|
local shooter = self._shooter:get_luaentity()
|
||||||
|
if shooter then shooter.health = shooter.health + 5 end
|
||||||
|
spawn_wither_rose(player)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
hit_mob = function(self, mob)
|
||||||
|
local pos = vector.new(self.object:get_pos())
|
||||||
|
mcl_mobs.effect_functions["withering"](mob, 0.5, 10)
|
||||||
|
mob:punch(self.object, 1.0, {
|
||||||
|
full_punch_interval = 0.5,
|
||||||
|
damage_groups = {fleshy = 12},
|
||||||
|
}, nil)
|
||||||
|
if mobs_griefing and not minetest.is_protected(pos, "") then
|
||||||
|
mcl_explosions.explode(pos, 1, { drop_chance = 1.0, max_blast_resistance = 0, }, self.object)
|
||||||
|
else
|
||||||
|
mcl_mobs.mob_class.safe_boom(self, pos, 1) --need to call it this way bc self is the "arrow" object here
|
||||||
|
end
|
||||||
|
local l = mob:get_luaentity()
|
||||||
|
if l and l.health - 8 <= 0 then
|
||||||
|
local shooter = self._shooter:get_luaentity()
|
||||||
|
if shooter then shooter.health = shooter.health + 5 end
|
||||||
|
spawn_wither_rose(mob)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- node hit, explode
|
||||||
|
hit_node = function(self, pos, node)
|
||||||
|
if mobs_griefing and not minetest.is_protected(pos, "") then
|
||||||
|
mcl_explosions.explode(pos, 1, { drop_chance = 1.0, max_blast_resistance = 0, }, self.object)
|
||||||
|
else
|
||||||
|
mcl_mobs.mob_class.safe_boom(self, pos, 1) --need to call it this way bc self is the "arrow" object here
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
--Spawn egg
|
--Spawn egg
|
||||||
mcl_mobs.register_egg("mobs_mc:wither", S("Wither"), "#4f4f4f", "#4f4f4f", 0, true)
|
mcl_mobs.register_egg("mobs_mc:wither", S("Wither"), "#4f4f4f", "#4f4f4f", 0, true)
|
||||||
|
|
||||||
mcl_wip.register_wip_item("mobs_mc:wither")
|
mcl_wip.register_wip_item("mobs_mc:wither")
|
||||||
mcl_mobs:non_spawn_specific("mobs_mc:wither","overworld",0,minetest.LIGHT_MAX+1)
|
mcl_mobs:non_spawn_specific("mobs_mc:wither","overworld",0,minetest.LIGHT_MAX+1)
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,31 @@ function mcl_armor.equip_on_use(itemstack, player, pointed_thing)
|
||||||
return mcl_armor.equip(itemstack, player)
|
return mcl_armor.equip(itemstack, player)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function get_armor_texture(textures, name, modname, itemname, itemstring)
|
||||||
|
local core_texture = textures[name] or modname .. "_" .. itemname .. ".png"
|
||||||
|
if type(core_texture) == "function" then return core_texture end
|
||||||
|
mcl_armor.trims.core_textures[itemstring] = core_texture
|
||||||
|
local func = function(obj, itemstack)
|
||||||
|
local overlay = itemstack:get_meta():get_string("mcl_armor:trim_overlay")
|
||||||
|
local core_armor_texture
|
||||||
|
local stack_name = mcl_grindstone.remove_enchant_name(itemstack) -- gets original itemstring if enchanted, no need to store (nearly) identical values
|
||||||
|
local core_armor_texture = mcl_armor.trims.core_textures[stack_name]
|
||||||
|
|
||||||
|
if mcl_enchanting.is_enchanted(itemstack:get_name()) then -- working with the original stack to know wether to apply enchanting overlay or not
|
||||||
|
-- Far, Far in the future we may no longer _enchanted itemstrings...
|
||||||
|
-- To fix this code, simply put the unmodified itemstring in stack_name's place
|
||||||
|
-- DO NOT REMOVE THIS if UNLESS YOU KNOW WHAT YOU'RE TRYING TO ACHIEVE!
|
||||||
|
core_armor_texture = core_armor_texture .. mcl_enchanting.overlay
|
||||||
|
end
|
||||||
|
|
||||||
|
if overlay == "" then return core_armor_texture end -- key not present; armor not trimmed
|
||||||
|
|
||||||
|
return core_armor_texture .. overlay
|
||||||
|
end
|
||||||
|
|
||||||
|
return func
|
||||||
|
end
|
||||||
|
|
||||||
function mcl_armor.register_set(def)
|
function mcl_armor.register_set(def)
|
||||||
local modname = minetest.get_current_modname()
|
local modname = minetest.get_current_modname()
|
||||||
local S = minetest.get_translator(modname)
|
local S = minetest.get_translator(modname)
|
||||||
|
@ -136,7 +161,7 @@ function mcl_armor.register_set(def)
|
||||||
_on_unequip = on_unequip_callbacks[name] or def.on_unequip,
|
_on_unequip = on_unequip_callbacks[name] or def.on_unequip,
|
||||||
_on_break = on_break_callbacks[name] or def.on_break,
|
_on_break = on_break_callbacks[name] or def.on_break,
|
||||||
_mcl_armor_element = name,
|
_mcl_armor_element = name,
|
||||||
_mcl_armor_texture = textures[name] or modname .. "_" .. itemname .. ".png",
|
_mcl_armor_texture = get_armor_texture(textures, name, modname, itemname, itemstring),
|
||||||
_mcl_upgradable = def._mcl_upgradable,
|
_mcl_upgradable = def._mcl_upgradable,
|
||||||
_mcl_upgrade_item = upgrade_item
|
_mcl_upgrade_item = upgrade_item
|
||||||
})
|
})
|
||||||
|
@ -257,3 +282,55 @@ function mcl_armor.update(obj)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function mcl_armor.trim(itemstack, overlay, color_string)
|
||||||
|
local def = itemstack:get_definition()
|
||||||
|
if not def._mcl_armor_texture and not mcl_armor.trims.blacklisted[itemstack:get_name()] then return end
|
||||||
|
local meta = itemstack:get_meta()
|
||||||
|
|
||||||
|
local piece_overlay = overlay
|
||||||
|
local inv_overlay = ""
|
||||||
|
local piece_type = def._mcl_armor_element
|
||||||
|
|
||||||
|
if piece_type == "head" then --helmet
|
||||||
|
inv_overlay = "^(helmet_trim.png"
|
||||||
|
piece_overlay = piece_overlay .. "_helmet"
|
||||||
|
elseif piece_type == "torso" then --chestplate
|
||||||
|
inv_overlay = "^(chestplate_trim.png"
|
||||||
|
piece_overlay = piece_overlay .. "_chestplate"
|
||||||
|
elseif piece_type == "legs" then --leggings
|
||||||
|
inv_overlay = "^(leggings_trim.png"
|
||||||
|
piece_overlay = piece_overlay .. "_leggings"
|
||||||
|
elseif piece_type == "feet" then --boots
|
||||||
|
inv_overlay = "^(boots_trim.png"
|
||||||
|
piece_overlay = piece_overlay .. "_boots"
|
||||||
|
end
|
||||||
|
local color = mcl_armor.trims.colors[color_string]
|
||||||
|
inv_overlay = inv_overlay .. "^[colorize:" .. color .. ":150)"
|
||||||
|
piece_overlay = piece_overlay .. ".png"
|
||||||
|
|
||||||
|
piece_overlay = "^(" .. piece_overlay .. "^[colorize:" .. color .. ":150)"
|
||||||
|
|
||||||
|
meta:set_string("mcl_armor:trim_overlay" , piece_overlay) -- set textures to render on the player, will work for clients below 5.8 as well
|
||||||
|
meta:set_string("mcl_armor:inv", inv_overlay) -- make 5.8+ clients display the fancy inv image, older ones will see no change in the *inventory* image
|
||||||
|
meta:set_string("inventory_image", def.inventory_image .. inv_overlay) -- dont use reload_inv_image as it's a one liner in this enviorment
|
||||||
|
end
|
||||||
|
|
||||||
|
function mcl_armor.reload_trim_inv_image(itemstack)
|
||||||
|
local meta = itemstack:get_meta()
|
||||||
|
local inv_overlay = meta:get_string("mcl_armor:inv")
|
||||||
|
local def = itemstack:get_definition()
|
||||||
|
if inv_overlay == "" then return end
|
||||||
|
meta:set_string("inventory_image", def.inventory_image .. inv_overlay)
|
||||||
|
end
|
||||||
|
|
||||||
|
tt.register_snippet(function(itemstring, toolcaps, stack)
|
||||||
|
if not stack then return nil end
|
||||||
|
local meta = stack:get_meta()
|
||||||
|
if meta:get_string("mcl_armor:trim_overlay") == "" then return nil end -- remember, get_string returns "" if the key doesn't exist
|
||||||
|
-- we need to get the part of the overlay image between the overlay begin ( and the trim name end _
|
||||||
|
-- we COULD easily store this info in meta, but that would bloat the meta storage, as the same few values would be stored over and over again on every trimmed item
|
||||||
|
-- this is fine here as this code gets only executed when you put armor and a trim in a smithing table
|
||||||
|
local full_overlay = meta:get_string("mcl_armor:trim_overlay")
|
||||||
|
local trim_name = full_overlay:match("%((.-)%_")
|
||||||
|
return "Upgrade:\n " .. trim_name:gsub("^%l", string.upper) .. " Armor Trim"
|
||||||
|
end)
|
|
@ -57,6 +57,12 @@ mcl_armor = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
player_view_range_factors = {},
|
player_view_range_factors = {},
|
||||||
|
trims = {
|
||||||
|
core_textures = {},
|
||||||
|
blacklisted = {["mcl_armor:elytra"]=true, ["mcl_armor:elytra_enchanted"]=true},
|
||||||
|
overlays = {"sentry","dune","coast","wild","tide","ward","vex","rib","snout","eye","spire"},
|
||||||
|
colors = {["amethyst"]="#8246a5",["gold"]="#ce9627",["emerald"]="#1b9958",["copper"]="#c36447",["diamond"]="#5faed8",["iron"]="#938e88",["lapis"]="#1c306b",["netherite"]="#302a26",["quartz"]="#c9bcb9",["redstone"]="#af2c23"},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local modpath = minetest.get_modpath("mcl_armor")
|
local modpath = minetest.get_modpath("mcl_armor")
|
||||||
|
@ -66,3 +72,4 @@ dofile(modpath .. "/player.lua")
|
||||||
dofile(modpath .. "/damage.lua")
|
dofile(modpath .. "/damage.lua")
|
||||||
dofile(modpath .. "/register.lua")
|
dofile(modpath .. "/register.lua")
|
||||||
dofile(modpath .. "/alias.lua")
|
dofile(modpath .. "/alias.lua")
|
||||||
|
dofile(modpath .. "/trims.lua")
|
||||||
|
|
|
@ -21,3 +21,6 @@ Iron Boots=Eisenstiefel
|
||||||
Golden Boots=Goldstiefel
|
Golden Boots=Goldstiefel
|
||||||
Diamond Boots=Diamantstiefel
|
Diamond Boots=Diamantstiefel
|
||||||
Chain Boots=Kettenstiefel
|
Chain Boots=Kettenstiefel
|
||||||
|
|
||||||
|
|
||||||
|
Smithing Template '@1'=Schiedevorlage '@1'
|
|
@ -45,4 +45,7 @@ Protection=
|
||||||
Reduces most types of damage by 4% for each level.=
|
Reduces most types of damage by 4% for each level.=
|
||||||
Thorns=
|
Thorns=
|
||||||
Reflects some of the damage taken when hit, at the cost of reducing durability with each proc.=
|
Reflects some of the damage taken when hit, at the cost of reducing durability with each proc.=
|
||||||
Aqua Affinity=
|
Aqua Affinity=
|
||||||
|
|
||||||
|
#Translations for armor trims
|
||||||
|
Smithing Template '@1'=
|
|
@ -1,5 +1,5 @@
|
||||||
name = mcl_armor
|
name = mcl_armor
|
||||||
author = stu
|
author = stu
|
||||||
description = Adds craftable armor that is visible to other players.
|
description = Adds craftable armor that is visible to other players.
|
||||||
depends = mcl_core, mcl_player, mcl_enchanting, mcl_damage
|
depends = mcl_core, mcl_player, mcl_enchanting, mcl_damage, mcl_grindstone
|
||||||
optional_depends = mcl_fire, ethereal, bakedclay
|
optional_depends = mcl_fire, ethereal, bakedclay
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
local mod_registername = minetest.get_current_modname() .. ":"
|
||||||
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
|
||||||
|
for _, template_name in pairs(mcl_armor.trims.overlays) do
|
||||||
|
minetest.register_craftitem(mod_registername .. template_name, {
|
||||||
|
description = S("Smithing Template '@1'", template_name),
|
||||||
|
inventory_image = template_name .. "_armor_trim_smithing_template.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = mod_registername .. template_name .. " 2",
|
||||||
|
recipe = {
|
||||||
|
{"mcl_core:diamond",mod_registername .. template_name,"mcl_core:diamond"},
|
||||||
|
{"mcl_core:diamond","mcl_core:cobble","mcl_core:diamond"},
|
||||||
|
{"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
--temp craft recipies, missing structures
|
||||||
|
minetest.register_craft({
|
||||||
|
output = mod_registername .. "eye",
|
||||||
|
recipe = {
|
||||||
|
{"mcl_core:diamond","mcl_end:ender_eye","mcl_core:diamond"},
|
||||||
|
{"mcl_core:diamond","mcl_end:ender_eye","mcl_core:diamond"},
|
||||||
|
{"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = mod_registername .. "ward",
|
||||||
|
recipe = {
|
||||||
|
{"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"},
|
||||||
|
{"mcl_core:diamond","mcl_core:apple_gold_enchanted","mcl_core:diamond"},
|
||||||
|
{"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = mod_registername .. "snout",
|
||||||
|
recipe = {
|
||||||
|
{"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"},
|
||||||
|
{"mcl_core:diamond","mcl_core:goldblock","mcl_core:diamond"},
|
||||||
|
{"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"},
|
||||||
|
}
|
||||||
|
})
|
|
@ -3,7 +3,7 @@ mcl_bamboo
|
||||||
|
|
||||||
This mod adds working, familiar bamboo nodes to your Mineclone 2 world.
|
This mod adds working, familiar bamboo nodes to your Mineclone 2 world.
|
||||||
|
|
||||||
Code: MineClone2 dev team. Original (basic) bamboo code by: Small Joker.
|
Code: Michieal. Original (basic, used as inspiration) bamboo code by: Small Joker. Updates to the code: Mineclone Dev Team, Michieal.
|
||||||
|
|
||||||
License for code: GPLv3.
|
License for code: GPLv3.
|
||||||
License for images / textures: CC-BY-SA except where noted.
|
License for images / textures: CC-BY-SA except where noted.
|
||||||
|
|
|
@ -86,6 +86,11 @@ local bamboo_def = {
|
||||||
on_rotate = on_rotate,
|
on_rotate = on_rotate,
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
|
||||||
|
if not pointed_thing then
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
if pointed_thing.type ~= "node" then
|
if pointed_thing.type ~= "node" then
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
@ -201,7 +206,7 @@ local bamboo_def = {
|
||||||
local node_above_name = minetest.get_node(pointed_thing.above).name
|
local node_above_name = minetest.get_node(pointed_thing.above).name
|
||||||
mcl_bamboo.mcl_log("\n\n\nnode_above name: " .. node_above_name)
|
mcl_bamboo.mcl_log("\n\n\nnode_above name: " .. node_above_name)
|
||||||
if node_above_name ~= "mcl_core:water_source" and node_above_name ~= "mcl_core:lava_source"
|
if node_above_name ~= "mcl_core:water_source" and node_above_name ~= "mcl_core:lava_source"
|
||||||
and node_above_name ~= "mcl_nether:nether_lava_source" then
|
and node_above_name ~= "mcl_nether:nether_lava_source" then
|
||||||
local _, position = minetest.item_place(place_item, placer, pointed_thing, fdir)
|
local _, position = minetest.item_place(place_item, placer, pointed_thing, fdir)
|
||||||
if position then
|
if position then
|
||||||
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
|
@ -276,6 +281,13 @@ local bamboo_block_def = {
|
||||||
_mcl_hardness = 2,
|
_mcl_hardness = 2,
|
||||||
_mcl_stripped_variant = "mcl_bamboo:bamboo_block_stripped", -- this allows us to use the built in Axe's strip block.
|
_mcl_stripped_variant = "mcl_bamboo:bamboo_block_stripped", -- this allows us to use the built in Axe's strip block.
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if not pointed_thing then
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
if pointed_thing.type ~= "node" then -- make sure that pointed_thing is not null and is pointing at a node.
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
local pos = pointed_thing.under
|
local pos = pointed_thing.under
|
||||||
|
|
||||||
|
|
|
@ -18,13 +18,21 @@ local function on_place_fish(itemstack, placer, pointed_thing)
|
||||||
return new_stack
|
return new_stack
|
||||||
end
|
end
|
||||||
|
|
||||||
local pos = pointed_thing.above or pointed_thing.under
|
if pointed_thing.type ~= "node" then return end
|
||||||
if not pos then return end
|
|
||||||
local n = minetest.get_node_or_nil(pos)
|
local pos = pointed_thing.above
|
||||||
if n.name and minetest.registered_nodes[n.name].buildable_to or n.name == "mcl_portals:portal" then
|
local n = minetest.get_node(pointed_thing.above)
|
||||||
local fish = itemstack:get_name():gsub(fishbucket_prefix,"")
|
local def = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
|
||||||
if fish_names[fish] then
|
|
||||||
local o = minetest.add_entity(pos, "mobs_mc:" .. fish)
|
if ( def and def.buildable_to ) or n.name == "mcl_portals:portal" then
|
||||||
|
pos = pointed_thing.under
|
||||||
|
n = minetest.get_node(pointed_thing.under)
|
||||||
|
end
|
||||||
|
|
||||||
|
local fish = itemstack:get_definition()._mcl_buckets_fish
|
||||||
|
if fish_names[fish] then
|
||||||
|
local o = minetest.add_entity(pos, "mobs_mc:" .. fish)
|
||||||
|
if o and o:get_pos() then
|
||||||
local props = itemstack:get_meta():get_string("properties")
|
local props = itemstack:get_meta():get_string("properties")
|
||||||
if props ~= "" then
|
if props ~= "" then
|
||||||
o:set_properties(minetest.deserialize(props))
|
o:set_properties(minetest.deserialize(props))
|
||||||
|
@ -60,6 +68,7 @@ for techname, fishname in pairs(fish_names) do
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
groups = {bucket = 1, fish_bucket = 1},
|
groups = {bucket = 1, fish_bucket = 1},
|
||||||
liquids_pointable = false,
|
liquids_pointable = false,
|
||||||
|
_mcl_buckets_fish = techname,
|
||||||
on_place = on_place_fish,
|
on_place = on_place_fish,
|
||||||
on_secondary_use = on_place_fish,
|
on_secondary_use = on_place_fish,
|
||||||
_on_dispense = function(stack, pos, droppos, dropnode, dropdir)
|
_on_dispense = function(stack, pos, droppos, dropnode, dropdir)
|
||||||
|
|
|
@ -9,9 +9,10 @@ Authors:
|
||||||
Gerold55 - Code Start + Models?
|
Gerold55 - Code Start + Models?
|
||||||
PrairieWind - Improved and Cleaned Up Code, and added the soul campfire and crafting recipes.
|
PrairieWind - Improved and Cleaned Up Code, and added the soul campfire and crafting recipes.
|
||||||
cora - Added burning damage.
|
cora - Added burning damage.
|
||||||
DinoNuggies4665 - Cooking logic implemented
|
DinoNuggies4665 - Cooking logic implemented.
|
||||||
thunder1035 - Redesigned model and texture tweaks
|
thunder1035 - Redesigned model and texture tweaks.
|
||||||
AncientMariner - Changed smoke to particle spawner and tweaked particle configuration.
|
AncientMariner - Changed smoke to particle spawner and tweaked particle configuration.
|
||||||
|
Michieal - Fixed misc. errors.
|
||||||
|
|
||||||
License of media
|
License of media
|
||||||
----------------
|
----------------
|
||||||
|
|
|
@ -332,6 +332,9 @@ function mcl_campfires.register_campfire(name, def)
|
||||||
elseif minetest.get_item_group(itemstack:get_name(), "campfire_cookable") ~= 0 then
|
elseif minetest.get_item_group(itemstack:get_name(), "campfire_cookable") ~= 0 then
|
||||||
mcl_campfires.take_item(pos, node, player, itemstack)
|
mcl_campfires.take_item(pos, node, player, itemstack)
|
||||||
else
|
else
|
||||||
|
if not pointed_thing then
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
minetest.item_place_node(itemstack, player, pointed_thing)
|
minetest.item_place_node(itemstack, player, pointed_thing)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -532,9 +532,12 @@ local function register_chest(basename, desc, longdesc, usagehelp, tt_help, tile
|
||||||
_mcl_hardness = 2.5,
|
_mcl_hardness = 2.5,
|
||||||
|
|
||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
if minetest.registered_nodes[minetest.get_node({ x = pos.x, y = pos.y + 1, z = pos.z }).name].groups.opaque == 1 then
|
local topnode = minetest.get_node({ x = pos.x, y = pos.y + 1, z = pos.z })
|
||||||
-- won't open if there is no space from the top
|
if topnode and topnode.name and minetest.registered_nodes[topnode.name] then
|
||||||
return false
|
if minetest.registered_nodes[topnode.name].groups.opaque == 1 then
|
||||||
|
-- won't open if there is no space from the top
|
||||||
|
return false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
local name = minetest.get_meta(pos):get_string("name")
|
local name = minetest.get_meta(pos):get_string("name")
|
||||||
if name == "" then
|
if name == "" then
|
||||||
|
|
|
@ -1581,7 +1581,7 @@ end
|
||||||
-- MUST NOT be called if there is a snow cover node above pos.
|
-- MUST NOT be called if there is a snow cover node above pos.
|
||||||
function mcl_core.clear_snow_dirt(pos, node)
|
function mcl_core.clear_snow_dirt(pos, node)
|
||||||
local def = minetest.registered_nodes[node.name]
|
local def = minetest.registered_nodes[node.name]
|
||||||
if def._mcl_snowless then
|
if def and def._mcl_snowless then
|
||||||
minetest.swap_node(pos, {name = def._mcl_snowless, param2=node.param2})
|
minetest.swap_node(pos, {name = def._mcl_snowless, param2=node.param2})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1602,7 +1602,7 @@ function mcl_core.on_snowable_construct(pos)
|
||||||
-- Make snowed if needed
|
-- Make snowed if needed
|
||||||
if minetest.get_item_group(anode.name, "snow_cover") == 1 then
|
if minetest.get_item_group(anode.name, "snow_cover") == 1 then
|
||||||
local def = minetest.registered_nodes[node.name]
|
local def = minetest.registered_nodes[node.name]
|
||||||
if def._mcl_snowed then
|
if def and def._mcl_snowed then
|
||||||
minetest.swap_node(pos, {name = def._mcl_snowed, param2=node.param2})
|
minetest.swap_node(pos, {name = def._mcl_snowed, param2=node.param2})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1623,7 +1623,7 @@ function mcl_core.on_snow_construct(pos)
|
||||||
local npos = {x=pos.x, y=pos.y-1, z=pos.z}
|
local npos = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||||
local node = minetest.get_node(npos)
|
local node = minetest.get_node(npos)
|
||||||
local def = minetest.registered_nodes[node.name]
|
local def = minetest.registered_nodes[node.name]
|
||||||
if def._mcl_snowed then
|
if def and def._mcl_snowed then
|
||||||
minetest.swap_node(npos, {name = def._mcl_snowed, param2=node.param2})
|
minetest.swap_node(npos, {name = def._mcl_snowed, param2=node.param2})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1038,7 +1038,7 @@ for i=1,8 do
|
||||||
|
|
||||||
-- Get position where snow would be placed
|
-- Get position where snow would be placed
|
||||||
local target
|
local target
|
||||||
if minetest.registered_nodes[unode.name].buildable_to then
|
if def and def.buildable_to then
|
||||||
target = under
|
target = under
|
||||||
else
|
else
|
||||||
target = above
|
target = above
|
||||||
|
|
|
@ -155,7 +155,8 @@ minetest.register_node("mcl_end:chorus_flower", {
|
||||||
1) On top of end stone or chorus plant
|
1) On top of end stone or chorus plant
|
||||||
2) On top of air and horizontally adjacent to exactly 1 chorus plant ]]
|
2) On top of air and horizontally adjacent to exactly 1 chorus plant ]]
|
||||||
local pos
|
local pos
|
||||||
if minetest.registered_nodes[node_under.name].buildable_to then
|
local def = minetest.registered_nodes[node_under.name]
|
||||||
|
if def and def.buildable_to then
|
||||||
pos = pointed_thing.under
|
pos = pointed_thing.under
|
||||||
else
|
else
|
||||||
pos = pointed_thing.above
|
pos = pointed_thing.above
|
||||||
|
@ -283,7 +284,8 @@ minetest.register_node("mcl_end:chorus_plant", {
|
||||||
condition is met:
|
condition is met:
|
||||||
- placed on end stone or any chorus node ]]
|
- placed on end stone or any chorus node ]]
|
||||||
local pos_place, node_check
|
local pos_place, node_check
|
||||||
if minetest.registered_nodes[node_under.name].buildable_to then
|
local def = minetest.registered_nodes[node_under.name]
|
||||||
|
if def and def.buildable_to then
|
||||||
pos_place = pointed_thing.under
|
pos_place = pointed_thing.under
|
||||||
node_check = node_above
|
node_check = node_above
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
-- Code based from mcl_anvils
|
-- Code based from mcl_anvils
|
||||||
|
|
||||||
|
mcl_grindstone = {}
|
||||||
|
|
||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
local F = minetest.formspec_escape
|
local F = minetest.formspec_escape
|
||||||
local C = minetest.colorize
|
local C = minetest.colorize
|
||||||
|
@ -55,7 +57,7 @@ local function create_new_item(name_item, meta, wear)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If an item has an enchanment then remove "_enchanted" from the name
|
-- If an item has an enchanment then remove "_enchanted" from the name
|
||||||
local function remove_enchant_name(stack)
|
function mcl_grindstone.remove_enchant_name(stack)
|
||||||
if mcl_enchanting.is_enchanted(stack:get_name()) then
|
if mcl_enchanting.is_enchanted(stack:get_name()) then
|
||||||
local name = stack:get_name()
|
local name = stack:get_name()
|
||||||
return name.sub(name, 1, -11)
|
return name.sub(name, 1, -11)
|
||||||
|
@ -116,8 +118,8 @@ local function update_grindstone_slots(meta)
|
||||||
local def1 = input1:get_definition()
|
local def1 = input1:get_definition()
|
||||||
local def2 = input2:get_definition()
|
local def2 = input2:get_definition()
|
||||||
-- Remove enchant name if they have one
|
-- Remove enchant name if they have one
|
||||||
local name1 = remove_enchant_name(input1)
|
local name1 = mcl_grindstone.remove_enchant_name(input1)
|
||||||
local name2 = remove_enchant_name(input2)
|
local name2 = mcl_grindstone.remove_enchant_name(input2)
|
||||||
|
|
||||||
-- Calculate repair
|
-- Calculate repair
|
||||||
local function calculate_repair(dur1, dur2)
|
local function calculate_repair(dur1, dur2)
|
||||||
|
@ -143,7 +145,7 @@ local function update_grindstone_slots(meta)
|
||||||
local def1 = input1:get_definition()
|
local def1 = input1:get_definition()
|
||||||
local meta = input1:get_meta()
|
local meta = input1:get_meta()
|
||||||
if def1.type == "tool" and mcl_enchanting.is_enchanted(input1:get_name()) then
|
if def1.type == "tool" and mcl_enchanting.is_enchanted(input1:get_name()) then
|
||||||
local name = remove_enchant_name(input1)
|
local name = mcl_grindstone.remove_enchant_name(input1)
|
||||||
local wear = input1:get_wear()
|
local wear = input1:get_wear()
|
||||||
local new_item = create_new_item(name, meta, wear)
|
local new_item = create_new_item(name, meta, wear)
|
||||||
new_output = transfer_curse(input1, new_item)
|
new_output = transfer_curse(input1, new_item)
|
||||||
|
@ -157,7 +159,7 @@ local function update_grindstone_slots(meta)
|
||||||
local def2 = input2:get_definition()
|
local def2 = input2:get_definition()
|
||||||
local meta = input2:get_meta()
|
local meta = input2:get_meta()
|
||||||
if def2.type == "tool" and mcl_enchanting.is_enchanted(input2:get_name()) then
|
if def2.type == "tool" and mcl_enchanting.is_enchanted(input2:get_name()) then
|
||||||
local name = remove_enchant_name(input2)
|
local name = mcl_grindstone.remove_enchant_name(input2)
|
||||||
local wear = input2:get_wear()
|
local wear = input2:get_wear()
|
||||||
local new_item = create_new_item(name, meta, wear)
|
local new_item = create_new_item(name, meta, wear)
|
||||||
new_output = transfer_curse(input2, new_item)
|
new_output = transfer_curse(input2, new_item)
|
||||||
|
|
|
@ -301,7 +301,8 @@ minetest.register_node("mcl_mobspawners:spawner", {
|
||||||
local new_itemstack, success = minetest.item_place(itemstack, placer, pointed_thing)
|
local new_itemstack, success = minetest.item_place(itemstack, placer, pointed_thing)
|
||||||
if success then
|
if success then
|
||||||
local placepos
|
local placepos
|
||||||
if minetest.registered_nodes[node_under.name].buildable_to then
|
local def = minetest.registered_nodes[node_under.name]
|
||||||
|
if def and def.buildable_to then
|
||||||
placepos = pointed_thing.under
|
placepos = pointed_thing.under
|
||||||
else
|
else
|
||||||
placepos = pointed_thing.above
|
placepos = pointed_thing.above
|
||||||
|
|
|
@ -20,6 +20,7 @@ get_chat_function["leaping"] = mcl_potions.leaping_func
|
||||||
get_chat_function["swiftness"] = mcl_potions.swiftness_func
|
get_chat_function["swiftness"] = mcl_potions.swiftness_func
|
||||||
get_chat_function["heal"] = mcl_potions.healing_func
|
get_chat_function["heal"] = mcl_potions.healing_func
|
||||||
get_chat_function["bad_omen"] = mcl_potions.bad_omen_func
|
get_chat_function["bad_omen"] = mcl_potions.bad_omen_func
|
||||||
|
get_chat_function["withering"] = mcl_potions.withering_func
|
||||||
|
|
||||||
minetest.register_chatcommand("effect",{
|
minetest.register_chatcommand("effect",{
|
||||||
params = S("<effect> <duration> [<factor>]"),
|
params = S("<effect> <duration> [<factor>]"),
|
||||||
|
|
|
@ -10,6 +10,7 @@ EF.swift = {} -- for swiftness AND slowness
|
||||||
EF.night_vision = {}
|
EF.night_vision = {}
|
||||||
EF.fire_proof = {}
|
EF.fire_proof = {}
|
||||||
EF.bad_omen = {}
|
EF.bad_omen = {}
|
||||||
|
EF.withering = {}
|
||||||
|
|
||||||
local EFFECT_TYPES = 0
|
local EFFECT_TYPES = 0
|
||||||
for _,_ in pairs(EF) do
|
for _,_ in pairs(EF) do
|
||||||
|
@ -19,8 +20,11 @@ end
|
||||||
local icon_ids = {}
|
local icon_ids = {}
|
||||||
|
|
||||||
local function potions_set_hudbar(player)
|
local function potions_set_hudbar(player)
|
||||||
|
if EF.withering[player] and EF.regenerating[player] then
|
||||||
if EF.poisoned[player] and EF.regenerating[player] then
|
hb.change_hudbar(player, "health", nil, nil, "mcl_potions_icon_regen_wither.png", nil, "hudbars_bar_health.png")
|
||||||
|
elseif EF.withering[player] then
|
||||||
|
hb.change_hudbar(player, "health", nil, nil, "mcl_potions_icon_wither.png", nil, "hudbars_bar_health.png")
|
||||||
|
elseif EF.poisoned[player] and EF.regenerating[player] then
|
||||||
hb.change_hudbar(player, "health", nil, nil, "hbhunger_icon_regen_poison.png", nil, "hudbars_bar_health.png")
|
hb.change_hudbar(player, "health", nil, nil, "hbhunger_icon_regen_poison.png", nil, "hudbars_bar_health.png")
|
||||||
elseif EF.poisoned[player] then
|
elseif EF.poisoned[player] then
|
||||||
hb.change_hudbar(player, "health", nil, nil, "hbhunger_icon_health_poison.png", nil, "hudbars_bar_health.png")
|
hb.change_hudbar(player, "health", nil, nil, "hbhunger_icon_health_poison.png", nil, "hudbars_bar_health.png")
|
||||||
|
@ -123,6 +127,33 @@ minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Check for withering players
|
||||||
|
for player, vals in pairs(EF.withering) do
|
||||||
|
|
||||||
|
is_player = player:is_player()
|
||||||
|
entity = player:get_luaentity()
|
||||||
|
|
||||||
|
EF.withering[player].timer = EF.withering[player].timer + dtime
|
||||||
|
EF.withering[player].hit_timer = (EF.withering[player].hit_timer or 0) + dtime
|
||||||
|
|
||||||
|
if player:get_pos() then mcl_potions._add_spawner(player, "#000000") end
|
||||||
|
|
||||||
|
if EF.withering[player].hit_timer >= EF.withering[player].step then
|
||||||
|
if is_player or entity then mcl_util.deal_damage(player, 1, {type = "magic"}) end
|
||||||
|
if EF.withering[player] then EF.withering[player].hit_timer = 0 end
|
||||||
|
end
|
||||||
|
|
||||||
|
if EF.withering[player] and EF.withering[player].timer >= EF.withering[player].dur then
|
||||||
|
EF.withering[player] = nil
|
||||||
|
if is_player then
|
||||||
|
meta = player:get_meta()
|
||||||
|
meta:set_string("_is_withering", minetest.serialize(EF.withering[player]))
|
||||||
|
potions_set_hud(player)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
-- Check for poisoned players
|
-- Check for poisoned players
|
||||||
for player, vals in pairs(EF.poisoned) do
|
for player, vals in pairs(EF.poisoned) do
|
||||||
|
|
||||||
|
@ -152,7 +183,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check for regnerating players
|
-- Check for regenerating players
|
||||||
for player, vals in pairs(EF.regenerating) do
|
for player, vals in pairs(EF.regenerating) do
|
||||||
|
|
||||||
is_player = player:is_player()
|
is_player = player:is_player()
|
||||||
|
@ -408,6 +439,7 @@ function mcl_potions._clear_cached_player_data(player)
|
||||||
EF.night_vision[player] = nil
|
EF.night_vision[player] = nil
|
||||||
EF.fire_proof[player] = nil
|
EF.fire_proof[player] = nil
|
||||||
EF.bad_omen[player] = nil
|
EF.bad_omen[player] = nil
|
||||||
|
EF.withering[player] = nil
|
||||||
|
|
||||||
meta = player:get_meta()
|
meta = player:get_meta()
|
||||||
meta:set_int("night_vision", 0)
|
meta:set_int("night_vision", 0)
|
||||||
|
@ -452,6 +484,7 @@ function mcl_potions._save_player_effects(player)
|
||||||
meta:set_string("_is_cat", minetest.serialize(EF.night_vision[player]))
|
meta:set_string("_is_cat", minetest.serialize(EF.night_vision[player]))
|
||||||
meta:set_string("_is_fire_proof", minetest.serialize(EF.fire_proof[player]))
|
meta:set_string("_is_fire_proof", minetest.serialize(EF.fire_proof[player]))
|
||||||
meta:set_string("_has_bad_omen", minetest.serialize(EF.bad_omen[player]))
|
meta:set_string("_has_bad_omen", minetest.serialize(EF.bad_omen[player]))
|
||||||
|
meta:set_string("_is_withering", minetest.serialize(EF.withering[player]))
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -507,6 +540,10 @@ function mcl_potions._load_player_effects(player)
|
||||||
EF.bad_omen[player] = minetest.deserialize(meta:get_string("_has_bad_omen"))
|
EF.bad_omen[player] = minetest.deserialize(meta:get_string("_has_bad_omen"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if minetest.deserialize(meta:get_string("_is_withering")) then
|
||||||
|
EF.withering[player] = minetest.deserialize(meta:get_string("_is_withering"))
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns true if player has given effect
|
-- Returns true if player has given effect
|
||||||
|
@ -693,11 +730,9 @@ end
|
||||||
|
|
||||||
function mcl_potions.healing_func(player, hp)
|
function mcl_potions.healing_func(player, hp)
|
||||||
|
|
||||||
local obj = player:get_luaentity()
|
if not player or player:get_hp() <= 0 then return false end
|
||||||
|
|
||||||
if player:get_hp() == 0 then
|
local obj = player:get_luaentity()
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if obj and obj.harmed_by_heal then hp = -hp end
|
if obj and obj.harmed_by_heal then hp = -hp end
|
||||||
|
|
||||||
|
@ -725,6 +760,11 @@ end
|
||||||
|
|
||||||
function mcl_potions.swiftness_func(player, factor, duration)
|
function mcl_potions.swiftness_func(player, factor, duration)
|
||||||
|
|
||||||
|
if not player or player:get_hp() <= 0 then return false end
|
||||||
|
|
||||||
|
local entity = player:get_luaentity()
|
||||||
|
if entity and entity.is_boss then return false end
|
||||||
|
|
||||||
if not player:get_meta() then
|
if not player:get_meta() then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -753,6 +793,11 @@ end
|
||||||
|
|
||||||
function mcl_potions.leaping_func(player, factor, duration)
|
function mcl_potions.leaping_func(player, factor, duration)
|
||||||
|
|
||||||
|
if not player or player:get_hp() <= 0 then return false end
|
||||||
|
|
||||||
|
local entity = player:get_luaentity()
|
||||||
|
if entity and entity.is_boss then return false end
|
||||||
|
|
||||||
if not player:get_meta() then
|
if not player:get_meta() then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -781,6 +826,11 @@ end
|
||||||
|
|
||||||
function mcl_potions.weakness_func(player, factor, duration)
|
function mcl_potions.weakness_func(player, factor, duration)
|
||||||
|
|
||||||
|
if not player or player:get_hp() <= 0 then return false end
|
||||||
|
|
||||||
|
local entity = player:get_luaentity()
|
||||||
|
if entity and entity.is_boss then return false end
|
||||||
|
|
||||||
if not EF.weak[player] then
|
if not EF.weak[player] then
|
||||||
|
|
||||||
EF.weak[player] = {dur = duration, timer = 0, factor = factor}
|
EF.weak[player] = {dur = duration, timer = 0, factor = factor}
|
||||||
|
@ -804,6 +854,11 @@ end
|
||||||
|
|
||||||
function mcl_potions.strength_func(player, factor, duration)
|
function mcl_potions.strength_func(player, factor, duration)
|
||||||
|
|
||||||
|
if not player or player:get_hp() <= 0 then return false end
|
||||||
|
|
||||||
|
local entity = player:get_luaentity()
|
||||||
|
if entity and entity.is_boss then return false end
|
||||||
|
|
||||||
if not EF.strong[player] then
|
if not EF.strong[player] then
|
||||||
|
|
||||||
EF.strong[player] = {dur = duration, timer = 0, factor = factor}
|
EF.strong[player] = {dur = duration, timer = 0, factor = factor}
|
||||||
|
@ -825,8 +880,41 @@ function mcl_potions.strength_func(player, factor, duration)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function mcl_potions.withering_func(player, factor, duration)
|
||||||
|
|
||||||
|
if not player or player:get_hp() <= 0 then return false end
|
||||||
|
|
||||||
|
local entity = player:get_luaentity()
|
||||||
|
if entity and (entity.is_boss or string.find(entity.name, "wither")) then return false end
|
||||||
|
|
||||||
|
if not EF.withering[player] then
|
||||||
|
|
||||||
|
EF.withering[player] = {step = factor, dur = duration, timer = 0}
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
local victim = EF.withering[player]
|
||||||
|
|
||||||
|
victim.step = math.min(victim.step, factor)
|
||||||
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
||||||
|
victim.timer = 0
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if player:is_player() then
|
||||||
|
potions_set_hud(player)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function mcl_potions.poison_func(player, factor, duration)
|
function mcl_potions.poison_func(player, factor, duration)
|
||||||
|
|
||||||
|
if not player or player:get_hp() <= 0 then return false end
|
||||||
|
|
||||||
|
local entity = player:get_luaentity()
|
||||||
|
if entity and (entity.is_boss or entity.harmed_by_heal or string.find(entity.name, "spider")) then return false end
|
||||||
|
|
||||||
if not EF.poisoned[player] then
|
if not EF.poisoned[player] then
|
||||||
|
|
||||||
EF.poisoned[player] = {step = factor, dur = duration, timer = 0}
|
EF.poisoned[player] = {step = factor, dur = duration, timer = 0}
|
||||||
|
@ -850,6 +938,11 @@ end
|
||||||
|
|
||||||
function mcl_potions.regeneration_func(player, factor, duration)
|
function mcl_potions.regeneration_func(player, factor, duration)
|
||||||
|
|
||||||
|
if not player or player:get_hp() <= 0 then return false end
|
||||||
|
|
||||||
|
local entity = player:get_luaentity()
|
||||||
|
if entity and (entity.is_boss or entity.harmed_by_heal) then return false end
|
||||||
|
|
||||||
if not EF.regenerating[player] then
|
if not EF.regenerating[player] then
|
||||||
|
|
||||||
EF.regenerating[player] = {step = factor, dur = duration, timer = 0}
|
EF.regenerating[player] = {step = factor, dur = duration, timer = 0}
|
||||||
|
@ -873,6 +966,11 @@ end
|
||||||
|
|
||||||
function mcl_potions.invisiblility_func(player, null, duration)
|
function mcl_potions.invisiblility_func(player, null, duration)
|
||||||
|
|
||||||
|
if not player or player:get_hp() <= 0 then return false end
|
||||||
|
|
||||||
|
local entity = player:get_luaentity()
|
||||||
|
if entity and entity.is_boss then return false end
|
||||||
|
|
||||||
if not EF.invisible[player] then
|
if not EF.invisible[player] then
|
||||||
|
|
||||||
EF.invisible[player] = {dur = duration, timer = 0}
|
EF.invisible[player] = {dur = duration, timer = 0}
|
||||||
|
@ -895,6 +993,11 @@ end
|
||||||
|
|
||||||
function mcl_potions.water_breathing_func(player, null, duration)
|
function mcl_potions.water_breathing_func(player, null, duration)
|
||||||
|
|
||||||
|
if not player or player:get_hp() <= 0 then return false end
|
||||||
|
|
||||||
|
local entity = player:get_luaentity()
|
||||||
|
if entity and entity.is_boss then return false end
|
||||||
|
|
||||||
if not EF.water_breathing[player] then
|
if not EF.water_breathing[player] then
|
||||||
|
|
||||||
EF.water_breathing[player] = {dur = duration, timer = 0}
|
EF.water_breathing[player] = {dur = duration, timer = 0}
|
||||||
|
@ -917,6 +1020,11 @@ end
|
||||||
|
|
||||||
function mcl_potions.fire_resistance_func(player, null, duration)
|
function mcl_potions.fire_resistance_func(player, null, duration)
|
||||||
|
|
||||||
|
if not player or player:get_hp() <= 0 then return false end
|
||||||
|
|
||||||
|
local entity = player:get_luaentity()
|
||||||
|
if entity and entity.is_boss then return false end
|
||||||
|
|
||||||
if not EF.fire_proof[player] then
|
if not EF.fire_proof[player] then
|
||||||
|
|
||||||
EF.fire_proof[player] = {dur = duration, timer = 0}
|
EF.fire_proof[player] = {dur = duration, timer = 0}
|
||||||
|
@ -938,6 +1046,11 @@ end
|
||||||
|
|
||||||
function mcl_potions.night_vision_func(player, null, duration)
|
function mcl_potions.night_vision_func(player, null, duration)
|
||||||
|
|
||||||
|
if not player or player:get_hp() <= 0 then return false end
|
||||||
|
|
||||||
|
local entity = player:get_luaentity()
|
||||||
|
if entity and entity.is_boss then return false end
|
||||||
|
|
||||||
meta = player:get_meta()
|
meta = player:get_meta()
|
||||||
if not EF.night_vision[player] then
|
if not EF.night_vision[player] then
|
||||||
|
|
||||||
|
|
|
@ -190,7 +190,7 @@ local function set_node_empty_bottle(itemstack, placer, pointed_thing, newitemst
|
||||||
-- play sound
|
-- play sound
|
||||||
minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}, true)
|
minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}, true)
|
||||||
|
|
||||||
--
|
--
|
||||||
if minetest.is_creative_enabled(placer:get_player_name()) then
|
if minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
return itemstack
|
return itemstack
|
||||||
else
|
else
|
||||||
|
@ -356,6 +356,7 @@ local awkward_table = {
|
||||||
["mcl_fishing:pufferfish_raw"] = "mcl_potions:water_breathing",
|
["mcl_fishing:pufferfish_raw"] = "mcl_potions:water_breathing",
|
||||||
["mcl_mobitems:ghast_tear"] = "mcl_potions:regeneration",
|
["mcl_mobitems:ghast_tear"] = "mcl_potions:regeneration",
|
||||||
["mcl_mobitems:spider_eye"] = "mcl_potions:poison",
|
["mcl_mobitems:spider_eye"] = "mcl_potions:poison",
|
||||||
|
["mcl_flowers:wither_rose"] = "mcl_potions:withering",
|
||||||
["mcl_mobitems:rabbit_foot"] = "mcl_potions:leaping",
|
["mcl_mobitems:rabbit_foot"] = "mcl_potions:leaping",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,7 +374,7 @@ local potions = {}
|
||||||
for i, potion in ipairs({"healing","harming","swiftness","slowness",
|
for i, potion in ipairs({"healing","harming","swiftness","slowness",
|
||||||
"leaping","poison","regeneration","invisibility","fire_resistance",
|
"leaping","poison","regeneration","invisibility","fire_resistance",
|
||||||
-- "weakness","strength",
|
-- "weakness","strength",
|
||||||
"water_breathing","night_vision"}) do
|
"water_breathing","night_vision", "withering"}) do
|
||||||
|
|
||||||
table.insert(potions, potion)
|
table.insert(potions, potion)
|
||||||
|
|
||||||
|
@ -461,6 +462,31 @@ function mcl_potions.get_alchemy(ingr, pot)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mcl_mobs.effect_functions["poison"] = mcl_potions.poison_func
|
||||||
|
mcl_mobs.effect_functions["regeneration"] = mcl_potions.regeneration_func
|
||||||
|
mcl_mobs.effect_functions["invisibility"] = mcl_potions.invisiblility_func
|
||||||
|
mcl_mobs.effect_functions["fire_resistance"] = mcl_potions.fire_resistance_func
|
||||||
|
mcl_mobs.effect_functions["night_vision"] = mcl_potions.night_vision_func
|
||||||
|
mcl_mobs.effect_functions["water_breathing"] = mcl_potions.water_breathing_func
|
||||||
|
mcl_mobs.effect_functions["leaping"] = mcl_potions.leaping_func
|
||||||
|
mcl_mobs.effect_functions["swiftness"] = mcl_potions.swiftness_func
|
||||||
|
mcl_mobs.effect_functions["heal"] = mcl_potions.healing_func
|
||||||
|
mcl_mobs.effect_functions["bad_omen"] = mcl_potions.bad_omen_func
|
||||||
|
mcl_mobs.effect_functions["withering"] = mcl_potions.withering_func
|
||||||
|
|
||||||
|
-- give withering to players in a wither rose
|
||||||
|
local etime = 0
|
||||||
|
minetest.register_globalstep(function(dtime)
|
||||||
|
etime = dtime + etime
|
||||||
|
if etime < 0.5 then return end
|
||||||
|
etime = 0
|
||||||
|
for _,pl in pairs(minetest.get_connected_players()) do
|
||||||
|
local npos = vector.offset(pl:get_pos(), 0, 0.2, 0)
|
||||||
|
local n = minetest.get_node(npos)
|
||||||
|
if n.name == "mcl_flowers:wither_rose" then mcl_potions.withering_func(pl, 1, 2) end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
mcl_wip.register_wip_item("mcl_potions:night_vision")
|
mcl_wip.register_wip_item("mcl_potions:night_vision")
|
||||||
mcl_wip.register_wip_item("mcl_potions:night_vision_plus")
|
mcl_wip.register_wip_item("mcl_potions:night_vision_plus")
|
||||||
mcl_wip.register_wip_item("mcl_potions:night_vision_splash")
|
mcl_wip.register_wip_item("mcl_potions:night_vision_splash")
|
||||||
|
@ -468,4 +494,4 @@ mcl_wip.register_wip_item("mcl_potions:night_vision_plus_splash")
|
||||||
mcl_wip.register_wip_item("mcl_potions:night_vision_lingering")
|
mcl_wip.register_wip_item("mcl_potions:night_vision_lingering")
|
||||||
mcl_wip.register_wip_item("mcl_potions:night_vision_plus_lingering")
|
mcl_wip.register_wip_item("mcl_potions:night_vision_plus_lingering")
|
||||||
mcl_wip.register_wip_item("mcl_potions:night_vision_arrow")
|
mcl_wip.register_wip_item("mcl_potions:night_vision_arrow")
|
||||||
mcl_wip.register_wip_item("mcl_potions:night_vision_plus_arrow")
|
mcl_wip.register_wip_item("mcl_potions:night_vision_plus_arrow")
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
name = mcl_potions
|
name = mcl_potions
|
||||||
depends = mcl_core, mcl_farming, mcl_mobitems, mcl_fishing, mcl_bows, mcl_end, mcl_weather, playerphysics, mcl_wip
|
depends = mcl_core, mcl_farming, mcl_flowers, mcl_mobitems, mcl_mobs, mcl_fishing, mcl_bows, mcl_end, mcl_weather, playerphysics, mcl_wip
|
||||||
|
|
|
@ -79,7 +79,7 @@ local function register_potion(def)
|
||||||
if def.is_inv then
|
if def.is_inv then
|
||||||
dur = dur * mcl_potions.INV_FACTOR
|
dur = dur * mcl_potions.INV_FACTOR
|
||||||
end
|
end
|
||||||
if def.name == "poison" or def.name == "regeneration" then
|
if def.name == "poison" or def.name == "regeneration" or def.name == "withering" then
|
||||||
dur = 45
|
dur = 45
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ local function register_potion(def)
|
||||||
local _tt
|
local _tt
|
||||||
if effect and def.is_dur then
|
if effect and def.is_dur then
|
||||||
_tt = perc_string(effect).." | "..time_string(dur)
|
_tt = perc_string(effect).." | "..time_string(dur)
|
||||||
if def.name == "poison" or def.name == "regeneration" then
|
if def.name == "poison" or def.name == "regeneration" or def.name == "withering" then
|
||||||
_tt = S("1 HP/@1s | @2", effect, time_string(dur))
|
_tt = S("1 HP/@1s | @2", effect, time_string(dur))
|
||||||
end
|
end
|
||||||
elseif def.name == "healing" or def.name == "harming" then
|
elseif def.name == "healing" or def.name == "harming" then
|
||||||
|
@ -235,6 +235,8 @@ local function register_potion(def)
|
||||||
effect_II = def.effect*mcl_potions.II_FACTOR
|
effect_II = def.effect*mcl_potions.II_FACTOR
|
||||||
elseif def.name == "poison" or def.name == "regeneration" then
|
elseif def.name == "poison" or def.name == "regeneration" then
|
||||||
effect_II = 1.2
|
effect_II = 1.2
|
||||||
|
elseif def.name == "withering" then
|
||||||
|
effect_II = 2
|
||||||
else
|
else
|
||||||
effect_II = def.effect^mcl_potions.II_FACTOR
|
effect_II = def.effect^mcl_potions.II_FACTOR
|
||||||
end
|
end
|
||||||
|
@ -327,7 +329,7 @@ local function register_potion(def)
|
||||||
if def.is_plus then
|
if def.is_plus then
|
||||||
|
|
||||||
local dur_pl = dur * mcl_potions.PLUS_FACTOR
|
local dur_pl = dur * mcl_potions.PLUS_FACTOR
|
||||||
if def.name == "poison" or def.name == "regeneration" then
|
if def.name == "poison" or def.name == "regeneration" or def.name == "withering" then
|
||||||
dur_pl = 90
|
dur_pl = 90
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -533,6 +535,20 @@ local leaping_def = {
|
||||||
is_plus = true,
|
is_plus = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local withering_def = {
|
||||||
|
name = "withering",
|
||||||
|
description = S("Withering"),
|
||||||
|
_tt = nil,
|
||||||
|
_longdesc = S("Applies the withering effect which deals damage at a regular interval and can kill."),
|
||||||
|
color = "#000000",
|
||||||
|
effect = 4,
|
||||||
|
is_dur = true,
|
||||||
|
on_use = mcl_potions.withering_func,
|
||||||
|
is_II = true,
|
||||||
|
is_plus = true,
|
||||||
|
is_inv = true,
|
||||||
|
}
|
||||||
|
|
||||||
local poison_def = {
|
local poison_def = {
|
||||||
name = "poison",
|
name = "poison",
|
||||||
description = S("Poison"),
|
description = S("Poison"),
|
||||||
|
@ -597,7 +613,7 @@ local fire_resistance_def = {
|
||||||
|
|
||||||
local defs = { awkward_def, mundane_def, thick_def, dragon_breath_def,
|
local defs = { awkward_def, mundane_def, thick_def, dragon_breath_def,
|
||||||
healing_def, harming_def, night_vision_def, swiftness_def,
|
healing_def, harming_def, night_vision_def, swiftness_def,
|
||||||
slowness_def, leaping_def, poison_def, regeneration_def,
|
slowness_def, leaping_def, withering_def, poison_def, regeneration_def,
|
||||||
invisibility_def, water_breathing_def, fire_resistance_def}
|
invisibility_def, water_breathing_def, fire_resistance_def}
|
||||||
|
|
||||||
for _, def in ipairs(defs) do
|
for _, def in ipairs(defs) do
|
||||||
|
|
|
@ -110,7 +110,7 @@ function mcl_potions.register_splash(name, descr, color, def)
|
||||||
for _,obj in pairs(minetest.get_objects_inside_radius(pos, 4)) do
|
for _,obj in pairs(minetest.get_objects_inside_radius(pos, 4)) do
|
||||||
|
|
||||||
local entity = obj:get_luaentity()
|
local entity = obj:get_luaentity()
|
||||||
if obj:is_player() or entity.is_mob then
|
if obj:is_player() or entity and entity.is_mob then
|
||||||
|
|
||||||
local pos2 = obj:get_pos()
|
local pos2 = obj:get_pos()
|
||||||
local rad = math.floor(math.sqrt((pos2.x-pos.x)^2 + (pos2.y-pos.y)^2 + (pos2.z-pos.z)^2))
|
local rad = math.floor(math.sqrt((pos2.x-pos.x)^2 + (pos2.y-pos.y)^2 + (pos2.z-pos.z)^2))
|
||||||
|
|
|
@ -6,9 +6,9 @@ local C = minetest.colorize
|
||||||
|
|
||||||
mcl_smithing_table = {}
|
mcl_smithing_table = {}
|
||||||
|
|
||||||
---Function to upgrade diamond tool/armor to netherite tool/armor
|
-- Function to upgrade diamond tool/armor to netherite tool/armor
|
||||||
---@param itemstack ItemStack
|
---@param itemstack ItemStack
|
||||||
function mcl_smithing_table.upgrade_item(itemstack)
|
function mcl_smithing_table.upgrade_item_netherite(itemstack)
|
||||||
local def = itemstack:get_definition()
|
local def = itemstack:get_definition()
|
||||||
|
|
||||||
if not def or not def._mcl_upgradable then
|
if not def or not def._mcl_upgradable then
|
||||||
|
@ -22,6 +22,7 @@ function mcl_smithing_table.upgrade_item(itemstack)
|
||||||
end
|
end
|
||||||
|
|
||||||
itemstack:set_name(upgrade_item)
|
itemstack:set_name(upgrade_item)
|
||||||
|
mcl_armor.reload_trim_inv_image(itemstack)
|
||||||
|
|
||||||
-- Reload the ToolTips of the tool
|
-- Reload the ToolTips of the tool
|
||||||
|
|
||||||
|
@ -40,14 +41,18 @@ local formspec = table.concat({
|
||||||
"image[0.875,0.375;1.75,1.75;mcl_smithing_table_inventory_hammer.png]",
|
"image[0.875,0.375;1.75,1.75;mcl_smithing_table_inventory_hammer.png]",
|
||||||
|
|
||||||
mcl_formspec.get_itemslot_bg_v4(1.625, 2.6, 1, 1),
|
mcl_formspec.get_itemslot_bg_v4(1.625, 2.6, 1, 1),
|
||||||
"list[context;diamond_item;1.625,2.6;1,1;]",
|
"list[context;upgrade_item;1.625,2.6;1,1;]",
|
||||||
|
|
||||||
"image[3.5,2.6;1,1;mcl_anvils_inventory_cross.png]",
|
"image[3.125,2.6;1,1;mcl_anvils_inventory_cross.png]",
|
||||||
|
|
||||||
mcl_formspec.get_itemslot_bg_v4(5.375, 2.6, 1, 1),
|
mcl_formspec.get_itemslot_bg_v4(4.75, 2.6, 1, 1),
|
||||||
"list[context;netherite;5.375,2.6;1,1;]",
|
"list[context;mineral;4.75,2.6;1,1;]",
|
||||||
|
|
||||||
"image[6.75,2.6;2,1;mcl_anvils_inventory_arrow.png]",
|
mcl_formspec.get_itemslot_bg_v4(6, 2.6, 1, 1),
|
||||||
|
mcl_formspec.get_itemslot_bg_v4(6, 2.6, 1, 1, 0, "mcl_smithing_table_inventory_trim_bg.png"),
|
||||||
|
"list[context;template;6,2.6;1,1;]",
|
||||||
|
|
||||||
|
"image[7,2.6;2,1;mcl_anvils_inventory_arrow.png]",
|
||||||
|
|
||||||
mcl_formspec.get_itemslot_bg_v4(9.125, 2.6, 1, 1),
|
mcl_formspec.get_itemslot_bg_v4(9.125, 2.6, 1, 1),
|
||||||
"list[context;upgraded_item;9.125,2.6;1,1;]",
|
"list[context;upgraded_item;9.125,2.6;1,1;]",
|
||||||
|
@ -62,23 +67,60 @@ local formspec = table.concat({
|
||||||
|
|
||||||
-- Listrings
|
-- Listrings
|
||||||
|
|
||||||
"listring[context;diamond_item]",
|
"listring[context;upgrade_item]",
|
||||||
"listring[current_player;main]",
|
"listring[current_player;main]",
|
||||||
"listring[context;netherite]",
|
"listring[context;mineral]",
|
||||||
"listring[current_player;main]",
|
"listring[current_player;main]",
|
||||||
"listring[context;upgraded_item]",
|
"listring[context;upgraded_item]",
|
||||||
"listring[current_player;main]",
|
"listring[current_player;main]",
|
||||||
"listring[current_player;main]",
|
"listring[current_player;main]",
|
||||||
"listring[context;diamond_item]",
|
"listring[context;upgrade_item]",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local smithing_materials = {
|
||||||
|
["mcl_nether:netherite_ingot"] = "netherite",
|
||||||
|
["mcl_core:diamond"] = "diamond",
|
||||||
|
["mcl_core:lapis"] = "lapis",
|
||||||
|
["mcl_amethyst:amethyst_shard"] = "amethyst",
|
||||||
|
["mesecons:wire_00000000_off"] = "redstone",
|
||||||
|
["mcl_core:iron_ingot"] = "iron",
|
||||||
|
["mcl_core:gold_ingot"] = "gold",
|
||||||
|
["mcl_copper:copper_ingot"] = "copper",
|
||||||
|
["mcl_core:emerald"] = "emerald",
|
||||||
|
["mcl_nether:quartz"] = "quartz"
|
||||||
|
}
|
||||||
|
|
||||||
|
function mcl_smithing_table.upgrade_trimmed(itemstack, color_mineral, template)
|
||||||
|
--get information required
|
||||||
|
local material_name = color_mineral:get_name()
|
||||||
|
material_name = smithing_materials[material_name]
|
||||||
|
|
||||||
|
local overlay = template:get_name():gsub("mcl_armor:","")
|
||||||
|
|
||||||
|
--trimming process
|
||||||
|
mcl_armor.trim(itemstack, overlay, material_name)
|
||||||
|
tt.reload_itemstack_description(itemstack)
|
||||||
|
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
function mcl_smithing_table.is_smithing_mineral(itemname)
|
||||||
|
return smithing_materials[itemname] ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
---@param pos Vector
|
---@param pos Vector
|
||||||
local function reset_upgraded_item(pos)
|
local function reset_upgraded_item(pos)
|
||||||
local inv = minetest.get_meta(pos):get_inventory()
|
local inv = minetest.get_meta(pos):get_inventory()
|
||||||
local upgraded_item
|
local upgraded_item
|
||||||
|
local original_itemname = inv:get_stack("upgrade_item", 1):get_name()
|
||||||
|
local template_present = inv:get_stack("template",1):get_name() ~= ""
|
||||||
|
local is_armor = original_itemname:find("mcl_armor:") ~= nil
|
||||||
|
local is_trimmed = original_itemname:find("_trimmed") ~= nil
|
||||||
|
|
||||||
if inv:get_stack("netherite", 1):get_name() == "mcl_nether:netherite_ingot" then
|
if inv:get_stack("mineral", 1):get_name() == "mcl_nether:netherite_ingot" and not template_present then
|
||||||
upgraded_item = mcl_smithing_table.upgrade_item(inv:get_stack("diamond_item", 1))
|
upgraded_item = mcl_smithing_table.upgrade_item_netherite(inv:get_stack("upgrade_item", 1))
|
||||||
|
elseif template_present and is_armor and not is_trimmed and mcl_smithing_table.is_smithing_mineral(inv:get_stack("mineral", 1):get_name()) then
|
||||||
|
upgraded_item = mcl_smithing_table.upgrade_trimmed(inv:get_stack("upgrade_item", 1),inv:get_stack("mineral", 1),inv:get_stack("template", 1))
|
||||||
end
|
end
|
||||||
|
|
||||||
inv:set_stack("upgraded_item", 1, upgraded_item)
|
inv:set_stack("upgraded_item", 1, upgraded_item)
|
||||||
|
@ -107,14 +149,24 @@ minetest.register_node("mcl_smithing_table:table", {
|
||||||
|
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
|
|
||||||
inv:set_size("diamond_item", 1)
|
inv:set_size("upgrade_item", 1)
|
||||||
inv:set_size("netherite", 1)
|
inv:set_size("mineral", 1)
|
||||||
|
inv:set_size("template",1)
|
||||||
inv:set_size("upgraded_item", 1)
|
inv:set_size("upgraded_item", 1)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
if listname == "diamond_item" and mcl_smithing_table.upgrade_item(stack) or
|
if
|
||||||
listname == "netherite" and stack:get_name() == "mcl_nether:netherite_ingot" then
|
listname == "upgrade_item"
|
||||||
|
and string.find(stack:get_name(),"mcl_armor:") -- allow any armor piece to go in (in case the player wants to trim them)
|
||||||
|
and not mcl_armor.trims.blacklisted[stack:get_name()]
|
||||||
|
|
||||||
|
or listname == "mineral"
|
||||||
|
and mcl_smithing_table.is_smithing_mineral(stack:get_name())
|
||||||
|
|
||||||
|
or listname == "template"
|
||||||
|
and string.find(stack:get_name(),"mcl_armor")
|
||||||
|
then
|
||||||
return stack:get_count()
|
return stack:get_count()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -137,8 +189,9 @@ minetest.register_node("mcl_smithing_table:table", {
|
||||||
end
|
end
|
||||||
|
|
||||||
if listname == "upgraded_item" then
|
if listname == "upgraded_item" then
|
||||||
take_item("diamond_item")
|
take_item("upgrade_item")
|
||||||
take_item("netherite")
|
take_item("mineral")
|
||||||
|
take_item("template")
|
||||||
|
|
||||||
-- ToDo: make epic sound
|
-- ToDo: make epic sound
|
||||||
minetest.sound_play("mcl_smithing_table_upgrade", { pos = pos, max_hear_distance = 16 })
|
minetest.sound_play("mcl_smithing_table_upgrade", { pos = pos, max_hear_distance = 16 })
|
||||||
|
@ -165,3 +218,8 @@ minetest.register_craft({
|
||||||
{ "group:wood", "group:wood", "" }
|
{ "group:wood", "group:wood", "" }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- this is the exact same as mcl_smithing_table.upgrade_item_netherite , in case something relies on the old function
|
||||||
|
function mcl_smithing_table.upgrade_item(itemstack)
|
||||||
|
return mcl_smithing_table.upgrade_item_netherite(itemstack)
|
||||||
|
end
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
name = mcl_smithing_table
|
name = mcl_smithing_table
|
||||||
depends = mcl_colors, mcl_formspec, mcl_anvils
|
depends = mcl_colors, mcl_formspec, mcl_armor, mcl_anvils
|
||||||
|
|
|
@ -188,6 +188,7 @@ mcl_structures.register_structure("nether_bulwark",{
|
||||||
stacks_max = 1,
|
stacks_max = 1,
|
||||||
items = {
|
items = {
|
||||||
{ itemstring = "mcl_compass:lodestone" },
|
{ itemstring = "mcl_compass:lodestone" },
|
||||||
|
{ itemstring = "mcl_armor:rib" },
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
},
|
},
|
||||||
|
|
|
@ -69,6 +69,7 @@ mcl_structures.register_structure("desert_temple",{
|
||||||
{ itemstring = "mcl_mobitems:diamond_horse_armor", weight = 5, },
|
{ itemstring = "mcl_mobitems:diamond_horse_armor", weight = 5, },
|
||||||
{ itemstring = "mcl_core:diamond", weight = 5, amount_min = 1, amount_max = 3 },
|
{ itemstring = "mcl_core:diamond", weight = 5, amount_min = 1, amount_max = 3 },
|
||||||
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 2, },
|
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 2, },
|
||||||
|
{ itemstring = "mcl_armor:dune", weight = 20, amount_min = 2, amount_max = 2},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,6 +58,7 @@ mcl_structures.register_structure("end_shipwreck",{
|
||||||
{ itemstring = "mcl_core:diamond", weight = 3, amount_min = 2, amount_max = 7 },
|
{ itemstring = "mcl_core:diamond", weight = 3, amount_min = 2, amount_max = 7 },
|
||||||
{ itemstring = "mcl_mobitems:saddle", weight = 3, },
|
{ itemstring = "mcl_mobitems:saddle", weight = 3, },
|
||||||
{ itemstring = "mcl_core:emerald", weight = 2, amount_min = 1, amount_max = 3 },
|
{ itemstring = "mcl_core:emerald", weight = 2, amount_min = 1, amount_max = 3 },
|
||||||
|
{ itemstring = "mcl_armor:spire", amount_min = 1, amount_max = 1 },
|
||||||
{ itemstring = "mcl_books:book", weight = 1, func = function(stack, pr)
|
{ itemstring = "mcl_books:book", weight = 1, func = function(stack, pr)
|
||||||
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr)
|
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr)
|
||||||
end },
|
end },
|
||||||
|
|
|
@ -38,6 +38,7 @@ mcl_structures.register_structure("jungle_temple",{
|
||||||
{ itemstring = "mcl_mobitems:gold_horse_armor", weight = 1, },
|
{ itemstring = "mcl_mobitems:gold_horse_armor", weight = 1, },
|
||||||
{ itemstring = "mcl_mobitems:diamond_horse_armor", weight = 1, },
|
{ itemstring = "mcl_mobitems:diamond_horse_armor", weight = 1, },
|
||||||
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 2, },
|
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 2, },
|
||||||
|
{ itemstring = "mcl_armor:wild", amount_min = 1, amount_max = 1, },
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ mcl_structures.register_structure("pillager_outpost",{
|
||||||
{ itemstring = "mcl_books:book", weight = 1, func = function(stack, pr)
|
{ itemstring = "mcl_books:book", weight = 1, func = function(stack, pr)
|
||||||
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr)
|
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr)
|
||||||
end },
|
end },
|
||||||
|
{ itemstring = "mcl_armor:sentry"},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -166,7 +166,7 @@ mcl_structures.register_structure("shipwreck",{
|
||||||
{ itemstring = "mcl_clock:clock", weight = 1, amount_min = 1, amount_max = 1 },
|
{ itemstring = "mcl_clock:clock", weight = 1, amount_min = 1, amount_max = 1 },
|
||||||
{ itemstring = "mcl_compass:compass", weight = 1, amount_min = 1, amount_max = 1 },
|
{ itemstring = "mcl_compass:compass", weight = 1, amount_min = 1, amount_max = 1 },
|
||||||
{ itemstring = "mcl_maps:empty_map", weight = 1, amount_min = 1, amount_max = 1 },
|
{ itemstring = "mcl_maps:empty_map", weight = 1, amount_min = 1, amount_max = 1 },
|
||||||
|
{ itemstring = "mcl_armor:coast", weight = 20, amount_min = 2, amount_max = 2},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,7 @@ mcl_structures.register_structure("woodland_cabin",{
|
||||||
{ itemstring = "mcl_armor:chestplate_chain", weight = 1, },
|
{ itemstring = "mcl_armor:chestplate_chain", weight = 1, },
|
||||||
{ itemstring = "mcl_armor:chestplate_diamond", weight = 1, },
|
{ itemstring = "mcl_armor:chestplate_diamond", weight = 1, },
|
||||||
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 2, },
|
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 2, },
|
||||||
|
{ itemstring = "mcl_armor:vex", amount_max = 1, },
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,27 +154,27 @@ end
|
||||||
|
|
||||||
local player_props_elytra = {
|
local player_props_elytra = {
|
||||||
collisionbox = { -0.35, 0, -0.35, 0.35, 0.8, 0.35 },
|
collisionbox = { -0.35, 0, -0.35, 0.35, 0.8, 0.35 },
|
||||||
eye_height = 0.5,
|
eye_height = 0.6,
|
||||||
nametag_color = { r = 225, b = 225, a = 225, g = 225 }
|
nametag_color = { r = 225, b = 225, a = 225, g = 225 }
|
||||||
}
|
}
|
||||||
local player_props_riding = {
|
local player_props_riding = {
|
||||||
collisionbox = { -0.312, 0, -0.312, 0.312, 1.8, 0.312 },
|
collisionbox = { -0.312, 0, -0.312, 0.312, 1.8, 0.312 },
|
||||||
eye_height = 1.5,
|
eye_height = 1.6,
|
||||||
nametag_color = { r = 225, b = 225, a = 225, g = 225 }
|
nametag_color = { r = 225, b = 225, a = 225, g = 225 }
|
||||||
}
|
}
|
||||||
local player_props_sneaking = {
|
local player_props_sneaking = {
|
||||||
collisionbox = { -0.312, 0, -0.312, 0.312, 1.8, 0.312 },
|
collisionbox = { -0.312, 0, -0.312, 0.312, 1.8, 0.312 },
|
||||||
eye_height = 1.35,
|
eye_height = 1.45,
|
||||||
nametag_color = { r = 225, b = 225, a = 0, g = 225 }
|
nametag_color = { r = 225, b = 225, a = 0, g = 225 }
|
||||||
}
|
}
|
||||||
local player_props_swimming = {
|
local player_props_swimming = {
|
||||||
collisionbox = { -0.312, 0, -0.312, 0.312, 0.8, 0.312 },
|
collisionbox = { -0.312, 0, -0.312, 0.312, 0.8, 0.312 },
|
||||||
eye_height = 0.5,
|
eye_height = 0.6,
|
||||||
nametag_color = { r = 225, b = 225, a = 225, g = 225 }
|
nametag_color = { r = 225, b = 225, a = 225, g = 225 }
|
||||||
}
|
}
|
||||||
local player_props_normal = {
|
local player_props_normal = {
|
||||||
collisionbox = { -0.312, 0, -0.312, 0.312, 1.8, 0.312 },
|
collisionbox = { -0.312, 0, -0.312, 0.312, 1.8, 0.312 },
|
||||||
eye_height = 1.5,
|
eye_height = 1.6,
|
||||||
nametag_color = { r = 225, b = 225, a = 225, g = 225 }
|
nametag_color = { r = 225, b = 225, a = 225, g = 225 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
This mod allows advanced skin customization.
|
This mod allows advanced skin customization.
|
||||||
Use the /skin command to open the skin configuration screen.
|
Use the /skin command to open the skin configuration screen.
|
||||||
|
|
||||||
To include custom skins in MineClone2, please download [mcl_custom_skins](https://git.minetest.land/mineclone2/mcl_custom_skins)
|
To include custom skins in MineClone2, please download the [mcl_custom_skins](https://codeberg.org/MineClone2/mcl_custom_skins) mod.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
Code under MIT license
|
Code under MIT license
|
||||||
|
|
|
@ -76,6 +76,7 @@ local node_search_list =
|
||||||
|
|
||||||
local success = storage:get_int("mcl_spawn_success")==1
|
local success = storage:get_int("mcl_spawn_success")==1
|
||||||
local searched = (storage:get_int("mcl_spawn_searched")==1) or mg_name == "v6" or mg_name == "singlenode" or minetest.settings:get("static_spawnpoint")
|
local searched = (storage:get_int("mcl_spawn_searched")==1) or mg_name == "v6" or mg_name == "singlenode" or minetest.settings:get("static_spawnpoint")
|
||||||
|
local return_spawn = minetest.settings:get_bool("mcl_return_spawn", true)
|
||||||
local wsp = minetest.string_to_pos(storage:get_string("mcl_spawn_world_spawn_point")) or {} -- world spawn position
|
local wsp = minetest.string_to_pos(storage:get_string("mcl_spawn_world_spawn_point")) or {} -- world spawn position
|
||||||
local check = storage:get_int("mcl_spawn_check") or 0
|
local check = storage:get_int("mcl_spawn_check") or 0
|
||||||
local cp = minetest.string_to_pos(storage:get_string("mcl_spawn_cp")) or {x=start_pos.x, y=start_pos.y, z=start_pos.z}
|
local cp = minetest.string_to_pos(storage:get_string("mcl_spawn_cp")) or {x=start_pos.x, y=start_pos.y, z=start_pos.z}
|
||||||
|
@ -498,7 +499,7 @@ function mcl_spawn.get_player_spawn_pos(player)
|
||||||
|
|
||||||
if(string.match(checknode.name, "mcl_beds:respawn_anchor_charged_")) then
|
if(string.match(checknode.name, "mcl_beds:respawn_anchor_charged_")) then
|
||||||
local charge_level = tonumber(string.sub(checknode.name, -1))
|
local charge_level = tonumber(string.sub(checknode.name, -1))
|
||||||
if not charge_level then
|
if not charge_level and return_spawn then
|
||||||
minetest.log("warning","could not get level of players respawn anchor, sending him back to spawn!")
|
minetest.log("warning","could not get level of players respawn anchor, sending him back to spawn!")
|
||||||
player:get_meta():set_string("mcl_beds:spawn", "")
|
player:get_meta():set_string("mcl_beds:spawn", "")
|
||||||
minetest.chat_send_player(player:get_player_name(), S("Couldn't get level of your respawn anchor!"))
|
minetest.chat_send_player(player:get_player_name(), S("Couldn't get level of your respawn anchor!"))
|
||||||
|
@ -510,10 +511,12 @@ function mcl_spawn.get_player_spawn_pos(player)
|
||||||
minetest.set_node(checkpos, {name="mcl_beds:respawn_anchor"})
|
minetest.set_node(checkpos, {name="mcl_beds:respawn_anchor"})
|
||||||
return checkpos, false
|
return checkpos, false
|
||||||
end
|
end
|
||||||
else
|
elseif return_spawn then
|
||||||
player:get_meta():set_string("mcl_beds:spawn", "")
|
player:get_meta():set_string("mcl_beds:spawn", "")
|
||||||
minetest.chat_send_player(player:get_player_name(), S("Your spawn bed was missing or blocked, and you had no charged respawn anchor!"))
|
minetest.chat_send_player(player:get_player_name(), S("Your spawn bed was missing or blocked, and you had no charged respawn anchor!"))
|
||||||
return mcl_spawn.get_world_spawn_pos(), false
|
return mcl_spawn.get_world_spawn_pos(), false
|
||||||
|
else
|
||||||
|
return checkpos, false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -51,6 +51,9 @@ mcl_disabled_events (Disabled events) string
|
||||||
# This setting is only read at startup.
|
# This setting is only read at startup.
|
||||||
enable_bed_respawn (Respawn at bed) bool true
|
enable_bed_respawn (Respawn at bed) bool true
|
||||||
|
|
||||||
|
#If enabled, players respawn at world spawn if bed is destroyed or respawn anchor has no charge.
|
||||||
|
mcl_return_spawn (Return to spawn if no bed) bool true
|
||||||
|
|
||||||
# How many players have to sleep to skip the night, in percent.
|
# How many players have to sleep to skip the night, in percent.
|
||||||
# Setting to 0 will mean 1 player is always enough to skip the night. Setting above 100 will prevent skipping the night.
|
# Setting to 0 will mean 1 player is always enough to skip the night. Setting above 100 will prevent skipping the night.
|
||||||
# 100 by default.
|
# 100 by default.
|
||||||
|
@ -163,6 +166,24 @@ mcl_mob_cap_axolotl (Mob cap axolotl) int 5 0 1024
|
||||||
#Maximum amount of ambient mobs that will spawn near a player (default:15)
|
#Maximum amount of ambient mobs that will spawn near a player (default:15)
|
||||||
mcl_mob_cap_ambient (Mob cap ambient mobs) int 15 0 1024
|
mcl_mob_cap_ambient (Mob cap ambient mobs) int 15 0 1024
|
||||||
|
|
||||||
|
#Maximum amount of wither bosses on the loaded mapchunks in the overworld that allows spawning withers in the overworld (default:3)
|
||||||
|
wither_cap_overworld (Wither cap overworld) int 3 0 2048
|
||||||
|
|
||||||
|
#Maximum amount of wither bosses on the loaded mapchunks in the nether that allows spawning withers in the nether (default:10)
|
||||||
|
wither_cap_nether (Wither cap nether) int 10 0 2048
|
||||||
|
|
||||||
|
#Maximum amount of wither bosses on the loaded mapchunks in the end that allows spawning withers in the end (default:5)
|
||||||
|
wither_cap_end (Wither cap end) int 5 0 2048
|
||||||
|
|
||||||
|
#Should wither follow the player who spawned him around
|
||||||
|
wither_follow_spawner (Wither following his spawner) bool false
|
||||||
|
|
||||||
|
#Should wither strafe while in combat
|
||||||
|
wither_strafes (Wither strafes) bool true
|
||||||
|
|
||||||
|
#Wither anti-troll measures (escaping when stuck in a block, despawning when spawner goes offline, teleporting after the spawner). When this is OFF, wither_follow_spawner has no effect.
|
||||||
|
wither_anti_troll_measures (Wither anti-troll measures) bool false
|
||||||
|
|
||||||
#Display mob icons in inventory instead of mc-like spawn eggs
|
#Display mob icons in inventory instead of mc-like spawn eggs
|
||||||
mcl_old_spawn_icons (Old spawn icons instead of eggs) bool false
|
mcl_old_spawn_icons (Old spawn icons instead of eggs) bool false
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 126 B |
After Width: | Height: | Size: 131 B |
After Width: | Height: | Size: 302 B |
After Width: | Height: | Size: 175 B |
After Width: | Height: | Size: 272 B |
After Width: | Height: | Size: 221 B |
After Width: | Height: | Size: 215 B |
After Width: | Height: | Size: 256 B |
After Width: | Height: | Size: 166 B |
After Width: | Height: | Size: 382 B |
After Width: | Height: | Size: 305 B |
After Width: | Height: | Size: 341 B |
After Width: | Height: | Size: 269 B |
After Width: | Height: | Size: 150 B |
After Width: | Height: | Size: 373 B |
After Width: | Height: | Size: 144 B |
After Width: | Height: | Size: 276 B |
After Width: | Height: | Size: 113 B |
After Width: | Height: | Size: 153 B |
After Width: | Height: | Size: 150 B |
After Width: | Height: | Size: 151 B |
After Width: | Height: | Size: 137 B |
After Width: | Height: | Size: 244 B |
After Width: | Height: | Size: 250 B |
After Width: | Height: | Size: 277 B |
After Width: | Height: | Size: 256 B |
After Width: | Height: | Size: 199 B |
After Width: | Height: | Size: 353 B |
After Width: | Height: | Size: 282 B |
After Width: | Height: | Size: 294 B |
After Width: | Height: | Size: 250 B |
After Width: | Height: | Size: 143 B |
After Width: | Height: | Size: 301 B |
After Width: | Height: | Size: 254 B |
After Width: | Height: | Size: 231 B |
After Width: | Height: | Size: 262 B |
After Width: | Height: | Size: 165 B |
After Width: | Height: | Size: 389 B |
After Width: | Height: | Size: 202 B |
After Width: | Height: | Size: 237 B |
After Width: | Height: | Size: 264 B |
After Width: | Height: | Size: 204 B |
After Width: | Height: | Size: 283 B |
After Width: | Height: | Size: 233 B |
After Width: | Height: | Size: 260 B |
After Width: | Height: | Size: 265 B |
After Width: | Height: | Size: 162 B |