Make squids fly in water flowing and water source
parent
52c3db041e
commit
84ca7681fc
|
@ -185,13 +185,13 @@ ______ _ _ _______ _ _
|
|||
|
||||
|
||||
-- state switching logic (stand, walk, run, attacks)
|
||||
local fly_state_list_wandering = {"stand", "walk"}
|
||||
local fly_state_list_wandering = {"stand", "fly"}
|
||||
|
||||
local fly_state_switch = function(self, dtime)
|
||||
self.state_timer = self.state_timer - dtime
|
||||
if self.wandering and self.state_timer <= 0 then
|
||||
self.state_timer = math.random(4,10) + math.random()
|
||||
self.state = land_state_list_wandering[math.random(1,#land_state_list_wandering)]
|
||||
self.state = fly_state_list_wandering[math.random(1,#fly_state_list_wandering)]
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -200,13 +200,38 @@ end
|
|||
|
||||
local fly_state_execution = function(self,dtime)
|
||||
|
||||
local pos = self.object:get_pos()
|
||||
local current_node = minetest_get_node(pos).name
|
||||
local inside_swim_node = false
|
||||
|
||||
for _,id in pairs(self.fly_in) do
|
||||
if id == current_node then
|
||||
inside_swim_node = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
print(inside_swim_node)
|
||||
|
||||
if self.state == "stand" then
|
||||
|
||||
--do animation
|
||||
--mobs.set_mob_animation(self, "stand")
|
||||
|
||||
--set the velocity of the mob
|
||||
--mobs.set_velocity(self,0)
|
||||
|
||||
--print("standing")
|
||||
|
||||
elseif self.state == "fly" then
|
||||
|
||||
|
||||
--print("flying")
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local fly_state_switch = function(self, dtime)
|
||||
|
||||
|
||||
end
|
||||
|
||||
--[[
|
||||
___ ___ _ _ _
|
||||
|
|
|
@ -81,7 +81,9 @@ mobs_mc.items = {
|
|||
gunpowder = "tnt:gunpowder",
|
||||
flint_and_steel = "fire:flint_and_steel",
|
||||
water_source = "default:water_source",
|
||||
water_flowing = "default:water_flowing",
|
||||
river_water_source = "default:river_water_source",
|
||||
water_flowing = "default:river_water_flowing",
|
||||
black_dye = "dye:black",
|
||||
poppy = "flowers:rose",
|
||||
dandelion = "flowers:dandelion_yellow",
|
||||
|
|
|
@ -48,7 +48,7 @@ mobs:register_mob("mobs_mc:squid", {
|
|||
visual_size = {x=3, y=3},
|
||||
makes_footstep_sound = false,
|
||||
fly = true,
|
||||
fly_in = { mobs_mc.items.water_source, mobs_mc.items.river_water_source },
|
||||
fly_in = { mobs_mc.items.water_source, "mcl_core:water_flowing", mobs_mc.items.river_water_source },
|
||||
breathes_in_water = true,
|
||||
jump = false,
|
||||
view_range = 16,
|
||||
|
|
Loading…
Reference in New Issue