Fixed formatting whitespace issues on cod.lua and salmon.lua

This commit is contained in:
PrairieAstronomer 2022-06-08 16:37:38 -06:00
parent ebcadc415d
commit f17f51cce3
2 changed files with 80 additions and 80 deletions

View File

@ -30,26 +30,26 @@ local S = minetest.get_translator("extra_mobs")
--################### --###################
local cod = { local cod = {
type = "animal", type = "animal",
spawn_class = "water", spawn_class = "water",
can_despawn = true, can_despawn = true,
passive = true, passive = true,
hp_min = 3, hp_min = 3,
hp_max = 3, hp_max = 3,
xp_min = 1, xp_min = 1,
xp_max = 3, xp_max = 3,
armor = 100, armor = 100,
rotate = 270, rotate = 270,
tilt_swim = true, tilt_swim = true,
collisionbox = {-0.3, 0.0, -0.3, 0.3, 0.79, 0.3}, collisionbox = {-0.3, 0.0, -0.3, 0.3, 0.79, 0.3},
visual = "mesh", visual = "mesh",
mesh = "extra_mobs_cod.b3d", mesh = "extra_mobs_cod.b3d",
textures = { textures = {
{"extra_mobs_cod.png"} {"extra_mobs_cod.png"}
}, },
sounds = { sounds = {
}, },
animation = { animation = {
stand_start = 1, stand_start = 1,
stand_end = 20, stand_end = 20,
walk_start = 1, walk_start = 1,
@ -57,44 +57,44 @@ local cod = {
run_start = 1, run_start = 1,
run_end = 20, run_end = 20,
}, },
drops = { drops = {
{name = "mcl_fishing:fish_raw", {name = "mcl_fishing:fish_raw",
chance = 1, chance = 1,
min = 1, min = 1,
max = 1,}, max = 1,},
{name = "mcl_dye:white", {name = "mcl_dye:white",
chance = 20, chance = 20,
min = 1, min = 1,
max = 1,}, max = 1,},
}, },
visual_size = {x=3, y=3}, visual_size = {x=3, y=3},
makes_footstep_sound = false, makes_footstep_sound = false,
swim = true, swim = true,
breathes_in_water = true, breathes_in_water = true,
jump = false, jump = false,
view_range = 16, view_range = 16,
runaway = true, runaway = true,
fear_height = 4, fear_height = 4,
do_custom = function(self) do_custom = function(self)
self.object:set_bone_position("body", vector.new(0,1,0), vector.new(degrees(dir_to_pitch(self.object:get_velocity())) * -1 + 90,0,0)) self.object:set_bone_position("body", vector.new(0,1,0), vector.new(degrees(dir_to_pitch(self.object:get_velocity())) * -1 + 90,0,0))
if minetest.get_item_group(self.standing_in, "water") ~= 0 then if minetest.get_item_group(self.standing_in, "water") ~= 0 then
if self.object:get_velocity().y < 2.5 then if self.object:get_velocity().y < 2.5 then
self.object:add_velocity({ x = 0 , y = math.random(-.002, .002) , z = 0 }) self.object:add_velocity({ x = 0 , y = math.random(-.002, .002) , z = 0 })
end end
end end
for _,object in pairs(minetest.get_objects_inside_radius(self.object:get_pos(), 10)) do for _,object in pairs(minetest.get_objects_inside_radius(self.object:get_pos(), 10)) do
local lp = object:get_pos() local lp = object:get_pos()
local s = self.object:get_pos() local s = self.object:get_pos()
local vec = { local vec = {
x = lp.x - s.x, x = lp.x - s.x,
y = lp.y - s.y, y = lp.y - s.y,
z = lp.z - s.z z = lp.z - s.z
} }
if object and not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "extra_mobs:cod" then if object and not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "extra_mobs:cod" then
self.state = "runaway" self.state = "runaway"
self.object:set_rotation({x=0,y=(atan(vec.z / vec.x) + 3 * pi / 2) - self.rotate,z=0}) self.object:set_rotation({x=0,y=(atan(vec.z / vec.x) + 3 * pi / 2) - self.rotate,z=0})
end end
end end
end, end,
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
if clicker:get_wielded_item():get_name() == "mcl_buckets:bucket_water" then if clicker:get_wielded_item():get_name() == "mcl_buckets:bucket_water" then

View File

@ -10,26 +10,26 @@ local S = minetest.get_translator("extra_mobs")
--################### --###################
local salmon = { local salmon = {
type = "animal", type = "animal",
spawn_class = "water", spawn_class = "water",
can_despawn = true, can_despawn = true,
passive = true, passive = true,
hp_min = 3, hp_min = 3,
hp_max = 3, hp_max = 3,
xp_min = 1, xp_min = 1,
xp_max = 3, xp_max = 3,
armor = 100, armor = 100,
rotate = 270, rotate = 270,
tilt_swim = true, tilt_swim = true,
collisionbox = {-0.4, 0.0, -0.4, 0.4, 0.79, 0.4}, collisionbox = {-0.4, 0.0, -0.4, 0.4, 0.79, 0.4},
visual = "mesh", visual = "mesh",
mesh = "extra_mobs_salmon.b3d", mesh = "extra_mobs_salmon.b3d",
textures = { textures = {
{"extra_mobs_salmon.png"} {"extra_mobs_salmon.png"}
}, },
sounds = { sounds = {
}, },
animation = { animation = {
stand_start = 1, stand_start = 1,
stand_end = 20, stand_end = 20,
walk_start = 1, walk_start = 1,
@ -37,29 +37,29 @@ local salmon = {
run_start = 1, run_start = 1,
run_end = 20, run_end = 20,
}, },
drops = { drops = {
{name = "mcl_fishing:salmon_raw", {name = "mcl_fishing:salmon_raw",
chance = 1, chance = 1,
min = 1, min = 1,
max = 1,}, max = 1,},
{name = "mcl_dye:white", {name = "mcl_dye:white",
chance = 20, chance = 20,
min = 1, min = 1,
max = 1,}, max = 1,},
}, },
visual_size = {x=3, y=3}, visual_size = {x=3, y=3},
makes_footstep_sound = false, makes_footstep_sound = false,
swim = true, swim = true,
breathes_in_water = true, breathes_in_water = true,
jump = false, jump = false,
view_range = 16, view_range = 16,
runaway = true, runaway = true,
fear_height = 4, fear_height = 4,
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
if clicker:get_wielded_item():get_name() == "mcl_buckets:bucket_water" then if clicker:get_wielded_item():get_name() == "mcl_buckets:bucket_water" then
self.object:remove() self.object:remove()
clicker:set_wielded_item("mcl_fishing:bucket_salmon") clicker:set_wielded_item("mcl_fishing:bucket_salmon")
awards.unlock(clicker:get_player_name(), "mcl:tacticalFishing") awards.unlock(clicker:get_player_name(), "mcl:tacticalFishing")
end end
end end
} }