added mob_difficulty config setting

This commit is contained in:
TenPlus1 2016-09-28 19:27:43 +01:00
parent 5df8e9054e
commit a455395a96
3 changed files with 10 additions and 7 deletions

12
api.lua
View File

@ -1,5 +1,5 @@
-- Mobs Api (26th September 2016)
-- Mobs Api (28th September 2016)
mobs = {}
mobs.mod = "redo"
@ -39,6 +39,7 @@ local disable_blood = minetest.setting_getbool("mobs_disable_blood")
local creative = minetest.setting_getbool("creative_mode")
local spawn_protected = tonumber(minetest.setting_get("mobs_spawn_protected")) or 1
local remove_far = minetest.setting_getbool("remove_far_mobs")
local difficulty = tonumber(minetest.setting_get("mob_difficulty")) or 1.0
-- pathfinding settings
local enable_pathfinding = true
@ -361,7 +362,8 @@ function check_for_death(self)
if self.on_die then
self.on_die(self, pos)
self.object:remove()
self.object:remove()
return true
end
@ -2281,8 +2283,8 @@ minetest.register_entity(name, {
drawtype = def.drawtype, -- DEPRECATED, use rotate instead
rotate = math.rad(def.rotate or 0), -- 0=front, 90=side, 180=back, 270=side2
lifetimer = def.lifetimer or 180, -- 3 minutes
hp_min = def.hp_min or 5,
hp_max = def.hp_max or 10,
hp_min = (def.hp_min or 5) * difficulty,
hp_max = (def.hp_max or 10) * difficulty,
physical = true,
collisionbox = def.collisionbox,
visual = def.visual,
@ -2292,7 +2294,7 @@ minetest.register_entity(name, {
view_range = def.view_range or 5,
walk_velocity = def.walk_velocity or 1,
run_velocity = def.run_velocity or 2,
damage = def.damage or 0,
damage = (def.damage or 0) * difficulty,
light_damage = def.light_damage or 0,
water_damage = def.water_damage or 0,
lava_damage = def.lava_damage or 0,

View File

@ -1,5 +1,5 @@
MOB API (26th September 2016)
MOB API (28th September 2016)
The mob api is a function that can be called on by other mods to add new animals or monsters into minetest.
@ -11,6 +11,7 @@ The mob api is a function that can be called on by other mods to add new animals
'mobs_spawn_protected' if set to 1 then mobs will not spawn in protected areas (default is 0)
'remove_far_mobs' if true then mobs that are outside players visual range will be removed (default is false)
'mobname_chance' can change specific mob chance rates or set to 0 to disable e.g. mobs_animal:cow_chance = 1000
'mob_difficulty' sets difficulty level (health and hit damage multiplied by this number), defaults to 1.0.
mobs:register_mob(name, definition)

View File

@ -20,7 +20,7 @@ Crafts:
Changelog:
- 1.31- Added 'attack_animals' and 'specific_attack' flags for custom monster attacks.
- 1.31- Added 'attack_animals' and 'specific_attack' flags for custom monster attacks, also 'mob_difficulty' .conf setting to make mobs harder.
- 1.30- Added support for invisibility mod (mobs cant attack what they cant see), tweaked and tidied code
- 1.29- Split original Mobs Redo into a modpack to make it easier to disable mob sets (animal, monster, npc) or simply use the Api itself for your own mod
- 1.28- New damage system added with ability for mob to be immune to weapons or healed by them :)