mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-01-27 01:20:20 +01:00
fluid viscocity checks standing node against fly_in table/string
This commit is contained in:
parent
48bfa284d0
commit
d65b80fa51
28
api.lua
28
api.lua
@ -228,6 +228,28 @@ function mob_class:collision()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- check string against another string or table
|
||||||
|
local check_for = function(look_for, look_inside)
|
||||||
|
|
||||||
|
if type(look_inside) == "string" and look_inside == look_for then
|
||||||
|
|
||||||
|
return true
|
||||||
|
|
||||||
|
elseif type(look_inside) == "table" then
|
||||||
|
|
||||||
|
for _, str in pairs(look_inside) do
|
||||||
|
|
||||||
|
if str == look_for then
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- move mob in facing direction
|
-- move mob in facing direction
|
||||||
function mob_class:set_velocity(v)
|
function mob_class:set_velocity(v)
|
||||||
|
|
||||||
@ -263,9 +285,9 @@ function mob_class:set_velocity(v)
|
|||||||
-- check if standing in water and use liquid viscocity to slow mob
|
-- check if standing in water and use liquid viscocity to slow mob
|
||||||
local visc = minetest.registered_nodes[self.standing_in].liquid_viscosity
|
local visc = minetest.registered_nodes[self.standing_in].liquid_viscosity
|
||||||
|
|
||||||
-- assume any mob not flying will slow down in water as mobs flying in air
|
-- if mob standing inside fluid with viscocity which isn't in self.fly_in
|
||||||
-- wont be near water, and mobs flying in water will swim at full speed
|
-- then slow down mob accordingly
|
||||||
if not self.fly_in and (visc and visc > 0) then
|
if visc and visc > 0 and not check_for(self.standing_in, self.fly_in)then
|
||||||
|
|
||||||
new_vel.x = new_vel.x ~= 0 and new_vel.x / visc or 0
|
new_vel.x = new_vel.x ~= 0 and new_vel.x / visc or 0
|
||||||
new_vel.y = new_vel.y ~= 0 and new_vel.y / visc or 0
|
new_vel.y = new_vel.y ~= 0 and new_vel.y / visc or 0
|
||||||
|
@ -24,7 +24,7 @@ Lucky Blocks: 9
|
|||||||
|
|
||||||
Changelog:
|
Changelog:
|
||||||
- 1.52 - Added 'mob_active_limit' in settings to set number of mobs in game
|
- 1.52 - Added 'mob_active_limit' in settings to set number of mobs in game
|
||||||
(default is 0 for unlimited), removed {immortal} from mob armor
|
(default is 0 for unlimited), removed {immortal} from mob armor, fluid viscocity slows mobs
|
||||||
- 1.51 - Added some node checks for dangerous nodes, jumping and falling tweaks, spawn area check (thx for idea wuzzy), re-enabled mob suffocation, add 'mob_nospawn_range' setting
|
- 1.51 - Added some node checks for dangerous nodes, jumping and falling tweaks, spawn area check (thx for idea wuzzy), re-enabled mob suffocation, add 'mob_nospawn_range' setting
|
||||||
- 1.50 - Added new line_of_sight function that uses raycasting if mt5.0 is found, (thanks Astrobe), dont spawn mobs if world anchor nearby (technic or simple_anchor mods), chinese local added
|
- 1.50 - Added new line_of_sight function that uses raycasting if mt5.0 is found, (thanks Astrobe), dont spawn mobs if world anchor nearby (technic or simple_anchor mods), chinese local added
|
||||||
- 1.49- Added mobs:force_capture(self, player) function, api functions now use metatables thanks to bell07
|
- 1.49- Added mobs:force_capture(self, player) function, api functions now use metatables thanks to bell07
|
||||||
|
Loading…
Reference in New Issue
Block a user