mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2024-12-25 02:00:21 +01:00
added multiple blood textures
This commit is contained in:
parent
5751d98ab0
commit
4bf4d42b07
8
api.lua
8
api.lua
@ -2225,8 +2225,16 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
|
|||||||
|
|
||||||
pos.y = pos.y + (-self.collisionbox[2] + self.collisionbox[5]) * .5
|
pos.y = pos.y + (-self.collisionbox[2] + self.collisionbox[5]) * .5
|
||||||
|
|
||||||
|
-- do we have a single blood texture or multiple?
|
||||||
|
if type(self.blood_texture) == "table" then
|
||||||
|
|
||||||
|
local blood = self.blood_texture[random(1, #self.blood_texture)]
|
||||||
|
|
||||||
|
effect(pos, self.blood_amount, blood, nil, nil, 1, nil)
|
||||||
|
else
|
||||||
effect(pos, self.blood_amount, self.blood_texture, nil, nil, 1, nil)
|
effect(pos, self.blood_amount, self.blood_texture, nil, nil, 1, nil)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- do damage
|
-- do damage
|
||||||
self.health = self.health - floor(damage)
|
self.health = self.health - floor(damage)
|
||||||
|
3
api.txt
3
api.txt
@ -61,7 +61,8 @@ This functions registers a new mob as a Minetest entity.
|
|||||||
'immune_to' table holding special tool/item names and damage the incur e.g.
|
'immune_to' table holding special tool/item names and damage the incur e.g.
|
||||||
{"default:sword_wood", 0}, {"default:gold_lump", -10} immune to sword, gold lump heals
|
{"default:sword_wood", 0}, {"default:gold_lump", -10} immune to sword, gold lump heals
|
||||||
'blood_amount' number of droplets that appear when hit
|
'blood_amount' number of droplets that appear when hit
|
||||||
'blood_texture' texture of blood droplets (default: "mobs_blood.png")
|
'blood_texture' texture of blood droplets (default: "mobs_blood.png") can be table with multiple textures also e.g. {"mobs_blood.png", "mobs_blood2.png"}
|
||||||
|
|
||||||
'drops' is list of tables with the following fields:
|
'drops' is list of tables with the following fields:
|
||||||
'name' itemname e.g. default:stone
|
'name' itemname e.g. default:stone
|
||||||
'chance' the inverted chance (same as in abm) to get the item
|
'chance' the inverted chance (same as in abm) to get the item
|
||||||
|
@ -105,7 +105,7 @@ functions needed for the mob to work properly which contains the following:
|
|||||||
'blood_amount' contains the number of blood droplets to appear when
|
'blood_amount' contains the number of blood droplets to appear when
|
||||||
mob is hit.
|
mob is hit.
|
||||||
'blood_texture' has the texture name to use for droplets e.g.
|
'blood_texture' has the texture name to use for droplets e.g.
|
||||||
"mobs_blood.png".
|
"mobs_blood.png", or table {"blood1.png", "blood2.png"}
|
||||||
'pathfinding' set to 1 for mobs to use pathfinder feature to locate
|
'pathfinding' set to 1 for mobs to use pathfinder feature to locate
|
||||||
player, set to 2 so they can build/break also (only
|
player, set to 2 so they can build/break also (only
|
||||||
works with dogfight attack).
|
works with dogfight attack).
|
||||||
@ -250,7 +250,7 @@ enhance mob functionality and have them do many interesting things:
|
|||||||
false to stop punch damage and knockback from taking place.
|
false to stop punch damage and knockback from taking place.
|
||||||
'custom_attack' when set this function is called instead of the normal mob
|
'custom_attack' when set this function is called instead of the normal mob
|
||||||
melee attack, parameters are (self, to_attack).
|
melee attack, parameters are (self, to_attack).
|
||||||
'on_die' a function that is called when mob is killed
|
'on_die' a function that is called when mob is killed (self, pos)
|
||||||
'do_custom' a custom function that is called every tick while mob is
|
'do_custom' a custom function that is called every tick while mob is
|
||||||
active and which has access to all of the self.* variables
|
active and which has access to all of the self.* variables
|
||||||
e.g. (self.health for health or self.standing_in for node
|
e.g. (self.health for health or self.standing_in for node
|
||||||
|
Loading…
Reference in New Issue
Block a user