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

[Fix Issue #11] Rotten flesh has more uses

This commit is contained in:
sys4-fr 2018-01-07 04:02:07 +01:00
parent 6a6cc58506
commit b5e8b52218
7 changed files with 161 additions and 88 deletions

View File

@ -26,3 +26,4 @@ mtfoods?
mush45?
mushroom?
seaplants?
pclasses?

View File

@ -20,6 +20,11 @@ HUNGER_EXHAUST_PLACE = 1 -- exhaustion increased this value after placed
HUNGER_EXHAUST_MOVE = 0.3 -- exhaustion increased this value if player movement detected
HUNGER_EXHAUST_LVL = 160 -- at what exhaustion player satiation gets lowerd
-- NALC : Fix MFF pclasses behaviour
local pc = false
if minetest.get_modpath("pclasses") and pclasses then
pc = true
end
--load custom settings
local set = io.open(minetest.get_modpath("hbhunger").."/hbhunger.conf", "r")
@ -106,13 +111,14 @@ local function hunger_step()
local hp = player:get_hp()
local timerquot = 1 -- By default regen 0.5 hearth every 10sec
if pclasses.api.get_player_class(name) == "warrior" then
timerquot = 1.42 -- Black_Mithril armor = 0.5 hearth every 7.0sec
elseif pclasses.api.util.does_wear_full_armor(name, "mithril", false) then
timerquot = 1.17 -- Mithril armor = 0.5 hearth every 8.5sec
if pc then -- NALC : Fix MFF modif
if pclasses.api.get_player_class(name) == "warrior" then
timerquot = 1.42 -- Black_Mithril armor = 0.5 hearth every 7.0sec
elseif pclasses.api.util.does_wear_full_armor(name, "mithril", false) then
timerquot = 1.17 -- Mithril armor = 0.5 hearth every 8.5sec
end
end
if timer > 10/timerquot then
-- heal player by 1 hp if not dead and satiation is > 15 (of 30)
if h > 15 and hp > 0 and player:get_breath() > 0 then

@ -1 +1 @@
Subproject commit 71aa7b6d83f3e7edeac72678eedbeb002cd639e6
Subproject commit 2e77df9a8cee745ac2ce28a2aaa4fb4e3bfe02d2

View File

@ -1,2 +1,4 @@
default
mobs
mobs
maptools?
zombie?

View File

@ -1,10 +1,19 @@
-- Wolf by KrupnoPavel
local drop_coin = nil -- NALC : Drop silver coin by chance if maptools mod loaded
if minetest.get_modpath("maptools") then
drop_coin = {
name = "maptools:silver_coin",
chance = 4, min = 1, max = 1,
}
end
mobs:register_mob(
"pmobs:wolf",
{
type = "monster",
docile_by_day = true,
passive = false,
pathfinding = false,
reach = 2,
@ -30,21 +39,23 @@ mobs:register_mob(
damage = 3,
attack_type = "dogfight",
drops = {
{name = "mobs:meat_raw",
chance = 1,
min = 2,
max = 3,},
{name = "maptools:silver_coin",
chance = 4, min = 1, max = 1,},
{
name = "mobs:meat_raw",
chance = 1,
min = 2,
max = 3,
},
drop_coin -- NALC
},
drawtype = "front",
water_damage = 0,
lava_damage = 5,
light_damage = 0,
on_rightclick = function(self, clicker)
local tool = clicker:get_wielded_item()
if tool:get_name() == "mobs:meat_raw" then
clicker:get_inventory():remove_item("main", "mobs:meat_raw")
local tool = clicker:get_wielded_item():get_name()
if tool == "mobs:meat_raw" or
(minetest.get_modpath("zombie") and tool == "zombie:rotten_flesh") then
clicker:get_inventory():remove_item("main", tool)
minetest.add_entity(self.object:getpos(), "pmobs:dog")
self.object:remove()
end

View File

@ -1,2 +1,5 @@
default
mobs
mobs
nether?
maptools?
hbhunger?

View File

@ -1,81 +1,131 @@
-- Zombie by BlockMen
mobs:register_mob("zombie:zombie", {
-- animal, monster, npc, barbarian
type = "monster",
-- aggressive, deals 6 damage to player when hit
passive = false,
attack_type = "dogfight",
pathfinding = false,
damage = 3,
-- health & armor
hp_min = 12,
hp_max = 35,
armor = 150,
-- textures and model
collisionbox = {-0.25, -1, -0.3, 0.25, 0.75, 0.3},
visual = "mesh",
mesh = "mobs_zombie.x",
textures = {
{"mobs_zombie.png"},
},
visual_size = {x=1, y=1},
blood_texture = "mobs_blood.png",
-- sounds
makes_footstep_sound = true,
sounds = {
random = "mobs_zombie",
damage = "mobs_zombie_hit",
attack = "mobs_zombie_attack",
death = "mobs_zombie_death",
},
-- speed and jump
view_range = 10,
walk_velocity = 1,
run_velocity = 3,
jump = true,
floats = 0,
-- drops nether fruit and silver coin when dead
drops = {
{name = "nether:apple",
chance = 2, min = 1, max = 2,},
{name = "zombie:zombie_tibia",
chance = 10, min = 1, max = 1,},
{name = "maptools:silver_coin",
chance = 1, min = 1, max = 1,},
{name = "zombie:rotten_flesh",
chance = 2, min = 3, max = 5,},
},
-- damaged by
water_damage = 1,
lava_damage = 5,
light_damage = 2,
-- model animation
animation = {
speed_normal = 10, speed_run = 15,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 188,
run_start = 168, run_end = 188,
-- punch_start = 168, punch_end = 188,
},
})
local drop_coin = nil -- NALC : Drop silver coin if maptools mod
local drop_napple = nil -- NALC : Drop nether apple if nether
if minetest.get_modpath("maptools") then
drop_coin = {
name = "maptools:silver_coin",
chance = 1, min = 1, max = 1
}
end
if minetest.get_modpath("nether") then
drop_napple = {
name = "nether:apple",
chance = 8, min = 1, max = 1
}
end
mobs:register_mob(
"zombie:zombie",
{
-- animal, monster, npc, barbarian
type = "monster",
-- aggressive, deals 6 damage to player when hit
passive = false,
attack_type = "dogfight",
pathfinding = false,
damage = 3,
-- health & armor
hp_min = 12,
hp_max = 35,
armor = 150,
-- textures and model
collisionbox = {-0.25, -1, -0.3, 0.25, 0.75, 0.3},
visual = "mesh",
mesh = "mobs_zombie.x",
textures = {
{"mobs_zombie.png"},
},
visual_size = {x=1, y=1},
blood_texture = "mobs_blood.png",
-- sounds
makes_footstep_sound = true,
sounds = {
random = "mobs_zombie",
damage = "mobs_zombie_hit",
attack = "mobs_zombie_attack",
death = "mobs_zombie_death",
},
-- speed and jump
view_range = 10,
walk_velocity = 1,
run_velocity = 3,
jump = true,
floats = 0,
-- drops nether fruit and silver coin when dead
drops = {
{name = "zombie:rotten_flesh",
chance = 2, min = 3, max = 5,},
{name = "zombie:zombie_tibia",
chance = 10, min = 1, max = 1,},
drop_napple, -- NALC
drop_coin -- NALC
},
-- damaged by
water_damage = 1,
lava_damage = 5,
light_damage = 2,
-- model animation
animation = {
speed_normal = 10, speed_run = 15,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 188,
run_start = 168, run_end = 188,
-- punch_start = 168, punch_end = 188,
},
})
mobs:alias_mob("mobs:zombie", "zombie:zombie")
-- spawn in nether forest between -1 and 5 light, 1 in 7000 change, 1 zombie in area up to 31000 in height
mobs:spawn_specific("zombie:zombie", {"nether:dirt_top", "default:dirt_with_grass", "default:stone"}, {"air"}, -1, 5, 30, 7000, 1, -31000, 31000, false)
-- spawn in nether forest between -1 and 5 light, 1 in 7000 chance, 1 zombie in area up to 31000 in height
mobs:spawn_specific("zombie:zombie", {"nether:dirt_top", "default:dirt_with_grass", "default:dirt", "default:stone"}, {"air"}, -1, 5, 30, 7000, 1, -31000, 31000, false)
-- register spawn egg
mobs:register_egg("zombie:zombie", "Zombie", "mobs_zombie_inv.png", 1)
minetest.register_craftitem("zombie:zombie_tibia", {
description = "Zombie Tibia",
inventory_image = "mobs_zombie_tibia.png",
groups = {magic = 1},
})
minetest.register_craftitem(
"zombie:zombie_tibia",
{
description = "Zombie Tibia",
inventory_image = "mobs_zombie_tibia.png",
groups = {magic = 1},
})
minetest.register_alias("mobs:zombie_tibia", "zombie:zombie_tibia")
minetest.register_craftitem("zombie:rotten_flesh", {
description = "Rotten Flesh",
inventory_image = "mobs_rotten_flesh.png",
on_use = minetest.item_eat(1),
minetest.register_craftitem(
"zombie:rotten_flesh",
{
description = "Rotten Flesh",
inventory_image = "mobs_rotten_flesh.png",
on_use = function(itemstack, user) -- NALC : Augmente la faim de 5 points mais augmente la vie de 1 point
local inv = user:get_inventory()
if not inv then return end
itemstack:take_item()
-- Augmente la vie de 1 point
user:set_hp(user:get_hp() + 1)
-- Si hbhunger alors augmente la faim de 5 points (Réduction de la barre de faim)
if minetest.get_modpath("hbhunger") then
local p_hunger = tonumber(hbhunger.hunger[user:get_player_name()])
if not p_hunger then return end
p_hunger = p_hunger - 5
if p_hunger < 0 then p_hunger = 0 end
hbhunger.hunger[user:get_player_name()] = p_hunger
local save_hunger = hbhunger.save_hunger
if not save_hunger then save_hunger = hbhunger.set_hunger end
save_hunger(user)
end
return itemstack
end
})
minetest.register_craft({
type = "cooking",
output = "mobs:meat",
recipe = "zombie:rotten_flesh",
cooktime = 5,
})