mobs_redo update and burning mobs
parent
222620c783
commit
170a07ebb7
|
@ -153,7 +153,7 @@ mobs:register_mob("mobs_m:mammoth", {
|
|||
hp_min = 50,
|
||||
hp_max = 60,
|
||||
armor = 100,
|
||||
collisionbox = {-1.1, 0, -1.1, 1.1, 2.1, 1.1},
|
||||
collisionbox = {-1.6, 0, -1.6, 1.6, 3.3, 1.6},
|
||||
visual = "mesh",
|
||||
mesh = "mammoth.b3d",
|
||||
textures = {
|
||||
|
@ -213,12 +213,12 @@ mobs:register_mob("mobs_m:elephant", {
|
|||
hp_min = 50,
|
||||
hp_max = 550,
|
||||
armor = 100,
|
||||
collisionbox = {-1.6, 0, -1.6, 1.6, 3.3, 1.6},
|
||||
visual = "mesh",
|
||||
mesh = "elephant.b3d",
|
||||
textures = {
|
||||
{"mobs_elephant.png"},
|
||||
},
|
||||
collisionbox = {-1.1, 0, -1.1, 1.1, 2.1, 1.1},
|
||||
blood_texture = "mobs_blood.png",
|
||||
makes_footstep_sound = true,
|
||||
walk_velocity = 1,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
|
||||
MOB API (31st January 2017)
|
||||
MOB API (12th May 2017)
|
||||
|
||||
The mob api is a function that can be called on by other mods to add new animals or monsters into minetest.
|
||||
|
||||
|
@ -25,6 +25,7 @@ This functions registers a new mob as a Minetest entity.
|
|||
'docile_by_day' when true, mob will not attack during daylight hours unless provoked
|
||||
'attacks_monsters' usually for npc's to attack monsters in area
|
||||
'group_attack' true to defend same kind of mobs from attack in area
|
||||
'owner_loyal' when true owned mobs will attack any monsters you punch
|
||||
'attack_animals' true for monster to attack animals as well as player and npc's
|
||||
'specific_attack' has a table of entity names that monsters can attack {"player", "mobs_animal:chicken"}
|
||||
'hp_min' minimum health
|
||||
|
@ -42,14 +43,13 @@ This functions registers a new mob as a Minetest entity.
|
|||
'makes_footstep_sound' same is in minetest.register_entity()
|
||||
'follow' item when held will cause mob to follow player, can be single string "default:apple" or table {"default:apple", "default:diamond"}
|
||||
'view_range' the range in that the monster will see the playerand follow him
|
||||
'walk_chance' chance of mob walking around
|
||||
'jump_chance' chance of mob jumping around, set above to 0 for jumping mob only
|
||||
'walk_chance' chance of mob walking around, set above to 0 for jumping mob only
|
||||
'walk_velocity' the velocity when the monster is walking around
|
||||
'run_velocity' the velocity when the monster is attacking a player
|
||||
'runaway' when true mob will turn and run away when punched
|
||||
'stepheight' minimum node height mob can walk onto without jumping (default: 0.6)
|
||||
'jump' can mob jump, true or false
|
||||
'jump_height' height mob can jump, default is 6
|
||||
'jump_height' height mob can jump, default is 6 (0 to disable jump)
|
||||
'fly' can mob fly, true or false (used for swimming mobs also)
|
||||
'fly_in' node name that mob flys inside, e.g "air", "default:water_source" for fish
|
||||
'damage' the damage per second
|
||||
|
@ -83,7 +83,8 @@ This functions registers a new mob as a Minetest entity.
|
|||
'explode' follows player in range and will flash and explode when in reach
|
||||
'dogshoot' shoots arrows when in range and one on one attack when in reach
|
||||
'dogshoot_switch' allows switching between shoot and dogfight modes inside dogshoot using timer (1 = shoot, 2 = dogfight)
|
||||
'dogshoot_count_max' number of seconds before switching above modes.
|
||||
'dogshoot_count_max' number of seconds before switching to dogfight mode.
|
||||
'dogshoot_count2_max' number of seconds before switching back to shoot mode.
|
||||
'custom_attack' is a function that is called when mob is in range to attack player, parameters are (self, to_attack)
|
||||
'double_melee_attack' if false then api will choose randomly between 'punch' and 'punch2' attack animations
|
||||
'on_blast' is called when TNT explodes near mob, function uses (object, damage) and returns (do_damage, do_knockback, drops)
|
||||
|
@ -102,35 +103,31 @@ This functions registers a new mob as a Minetest entity.
|
|||
'jump' sound when jumping
|
||||
'explode' sound when exploding
|
||||
'distance' maximum distance sounds are heard from (default is 10)
|
||||
'animation' a table with the animation ranges and speed of the model
|
||||
'stand_start' start frame of stand animation
|
||||
'stand_end' end frame of stand animation
|
||||
'walk_start' start frame of walk animation
|
||||
'walk_end' end frame of walk animation
|
||||
'run_start' start frame of run animation
|
||||
'run_end' end frame of run animation
|
||||
'punch_start' start frame of punch animation
|
||||
'punch_end' end frame of punch animation
|
||||
'punch2_start' start frame of alt.punch animation
|
||||
'punch2_end' end frame of alt.punch animation
|
||||
'shoot_start' start frame of shoot animation
|
||||
'shoot_end' end frame of shoot animation
|
||||
'die_start' start frame of die animation
|
||||
'die_end' end frame of die animation
|
||||
'speed_normal' normal animation speed
|
||||
'fly_start' start frame of fly animation
|
||||
'fly_end' end frame of fly animation
|
||||
'speed_run' running animation speed
|
||||
'speed_punch' punching animation speed
|
||||
'speed_punch2' alternative punching animation speed
|
||||
'speed_shoot' shooting animation speed
|
||||
'speed_die' die animation speed
|
||||
'speed_fly' fly animation speed
|
||||
|
||||
Mobs can look for specific nodes as they walk and replace them to mimic eating
|
||||
|
||||
'replace_what' group if items to replace e.g. {"farming:wheat_8", "farming:carrot_8"}
|
||||
'replace_with' replace with what e.g. "air" or in chickens case "mobs:egg"
|
||||
'replace_rate' how random should the replace rate be (typically 10)
|
||||
'replace_offset' +/- value to check specific node to replace
|
||||
|
||||
The 'replace_what' has been updated to use tables for what, with and y_offset e.g.
|
||||
|
||||
replace_what = { {"group:grass", "air", 0}, {"default:dirt_with_grass", "default:dirt", -1} }
|
||||
|
||||
Mob animation comes in three parts, start_frame, end_frame and frame_speed which
|
||||
can be added to the mob definition under pre-defined mob animation names like:
|
||||
|
||||
'animation' a table with the animation ranges and speed of the model
|
||||
'stand_start', 'stand_end', 'stand_speed' when mob stands still
|
||||
'walk_start', 'walk_end', 'walk_speed' when mob walks
|
||||
'run_start', 'run_end', 'run_speed' when mob runs
|
||||
'fly_start', 'fly_end', 'fly_speed' when mob flies
|
||||
'punch_start', 'punch_end', 'punch_speed' when mob attacks
|
||||
'punch2_start', 'punch2_end', 'punch2_speed' when mob attacks (alternative)
|
||||
'die_start', 'die_end', 'die_speed' when mob dies
|
||||
also 'speed_normal' for compatibility with older mobs for animation speed (deprecated)
|
||||
|
||||
|
||||
The mob api also has some preset variables and functions that it will remember for each mob
|
||||
|
||||
|
@ -139,8 +136,9 @@ The mob api also has some preset variables and functions that it will remember f
|
|||
'self.child' used for when breeding animals have child, will use child_texture and be half size
|
||||
'self.owner' string used to set owner of npc mobs, typically used for dogs
|
||||
'self.order' set to "follow" or "stand" so that npc will follow owner or stand it's ground
|
||||
'self.nametag' contains the name of the mob which it can show above
|
||||
'on_die' a function that is called when mob is killed
|
||||
'do_custom' a custom function that is called while mob is active and which has access to all of the self.* variables e.g. (self.health for health or self.standing_in for node status), return with 'false' to skip remainder of mob API.
|
||||
'do_custom' a custom function that is called every tick while mob is active and which has access to all of the self.* variables e.g. (self.health for health or self.standing_in for node status), return with 'false' to skip remainder of mob API.
|
||||
|
||||
|
||||
mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height, day_toggle)
|
||||
|
@ -157,7 +155,7 @@ These functions register a spawn algorithm for the mob. Without this function th
|
|||
'interval' is same as in register_abm() (default is 30 for mobs:register_spawn)
|
||||
'chance' is same as in register_abm()
|
||||
'active_object_count' mob is only spawned if active_object_count_wider of ABM is <= this
|
||||
'min_height' is the maximum height the mob can spawn
|
||||
'min_height' is the minimum height the mob can spawn
|
||||
'max_height' is the maximum height the mob can spawn
|
||||
'day_toggle' true for day spawning, false for night or nil for anytime
|
||||
'on_spawn' is a custom function which runs after mob has spawned and gives self and pos values.
|
||||
|
@ -235,12 +233,12 @@ This function is generally called inside the on_rightclick section of the mob ap
|
|||
'chance_net' chance of capturing mob using net (1 to 100) 0 to disable
|
||||
'chance_lasso' chance of capturing mob using magic lasso (1 to 100) 0 to disable
|
||||
'force_take' take mob by force, even if tamed (true or false)
|
||||
'replacewith' once captured replace mob with this item instead
|
||||
'replacewith' once captured replace mob with this item instead (overrides new mob eggs with saved information)
|
||||
|
||||
|
||||
mobs:feed_tame(self, clicker, feed_count, breed)
|
||||
|
||||
This function allows the mob to be fed the item inside self.follow be it apple, wheat or whatever a set number of times and be tamed or bred as a result.
|
||||
This function allows the mob to be fed the item inside self.follow be it apple, wheat or whatever a set number of times and be tamed or bred as a result. Will return true when mob is fed with item it likes.
|
||||
|
||||
'self' mob information
|
||||
'clicker' player information
|
||||
|
@ -251,7 +249,7 @@ This function allows the mob to be fed the item inside self.follow be it apple,
|
|||
|
||||
mobs:protect(self, clicker)
|
||||
|
||||
This function can be used to right-click any tamed mob with mobs:protector item, this will protect the mob from harm inside of a protected area from other players.
|
||||
This function can be used to right-click any tamed mob with mobs:protector item, this will protect the mob from harm inside of a protected area from other players. Will return true when mob right-clicked with mobs:protector item.
|
||||
|
||||
'self' mob information
|
||||
'clicker' player information
|
||||
|
@ -298,6 +296,27 @@ This function allows an attached player to move the mob around and animate it at
|
|||
'dtime' tick time used inside drive function
|
||||
|
||||
|
||||
mobs:fly(self, dtime, speed, can_shoot, arrow_entity, move_animation, stand_animation)
|
||||
|
||||
This function allows an attached player to fly the mob around using directional controls.
|
||||
|
||||
'self' mob information
|
||||
'dtime' tick time used inside fly function
|
||||
'speed' speed of flight
|
||||
'can_shoot' true if mob can fire arrow (sneak and left mouse button fires)
|
||||
'arrow_entity' name of arrow entity used for firing
|
||||
'move_animation' string containing movement animation e.g. "walk"
|
||||
'stand_animation' string containing movement animation e.g. "stand"
|
||||
|
||||
|
||||
mobs:set_animation(self, name)
|
||||
|
||||
This function sets the current animation for mob, defaulting to "stand" if not found.
|
||||
|
||||
'self' mob information
|
||||
'name' name of animation
|
||||
|
||||
|
||||
Certain variables need to be set before using the above functions:
|
||||
|
||||
'self.v2' toggle switch
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
# Türkçe çeviri by Admicos
|
||||
# Turkish translation by Admicos
|
||||
|
||||
# Son düzenleme: 26 Nisan 2017
|
||||
# Last edit: 26 April 2017
|
||||
|
||||
#init.lua
|
||||
[MOD] Mobs Redo loaded = [MOD] Mobs Red yüklendi
|
||||
|
||||
#api.lua
|
||||
[MOBS] mod profiling enabled, damage not enabled = [MOBS] profilleme açık, zarar kapalı
|
||||
lifetimer expired, removed @1 = Can zamanlayıcısı bitti, @1 silindi
|
||||
[Mobs Redo] @1 has spawning disabled = @1 yaratılması kapandı
|
||||
[Mobs Redo] Chance setting for @1 is now @2 = [Mobs Redo] @1'in şans ayarı şimdi @2
|
||||
[mobs] @1 failed to spawn at @2 = @1, @2'de yaratılamadı
|
||||
Not tamed! = Evcil değil!
|
||||
@1 is owner! = Sahibi @1!
|
||||
Missed! = Kaçırdın!
|
||||
@1 at full health (@2) = @1 tam canında (@2)
|
||||
@1 has been tamed! = @1 tamamen evcilleştirilmiştir!
|
||||
Enter name: = İsim gir:
|
||||
Rename = Yeniden adlandır
|
||||
|
||||
#crafts.lua
|
||||
Nametag = İsim etiketi
|
||||
Leather = Deri
|
||||
Raw Meat = Çiğ et
|
||||
Meat = Et
|
||||
Magic Lasso (right-click animal to put in inventory) = Sihirli kement (hayvana sağ tıklayarak envantere koy)
|
||||
Net (right-click animal to put in inventory) = Ağ (hayvana sağ tıklayarak envantere koy)
|
||||
Steel Shears (right-click to shear) = Çelik makas (sağ tıklayarak kes)
|
||||
|
||||
#spawner.lua
|
||||
Mob Spawner = Canavar Yaratıcı
|
||||
Mob MinLight MaxLight Amount PlayerDist = Mob MinIşık MaxIşık Miktar OyuncuMesafesi
|
||||
Spawner Not Active (enter settings) = Yaratıcı aktif değil (ayarlara gir)
|
||||
Spawner Active (@1) = Yaratıcı aktif (@1)
|
||||
Mob Spawner settings failed! = Yaratıcı ayarları uygulanamadı.
|
||||
> name min_light[0-14] max_light[0-14] max_mobs_in_area[0 to disable] distance[1-20] y_offset[-10 to 10] = > isim min_isik[0-14] max_isik[0-14] alandaki_max_canavar_sayisi[kapatmak icin 0] mesafe[1-20] y_cikinti[-10 ve 10 arası]
|
|
@ -141,7 +141,8 @@ function mobs.attach(entity, player)
|
|||
default.player_set_animation(player, "sit" , 30)
|
||||
end)
|
||||
|
||||
player:set_look_yaw(entity.object:getyaw() - rot_view)
|
||||
--player:set_look_yaw(entity.object:getyaw() - rot_view)
|
||||
player:set_look_horizontal(entity.object:getyaw() - rot_view)
|
||||
end
|
||||
|
||||
|
||||
|
@ -196,10 +197,8 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
|
|||
entity.v = entity.v - entity.accel / 10
|
||||
end
|
||||
|
||||
--entity.object:setyaw(entity.driver:get_look_yaw() - rot_steer)
|
||||
-- entity.object:setyaw(entity.driver:get_look_horizontal())-- - rot_steer)
|
||||
|
||||
-- fix mob rotation
|
||||
-- entity.object:setyaw(entity.driver:get_look_yaw() - entity.rotate)
|
||||
entity.object:setyaw(entity.driver:get_look_horizontal() - entity.rotate)
|
||||
|
||||
if can_fly then
|
||||
|
@ -242,7 +241,7 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
|
|||
if entity.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then
|
||||
|
||||
if stand_anim then
|
||||
set_animation(entity, stand_anim)
|
||||
mobs:set_animation(entity, stand_anim)
|
||||
end
|
||||
|
||||
return
|
||||
|
@ -250,7 +249,7 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
|
|||
|
||||
-- set moving animation
|
||||
if moving_anim then
|
||||
set_animation(entity, moving_anim)
|
||||
mobs:set_animation(entity, moving_anim)
|
||||
end
|
||||
|
||||
-- Stop!
|
||||
|
@ -340,9 +339,6 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
|
|||
else
|
||||
v = v * 0.25
|
||||
end
|
||||
-- elseif ni == "walkable" then
|
||||
-- v = 0
|
||||
-- new_acce.y = 1
|
||||
end
|
||||
|
||||
new_velo = get_velocity(v, entity.object:getyaw() - rot_view, velo.y)
|
||||
|
@ -370,3 +366,72 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
|
|||
|
||||
entity.v2 = v
|
||||
end
|
||||
|
||||
|
||||
-- directional flying routine by D00Med (edited by TenPlus1)
|
||||
|
||||
function mobs.fly(entity, dtime, speed, shoots, arrow, moving_anim, stand_anim)
|
||||
|
||||
local ctrl = entity.driver:get_player_control()
|
||||
local velo = entity.object:getvelocity()
|
||||
local dir = entity.driver:get_look_dir()
|
||||
-- local yaw = entity.driver:get_look_yaw()
|
||||
local yaw = entity.driver:get_look_horizontal() + 1.57 -- offset fix between old and new commands
|
||||
local rot_steer, rot_view = math.pi / 2, 0
|
||||
|
||||
if entity.player_rotation.y == 90 then
|
||||
rot_steer, rot_view = 0, math.pi / 2
|
||||
end
|
||||
|
||||
if ctrl.up then
|
||||
entity.object:setvelocity({
|
||||
x = dir.x * speed,
|
||||
y = dir.y * speed + 2,
|
||||
z = dir.z * speed
|
||||
})
|
||||
|
||||
elseif ctrl.down then
|
||||
entity.object:setvelocity({
|
||||
x = -dir.x * speed,
|
||||
y = dir.y * speed + 2,
|
||||
z = -dir.z * speed
|
||||
})
|
||||
|
||||
elseif not ctrl.down or ctrl.up or ctrl.jump then
|
||||
entity.object:setvelocity({x = 0, y = -2, z = 0})
|
||||
end
|
||||
|
||||
entity.object:setyaw(yaw + math.pi + math.pi / 2 - entity.rotate)
|
||||
|
||||
-- firing arrows
|
||||
if ctrl.LMB and ctrl.sneak and shoots then
|
||||
|
||||
local pos = entity.object:getpos()
|
||||
local obj = minetest.add_entity({
|
||||
x = pos.x + 0 + dir.x * 2.5,
|
||||
y = pos.y + 1.5 + dir.y,
|
||||
z = pos.z + 0 + dir.z * 2.5}, arrow)
|
||||
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.switch = 1 -- for mob specific arrows
|
||||
ent.owner_id = tostring(entity.object) -- so arrows dont hurt entity you are riding
|
||||
local vec = {x = dir.x * 6, y = dir.y * 6, z = dir.z * 6}
|
||||
-- local yaw = entity.driver:get_look_yaw()
|
||||
local yaw = entity.driver:get_look_horizontal()
|
||||
obj:setyaw(yaw + math.pi / 2)
|
||||
obj:setvelocity(vec)
|
||||
else
|
||||
obj:remove()
|
||||
end
|
||||
end
|
||||
|
||||
-- change animation if stopped
|
||||
if velo.x == 0 and velo.y == 0 and velo.z == 0 then
|
||||
|
||||
mobs:set_animation(entity, stand_anim)
|
||||
else
|
||||
-- moving animation
|
||||
mobs:set_animation(entity, moving_anim)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,7 +22,9 @@ Lucky Blocks: 9
|
|||
|
||||
|
||||
Changelog:
|
||||
|
||||
- 1.36- Death check added, if mob dies in fire/lava/with lava pick then drops are cooked
|
||||
- 1.35- Added owner_loyal flag for owned mobs to attack player enemies, also fixed group_attack
|
||||
- 1.34- Added function to fly mob using directional movement (thanks D00Med for flying code)
|
||||
- 1.33- Added functions to mount ride mobs (mobs.attach, mobs.detach, mobs.drive) many thanks to Blert2112
|
||||
- 1.32- Added new spawn check to count specific mobs AND new minetest.conf setting to chance spawn chance and numbers, added ability to protect tamed mobs
|
||||
- 1.31- Added 'attack_animals' and 'specific_attack' flags for custom monster attacks, also 'mob_difficulty' .conf setting to make mobs harder.
|
||||
|
|
|
@ -71,6 +71,9 @@ minetest.register_node("mobs:spawner", {
|
|||
end,
|
||||
})
|
||||
|
||||
|
||||
local max_per_block = tonumber(minetest.setting_get("max_objects_per_block") or 99)
|
||||
|
||||
-- spawner abm
|
||||
minetest.register_abm({
|
||||
label = "Mob spawner node",
|
||||
|
@ -81,6 +84,11 @@ minetest.register_abm({
|
|||
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
|
||||
-- return if too many entities already
|
||||
if active_object_count_wider >= max_per_block then
|
||||
return
|
||||
end
|
||||
|
||||
-- get meta and command
|
||||
local meta = minetest.get_meta(pos)
|
||||
local comm = meta:get_string("command"):split(" ")
|
||||
|
@ -98,17 +106,23 @@ minetest.register_abm({
|
|||
return
|
||||
end
|
||||
|
||||
-- are we spawning a registered mob?
|
||||
if not mobs.spawning_mobs[mob] then
|
||||
--print ("--- mob doesn't exist", mob)
|
||||
return
|
||||
end
|
||||
|
||||
-- check objects inside 9x9 area around spawner
|
||||
local objs = minetest.get_objects_inside_radius(pos, 9)
|
||||
local count = 0
|
||||
local ent = nil
|
||||
|
||||
-- count mob objects of same type in area
|
||||
for k, obj in pairs(objs) do
|
||||
for k, obj in ipairs(objs) do
|
||||
|
||||
ent = obj:get_luaentity()
|
||||
|
||||
if ent and ent.name == mob then
|
||||
if ent and ent.name and ent.name == mob then
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue