forked from MineClone5/MineClone5
Make squids fly in water flowing and water source
This commit is contained in:
parent
52c3db041e
commit
84ca7681fc
|
@ -185,13 +185,13 @@ ______ _ _ _______ _ _
|
||||||
|
|
||||||
|
|
||||||
-- state switching logic (stand, walk, run, attacks)
|
-- 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)
|
local fly_state_switch = function(self, dtime)
|
||||||
self.state_timer = self.state_timer - dtime
|
self.state_timer = self.state_timer - dtime
|
||||||
if self.wandering and self.state_timer <= 0 then
|
if self.wandering and self.state_timer <= 0 then
|
||||||
self.state_timer = math.random(4,10) + math.random()
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -200,14 +200,39 @@ end
|
||||||
|
|
||||||
local fly_state_execution = function(self,dtime)
|
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
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
___ ___ _ _ _
|
___ ___ _ _ _
|
||||||
| \/ | (_) | | (_)
|
| \/ | (_) | | (_)
|
||||||
|
|
|
@ -81,7 +81,9 @@ mobs_mc.items = {
|
||||||
gunpowder = "tnt:gunpowder",
|
gunpowder = "tnt:gunpowder",
|
||||||
flint_and_steel = "fire:flint_and_steel",
|
flint_and_steel = "fire:flint_and_steel",
|
||||||
water_source = "default:water_source",
|
water_source = "default:water_source",
|
||||||
|
water_flowing = "default:water_flowing",
|
||||||
river_water_source = "default:river_water_source",
|
river_water_source = "default:river_water_source",
|
||||||
|
water_flowing = "default:river_water_flowing",
|
||||||
black_dye = "dye:black",
|
black_dye = "dye:black",
|
||||||
poppy = "flowers:rose",
|
poppy = "flowers:rose",
|
||||||
dandelion = "flowers:dandelion_yellow",
|
dandelion = "flowers:dandelion_yellow",
|
||||||
|
|
|
@ -48,7 +48,7 @@ mobs:register_mob("mobs_mc:squid", {
|
||||||
visual_size = {x=3, y=3},
|
visual_size = {x=3, y=3},
|
||||||
makes_footstep_sound = false,
|
makes_footstep_sound = false,
|
||||||
fly = true,
|
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,
|
breathes_in_water = true,
|
||||||
jump = false,
|
jump = false,
|
||||||
view_range = 16,
|
view_range = 16,
|
||||||
|
|
Loading…
Reference in New Issue