Compare commits
9 Commits
458262ba55
...
12e2854e7e
Author | SHA1 | Date |
---|---|---|
D00Med | 12e2854e7e | |
D00Med | 886176ef97 | |
D00Med | 50a7d3ec58 | |
D00Med | ba1e99fb8a | |
D00Med | d106870618 | |
D00Med | 52b6d68d37 | |
D00Med | 7c3c0e70b2 | |
D00Med | 4f370bef52 | |
D00Med | cfc53981ba |
637
init.lua
|
@ -1,3 +1,12 @@
|
|||
|
||||
|
||||
|
||||
--vehicle functions
|
||||
|
||||
dofile(minetest.get_modpath("scifi_mobs").."/vehicle_functions.lua")
|
||||
|
||||
--mobs
|
||||
|
||||
mobs:register_mob("scifi_mobs:metroid", {
|
||||
type = "monster",
|
||||
passive = false,
|
||||
|
@ -11,7 +20,6 @@ mobs:register_mob("scifi_mobs:metroid", {
|
|||
collisionbox = {-0.3, -0.3, -0.3, 0.3, 0.3, 0.3},
|
||||
visual = "mesh",
|
||||
mesh = "metroid.b3d",
|
||||
use_texture_alpha = true,
|
||||
textures = {
|
||||
{"scifi_metroid.png"},
|
||||
},
|
||||
|
@ -47,6 +55,59 @@ mobs:register_mob("scifi_mobs:metroid", {
|
|||
|
||||
mobs:register_egg("scifi_mobs:metroid", "Metroid", "scifi_metroid_inv.png", 0)
|
||||
|
||||
mobs:register_mob("scifi_mobs:facehugger", {
|
||||
type = "monster",
|
||||
passive = false,
|
||||
attacks_monsters = false,
|
||||
damage = 1,
|
||||
reach = 2,
|
||||
attack_type = "dogfight",
|
||||
hp_min = 30,
|
||||
hp_max = 45,
|
||||
armor = 100,
|
||||
collisionbox = {-0.3, -0.1, -0.3, 0.3, 0.1, 0.3},
|
||||
visual = "mesh",
|
||||
mesh = "facehugger.b3d",
|
||||
textures = {
|
||||
{"scifi_facehugger.png"},
|
||||
},
|
||||
-- do_custom = function(self)
|
||||
-- local pos = self.object:getpos()
|
||||
-- local objs = minetest.get_objects_inside_radius(pos, 2)
|
||||
-- for _, obj in pairs(objs) do
|
||||
-- if obj:is_player() and obj:get_attach() == nil then
|
||||
-- obj:set_attach(self.object, "", {x=0, y=8, z=0}, {x=0, y=0, z=0})
|
||||
-- self.object:set_animation({x=46, y=46}, 20, 0)
|
||||
-- end
|
||||
-- end
|
||||
-- end,
|
||||
blood_texture = "mobs_blood.png",
|
||||
visual_size = {x=1, y=1},
|
||||
makes_footstep_sound = true,
|
||||
walk_velocity = 2,
|
||||
run_velocity = 3,
|
||||
jump = true,
|
||||
stepheight = 1.5,
|
||||
water_damage = 0,
|
||||
lava_damage = 2,
|
||||
light_damage = 0,
|
||||
view_range = 7,
|
||||
animation = {
|
||||
speed_normal = 12,
|
||||
speed_run = 20,
|
||||
walk_start = 10,
|
||||
walk_end = 30,
|
||||
run_start = 10,
|
||||
run_end = 30,
|
||||
punch_start = 30,
|
||||
punch_end = 43,
|
||||
},
|
||||
})
|
||||
|
||||
mobs:spawn_specific("scifi_mobs:facehugger", {"default:dirt_with_dry_grass"}, {"default:stone"}, 20, 0, 300, 15000, 2, -100, 11000)
|
||||
|
||||
mobs:register_egg("scifi_mobs:facehugger", "Facehugger", "scifi_facehugger_inv.png", 0)
|
||||
|
||||
mobs:register_mob("scifi_mobs:r2", {
|
||||
type = "animal",
|
||||
passive = false,
|
||||
|
@ -55,7 +116,7 @@ mobs:register_mob("scifi_mobs:r2", {
|
|||
attack_type = "shoot",
|
||||
hp_min = 22,
|
||||
hp_max = 32,
|
||||
armor = 230,
|
||||
armor = 80,
|
||||
shoot_interval = 2.5,
|
||||
arrow = "scifi_mobs:glaser",
|
||||
shoot_offset = 1,
|
||||
|
@ -97,18 +158,23 @@ mobs:register_mob("scifi_mobs:dalec", {
|
|||
passive = false,
|
||||
reach = 1,
|
||||
damage = 2,
|
||||
attack_type = "dogshoot",
|
||||
attack_type = "shoot",
|
||||
hp_min = 22,
|
||||
hp_max = 32,
|
||||
armor = 230,
|
||||
armor = 80,
|
||||
shoot_interval = 2.5,
|
||||
arrow = "scifi_mobs:glaser",
|
||||
shoot_offset = 1,
|
||||
collisionbox = {-0.4, -0.65, -0.4, 0.4, 0.6, 0.4},
|
||||
sounds = {
|
||||
shoot_attack = "Laser",
|
||||
random = "Dalek_Voice",
|
||||
},
|
||||
visual = "mesh",
|
||||
mesh = "dalek.b3d",
|
||||
textures = {
|
||||
{"scifi_dalek.png"},
|
||||
{"scifi_dalek1.png"},
|
||||
},
|
||||
visual_size = {x=2, y=2},
|
||||
makes_footstep_sound = false,
|
||||
|
@ -147,7 +213,7 @@ mobs:register_mob("scifi_mobs:spidermech", {
|
|||
attack_type = "dogfight",
|
||||
hp_min = 22,
|
||||
hp_max = 32,
|
||||
armor = 230,
|
||||
armor = 80,
|
||||
shoot_interval = 1.5,
|
||||
arrow = "scifi_mobs:rlaser",
|
||||
shoot_offset = 1,
|
||||
|
@ -183,21 +249,214 @@ mobs:register_mob("scifi_mobs:spidermech", {
|
|||
|
||||
mobs:register_spawn("scifi_mobs:spidermech", {"default:snow","default:dirt_with_grass"}, 20, 10, 15000, 2, 31000)
|
||||
|
||||
mobs:register_egg("scifi_mobs:spidermech", "Quadraped Mech", "scifi_spider_inv.png", 0)
|
||||
mobs:register_egg("scifi_mobs:spidermech", "Quadraped Scout", "scifi_spider_inv.png", 0)
|
||||
|
||||
mobs:register_mob("scifi_mobs:xenomorph", {
|
||||
type = "monster",
|
||||
passive = false,
|
||||
reach = 4,
|
||||
damage = 4,
|
||||
attack_type = "dogfight",
|
||||
hp_min = 12,
|
||||
hp_max = 22,
|
||||
armor = 30,
|
||||
shoot_interval = 1.5,
|
||||
arrow = "scifi_mobs:rlaser",
|
||||
shoot_offset = 1,
|
||||
collisionbox = {-1, -0, -1, 1, 2, 1},
|
||||
visual = "mesh",
|
||||
mesh = "xenomorph.b3d",
|
||||
textures = {
|
||||
{"scifi_xenomorph.png"},
|
||||
},
|
||||
visual_size = {x=3, y=3},
|
||||
makes_footstep_sound = false,
|
||||
walk_velocity = 2,
|
||||
run_velocity = 5,
|
||||
jump = true,
|
||||
water_damage = 0,
|
||||
lava_damage = 2,
|
||||
light_damage = 0,
|
||||
view_range = 14,
|
||||
animation = {
|
||||
speed_normal = 10,
|
||||
speed_run = 25,
|
||||
walk_start = 2,
|
||||
walk_end = 27,
|
||||
stand_start = 59,
|
||||
stand_end = 73,
|
||||
run_start = 2,
|
||||
run_end = 27,
|
||||
punch_start = 30,
|
||||
punch_end = 59,
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
mobs:register_spawn("scifi_mobs:xenomorph", {"default:steelblock","default:stone"}, 20, 10, 15000, 2, 31000)
|
||||
|
||||
mobs:register_egg("scifi_mobs:xenomorph", "xenomorph", "scifi_spider_inv.png", 0)
|
||||
|
||||
mobs:register_mob("scifi_mobs:jabba", {
|
||||
type = "animal",
|
||||
passive = false,
|
||||
reach = 2,
|
||||
damage = 0,
|
||||
attack_type = "dogfight",
|
||||
hp_min = 12,
|
||||
hp_max = 22,
|
||||
armor = 130,
|
||||
shoot_interval = 1.5,
|
||||
arrow = "scifi_mobs:rlaser",
|
||||
shoot_offset = 1,
|
||||
collisionbox = {-1, -0.7, -1, 1, 1, 1},
|
||||
visual = "mesh",
|
||||
mesh = "jabba.b3d",
|
||||
textures = {
|
||||
{"scifi_jabba.png"},
|
||||
},
|
||||
visual_size = {x=4, y=4},
|
||||
makes_footstep_sound = false,
|
||||
walk_velocity = 0.5,
|
||||
run_velocity = 1,
|
||||
jump = false,
|
||||
stepheight = 1.5,
|
||||
water_damage = 0,
|
||||
lava_damage = 2,
|
||||
light_damage = 0,
|
||||
view_range = 14,
|
||||
animation = {
|
||||
speed_normal = 10,
|
||||
speed_run = 25,
|
||||
walk_start = 1,
|
||||
walk_end = 20,
|
||||
stand_start = 20,
|
||||
stand_end = 40,
|
||||
run_start = 1,
|
||||
run_end = 20,
|
||||
punch_start = 1,
|
||||
punch_end = 20,
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
mobs:register_spawn("scifi_mobs:jabba", {"default:desert_sand"}, 20, 10, 15000, 2, 31000)
|
||||
|
||||
mobs:register_egg("scifi_mobs:jabba", "Jabba the hut", "scifi_giant_inv.png", 0)
|
||||
|
||||
mobs:register_mob("scifi_mobs:bb8", {
|
||||
type = "animal",
|
||||
passive = false,
|
||||
reach = 1,
|
||||
damage = 2,
|
||||
attack_type = "dogfight",
|
||||
hp_min = 22,
|
||||
hp_max = 32,
|
||||
armor = 80,
|
||||
shoot_interval = 1.5,
|
||||
arrow = "scifi_mobs:blaser",
|
||||
shoot_offset = 1,
|
||||
collisionbox = {-0.4, -0.5, -0.4, 0.4, 0.6, 0.4},
|
||||
visual = "mesh",
|
||||
mesh = "bb8.b3d",
|
||||
textures = {
|
||||
{"scifi_bb8.png"},
|
||||
},
|
||||
visual_size = {x=2, y=2},
|
||||
makes_footstep_sound = false,
|
||||
walk_velocity = 2,
|
||||
run_velocity = 3,
|
||||
jump = true,
|
||||
water_damage = 0,
|
||||
lava_damage = 2,
|
||||
light_damage = 0,
|
||||
view_range = 14,
|
||||
animation = {
|
||||
speed_normal = 10,
|
||||
speed_run = 10,
|
||||
walk_start = 1,
|
||||
walk_end = 25,
|
||||
stand_start = 25,
|
||||
stand_end = 46,
|
||||
run_start = 1,
|
||||
run_end = 25,
|
||||
punch_start = 1,
|
||||
punch_end = 1,
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
mobs:register_spawn("scifi_mobs:bb8", {"default:desert_sand","default:ice"}, 20, 10, 15000, 2, 31000)
|
||||
|
||||
mobs:register_egg("scifi_mobs:bb8", "BB8", "scifi_metroid_inv.png", 0)
|
||||
|
||||
mobs:register_mob("scifi_mobs:cyberman", {
|
||||
type = "monster",
|
||||
passive = false,
|
||||
reach = 1,
|
||||
damage = 2,
|
||||
attack_type = "shoot",
|
||||
hp_min = 52,
|
||||
hp_max = 62,
|
||||
armor = 80,
|
||||
shoot_interval = 1.5,
|
||||
arrow = "scifi_mobs:blaser",
|
||||
shoot_offset = 1,
|
||||
collisionbox = {-0.4, -1, -0.4, 0.4, 1.5, 0.4},
|
||||
sounds = {
|
||||
shoot_attack = "Laser",
|
||||
},
|
||||
visual = "mesh",
|
||||
mesh = "cyberman.b3d",
|
||||
textures = {
|
||||
{"scifi_cyberman.png"},
|
||||
},
|
||||
visual_size = {x=1.5, y=1.5},
|
||||
makes_footstep_sound = true,
|
||||
walk_velocity = 2,
|
||||
run_velocity = 3,
|
||||
jump = true,
|
||||
water_damage = 2,
|
||||
lava_damage = 2,
|
||||
light_damage = 0,
|
||||
view_range = 14,
|
||||
animation = {
|
||||
speed_normal = 10,
|
||||
speed_run = 10,
|
||||
walk_start = 30,
|
||||
walk_end = 50,
|
||||
stand_start = 1,
|
||||
stand_end = 1,
|
||||
run_start = 30,
|
||||
run_end = 50,
|
||||
punch_start = 1,
|
||||
punch_end = 20,
|
||||
shoot_start = 1,
|
||||
shoot_end = 20,
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
mobs:register_spawn("scifi_mobs:cyberman", {"default:cobblestone","default:sand"}, 20, 10, 15000, 2, 31000)
|
||||
|
||||
mobs:register_egg("scifi_mobs:cyberman", "Cyberman", "scifi_cyberman_inv.png", 0)
|
||||
|
||||
mobs:register_mob("scifi_mobs:bipedm", {
|
||||
type = "monster",
|
||||
passive = false,
|
||||
reach = 1,
|
||||
damage = 2,
|
||||
attack_type = "dogshoot",
|
||||
attack_type = "shoot",
|
||||
hp_min = 22,
|
||||
hp_max = 32,
|
||||
armor = 230,
|
||||
armor = 80,
|
||||
shoot_interval = 1.5,
|
||||
arrow = "scifi_mobs:rlaser",
|
||||
shoot_offset = 1,
|
||||
collisionbox = {-0.6, -1.35, -0.6, 0.6, 1.9, 0.6},
|
||||
sounds = {
|
||||
shoot_attack = "Laser",
|
||||
},
|
||||
visual = "mesh",
|
||||
mesh = "mecha.b3d",
|
||||
textures = {
|
||||
|
@ -231,6 +490,58 @@ mobs:register_spawn("scifi_mobs:bipedm", {"default:stone","default:desert_sand"}
|
|||
|
||||
mobs:register_egg("scifi_mobs:bipedm", "Bipedal Mech", "scifi_mech_inv.png", 0)
|
||||
|
||||
|
||||
|
||||
mobs:register_mob("scifi_mobs:giant", {
|
||||
type = "npc",
|
||||
passive = false,
|
||||
attacks_monsters = true,
|
||||
reach = 1,
|
||||
damage = 2,
|
||||
attack_type = "shoot",
|
||||
hp_min = 22,
|
||||
hp_max = 32,
|
||||
armor = 80,
|
||||
shoot_interval = 1.5,
|
||||
arrow = "scifi_mobs:blaser",
|
||||
shoot_offset = -1,
|
||||
collisionbox = {-1, 0, -1, 1, 10, 1},
|
||||
sounds = {
|
||||
shoot_attack = "Laser",
|
||||
},
|
||||
visual = "mesh",
|
||||
mesh = "irongiant.b3d",
|
||||
textures = {
|
||||
{"scifi_irongiant.png"},
|
||||
},
|
||||
visual_size = {x=4, y=4},
|
||||
makes_footstep_sound = false,
|
||||
walk_velocity = 1,
|
||||
run_velocity = 2,
|
||||
jump = false,
|
||||
water_damage = 0,
|
||||
lava_damage = 2,
|
||||
light_damage = 0,
|
||||
view_range = 14,
|
||||
animation = {
|
||||
speed_normal = 8,
|
||||
speed_run = 8,
|
||||
walk_start = 1,
|
||||
walk_end = 40,
|
||||
stand_start = 1,
|
||||
stand_end = 1,
|
||||
run_start = 1,
|
||||
run_end = 40,
|
||||
shoot_start = 40,
|
||||
shoot_end = 60,
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
mobs:register_spawn("scifi_mobs:giant", {"default:stone","default:dirt_with_grass"}, 20, 10, 15000, 2, 31000)
|
||||
|
||||
mobs:register_egg("scifi_mobs:giant", "Iron Giant", "scifi_giant_inv.png", 0)
|
||||
|
||||
mobs:register_mob("scifi_mobs:metalg", {
|
||||
type = "monster",
|
||||
passive = false,
|
||||
|
@ -239,11 +550,14 @@ mobs:register_mob("scifi_mobs:metalg", {
|
|||
attack_type = "shoot",
|
||||
hp_min = 52,
|
||||
hp_max = 82,
|
||||
armor = 230,
|
||||
armor = 80,
|
||||
shoot_interval = 1.5,
|
||||
arrow = "scifi_mobs:rlaser",
|
||||
shoot_offset = 1,
|
||||
collisionbox = {-0.6, -1.1, -0.6, 0.6, 1.9, 0.6},
|
||||
sounds = {
|
||||
shoot_attack = "Laser",
|
||||
},
|
||||
visual = "mesh",
|
||||
mesh = "metalgear.b3d",
|
||||
textures = {
|
||||
|
@ -277,19 +591,72 @@ mobs:register_spawn("scifi_mobs:metalg", {"default:stone","default:dirt_with_dry
|
|||
|
||||
mobs:register_egg("scifi_mobs:metalg", "Metal Gear", "scifi_mech_inv.png", 0)
|
||||
|
||||
|
||||
mobs:register_mob("scifi_mobs:assaultsuit", {
|
||||
type = "monster",
|
||||
passive = false,
|
||||
reach = 1,
|
||||
damage = 2,
|
||||
attack_type = "shoot",
|
||||
hp_min = 72,
|
||||
hp_max = 102,
|
||||
armor = 100,
|
||||
shoot_interval = 1.5,
|
||||
arrow = "scifi_mobs:glaser",
|
||||
shoot_offset = 0,
|
||||
collisionbox = {-0.6, 0, -0.6, 0.6, 3.5, 0.6},
|
||||
sounds = {
|
||||
shoot_attack = "Laser",
|
||||
},
|
||||
visual = "mesh",
|
||||
mesh = "assaultsuit.b3d",
|
||||
textures = {
|
||||
{"scifi_assaultsuit.png"},
|
||||
},
|
||||
visual_size = {x=1, y=1},
|
||||
makes_footstep_sound = true,
|
||||
walk_velocity = 2,
|
||||
run_velocity = 3,
|
||||
jump = true,
|
||||
water_damage = 0,
|
||||
lava_damage = 2,
|
||||
light_damage = 0,
|
||||
view_range = 14,
|
||||
animation = {
|
||||
speed_normal = 10,
|
||||
speed_run = 12,
|
||||
walk_start = 120,
|
||||
walk_end = 140,
|
||||
stand_start = 80,
|
||||
stand_end = 110,
|
||||
run_start = 120,
|
||||
run_end = 140,
|
||||
shoot_start = 40,
|
||||
shoot_end = 51,
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
mobs:register_spawn("scifi_mobs:assaultsuit", {"default:stone","default:dirt_with_grass"}, 20, 10, 15000, 2, 31000)
|
||||
|
||||
mobs:register_egg("scifi_mobs:assaultsuit", "Assault Suit", "scifi_assaultsuit_inv.png", 0)
|
||||
|
||||
mobs:register_mob("scifi_mobs:tank", {
|
||||
type = "monster",
|
||||
passive = false,
|
||||
reach = 1,
|
||||
damage = 2,
|
||||
attack_type = "dogshoot",
|
||||
attack_type = "shoot",
|
||||
hp_min = 22,
|
||||
hp_max = 32,
|
||||
armor = 230,
|
||||
armor = 80,
|
||||
shoot_interval = 0.5,
|
||||
arrow = "scifi_mobs:pulse",
|
||||
shoot_offset = 1,
|
||||
collisionbox = {-1.8, -0.8, -1.3, 1.8, 1.2, 1.3},
|
||||
sounds = {
|
||||
shoot_attack = "Laser",
|
||||
},
|
||||
visual = "mesh",
|
||||
mesh = "tank2.b3d",
|
||||
textures = {
|
||||
|
@ -323,6 +690,141 @@ mobs:register_spawn("scifi_mobs:tank", {"default:dirt_with_grass","default:snow"
|
|||
|
||||
mobs:register_egg("scifi_mobs:tank", "Tank", "scifi_tank_inv.png", 0)
|
||||
|
||||
--flying mobs
|
||||
|
||||
mobs:register_mob("scifi_mobs:xwing", {
|
||||
type = "npc",
|
||||
passive = false,
|
||||
attacks_monsters = true,
|
||||
reach = 1,
|
||||
damage = 2,
|
||||
attack_type = "shoot",
|
||||
hp_min = 62,
|
||||
hp_max = 72,
|
||||
armor = 80,
|
||||
shoot_interval = 1.5,
|
||||
arrow = "scifi_mobs:rlaser",
|
||||
shoot_offset = 1,
|
||||
collisionbox = {-2, -1.75, -2, 2, 1.9, 2},
|
||||
sounds = {
|
||||
shoot_attack = "Laser",
|
||||
},
|
||||
visual = "mesh",
|
||||
mesh = "xwing.b3d",
|
||||
textures = {
|
||||
{"scifi_xwing.png"},
|
||||
},
|
||||
makes_footstep_sound = false,
|
||||
walk_velocity = 4,
|
||||
walk_chance = 70,
|
||||
run_velocity = 7,
|
||||
jump = false,
|
||||
fly = true,
|
||||
fall_speed = 0,
|
||||
water_damage = 0,
|
||||
lava_damage = 2,
|
||||
light_damage = 0,
|
||||
view_range = 14,
|
||||
animation = {
|
||||
speed_normal = 6,
|
||||
speed_run = 7,
|
||||
walk_start = 1,
|
||||
walk_end = 1,
|
||||
stand_start = 1,
|
||||
stand_end = 1,
|
||||
run_start = 5,
|
||||
run_end = 5,
|
||||
punch_start = 5,
|
||||
punch_end = 5,
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_entity("scifi_mobs:xwing_player", {
|
||||
visual = "mesh",
|
||||
mesh = "xwing.b3d",
|
||||
textures = {"scifi_xwing.png"},
|
||||
hp_max = 150,
|
||||
velocity = 15,
|
||||
acceleration = -5,
|
||||
damage = 2,
|
||||
animation_speed = 5,
|
||||
physical = true,
|
||||
collisionbox = {-2, -1.75, -2, 2, 1.9, 2},
|
||||
on_rightclick = function(self, clicker)
|
||||
if self.driver and clicker == self.driver then
|
||||
object_detach(self, clicker, {x=1, y=0, z=1})
|
||||
elseif not self.driver then
|
||||
object_attach(self, clicker, {x=0, y=5, z=4}, {x=0, y=6, z=-82})
|
||||
end
|
||||
end,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
object_fly(self, dtime, 20, 0.2, 0.92, true, "scifi_mobs:laser_shot", "run", "run")
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
mobs:register_spawn("scifi_mobs:xwing", {"default:leaves","default:pine_needles"}, 20, 10, 15000, 2, 31000)
|
||||
|
||||
mobs:register_egg("scifi_mobs:xwing", "X-wing", "scifi_xwing_inv.png", 0)
|
||||
mobs:register_egg("scifi_mobs:xwing_player", "X-wing(rideable)", "scifi_xwing_inv.png", 0)
|
||||
|
||||
mobs:register_mob("scifi_mobs:core", {
|
||||
type = "monster",
|
||||
passive = false,
|
||||
reach = 1,
|
||||
damage = 2,
|
||||
attack_type = "shoot",
|
||||
hp_min = 62,
|
||||
hp_max = 72,
|
||||
armor = 80,
|
||||
shoot_interval = 1.5,
|
||||
arrow = "scifi_mobs:blaser",
|
||||
shoot_offset = 1,
|
||||
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||
sounds = {
|
||||
shoot_attack = "Laser",
|
||||
},
|
||||
visual_size = {x=2, y=2},
|
||||
visual = "mesh",
|
||||
mesh = "core.b3d",
|
||||
textures = {
|
||||
{"scifi_core1.png"},
|
||||
{"scifi_core2.png"},
|
||||
{"scifi_core3.png"},
|
||||
},
|
||||
makes_footstep_sound = false,
|
||||
walk_velocity = 2,
|
||||
run_velocity = 3,
|
||||
jump = true,
|
||||
fly = true,
|
||||
fall_speed = 0,
|
||||
water_damage = 0,
|
||||
lava_damage = 2,
|
||||
light_damage = 0,
|
||||
view_range = 14,
|
||||
animation = {
|
||||
speed_normal = 6,
|
||||
speed_run = 7,
|
||||
walk_start = 1,
|
||||
walk_end = 1,
|
||||
stand_start = 1,
|
||||
stand_end = 11,
|
||||
run_start = 1,
|
||||
run_end = 1,
|
||||
shoot_start = 1,
|
||||
shoot_end = 1,
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
mobs:register_spawn("scifi_mobs:core", {"default:dirt_with_grass","default:steelblock"}, 20, 10, 15000, 2, 31000)
|
||||
|
||||
mobs:register_egg("scifi_mobs:core", "Core/Sphere", "scifi_core_inv.png", 0)
|
||||
|
||||
|
||||
--lasers and stuff
|
||||
|
||||
|
@ -330,7 +832,7 @@ mobs:register_arrow("scifi_mobs:blaser", {
|
|||
visual = "sprite",
|
||||
visual_size = {x = 0.5, y = 0.5},
|
||||
textures = {"scifi_mobs_laser.png"},
|
||||
velocity = 8,
|
||||
velocity = 18,
|
||||
tail = 1, -- enable tail
|
||||
tail_texture = "scifi_mobs_laser.png",
|
||||
|
||||
|
@ -379,6 +881,59 @@ mobs:register_arrow("scifi_mobs:pulse", {
|
|||
self.object:remove()
|
||||
end,
|
||||
})
|
||||
mobs:register_arrow("scifi_mobs:glaser", {
|
||||
visual = "sprite",
|
||||
visual_size = {x = 0.5, y = 0.5},
|
||||
textures = {"scifi_mobs_glaser.png"},
|
||||
velocity = 18,
|
||||
tail = 1, -- enable tail
|
||||
tail_texture = "scifi_mobs_glaser.png",
|
||||
|
||||
hit_player = function(self, player)
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups = {fleshy = 8},
|
||||
}, nil)
|
||||
end,
|
||||
|
||||
hit_mob = function(self, player)
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups = {fleshy = 8},
|
||||
}, nil)
|
||||
end,
|
||||
|
||||
hit_node = function(self, pos, node)
|
||||
mobs:explosion(pos, 1, 1, 1)
|
||||
end,
|
||||
})
|
||||
|
||||
mobs:register_arrow("scifi_mobs:rlaser", {
|
||||
visual = "sprite",
|
||||
visual_size = {x = 0.5, y = 0.5},
|
||||
textures = {"scifi_mobs_rlaser.png"},
|
||||
velocity = 18,
|
||||
tail = 1, -- enable tail
|
||||
tail_texture = "scifi_mobs_rlaser.png",
|
||||
|
||||
hit_player = function(self, player)
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups = {fleshy = 8},
|
||||
}, nil)
|
||||
end,
|
||||
|
||||
hit_mob = function(self, player)
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups = {fleshy = 8},
|
||||
}, nil)
|
||||
end,
|
||||
|
||||
hit_node = function(self, pos, node)
|
||||
mobs:explosion(pos, 1, 1, 1)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_entity("scifi_mobs:bfg_shot", {
|
||||
textures = {"scifi_bfg_shot.png"},
|
||||
|
@ -646,7 +1201,7 @@ minetest.register_tool("scifi_mobs:blaster", {
|
|||
if inv:contains_item("main", "scifi_mobs:smallcell") then
|
||||
local remov = inv:remove_item("main", "scifi_mobs:smallcell")
|
||||
local obj = minetest.env:add_entity({x=playerpos.x+dir.x,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "scifi_mobs:laser_shot")
|
||||
local vec = {x=dir.x*9,y=dir.y*9,z=dir.z*9}
|
||||
local vec = {x=dir.x*15,y=dir.y*15,z=dir.z*15}
|
||||
obj:setvelocity(vec)
|
||||
return itemstack
|
||||
end
|
||||
|
@ -673,7 +1228,7 @@ minetest.register_tool("scifi_mobs:pulse_pistol", {
|
|||
if inv:contains_item("main", "scifi_mobs:icecell") then
|
||||
local remov = inv:remove_item("main", "scifi_mobs:icecell")
|
||||
local obj = minetest.env:add_entity({x=playerpos.x+dir.x,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "scifi_mobs:pulse_shot")
|
||||
local vec = {x=dir.x*12,y=dir.y*12,z=dir.z*12}
|
||||
local vec = {x=dir.x*18,y=dir.y*18,z=dir.z*18}
|
||||
obj:setvelocity(vec)
|
||||
end
|
||||
return itemstack
|
||||
|
@ -710,57 +1265,3 @@ minetest.register_tool("scifi_mobs:lasercutter", {
|
|||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
mobs:register_arrow("scifi_mobs:glaser", {
|
||||
visual = "sprite",
|
||||
visual_size = {x = 0.5, y = 0.5},
|
||||
textures = {"scifi_mobs_glaser.png"},
|
||||
velocity = 8,
|
||||
tail = 1, -- enable tail
|
||||
tail_texture = "scifi_mobs_glaser.png",
|
||||
|
||||
hit_player = function(self, player)
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups = {fleshy = 8},
|
||||
}, nil)
|
||||
end,
|
||||
|
||||
hit_mob = function(self, player)
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups = {fleshy = 8},
|
||||
}, nil)
|
||||
end,
|
||||
|
||||
hit_node = function(self, pos, node)
|
||||
mobs:explosion(pos, 1, 1, 1)
|
||||
end,
|
||||
})
|
||||
|
||||
mobs:register_arrow("scifi_mobs:rlaser", {
|
||||
visual = "sprite",
|
||||
visual_size = {x = 0.5, y = 0.5},
|
||||
textures = {"scifi_mobs_rlaser.png"},
|
||||
velocity = 8,
|
||||
tail = 1, -- enable tail
|
||||
tail_texture = "scifi_mobs_rlaser.png",
|
||||
|
||||
hit_player = function(self, player)
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups = {fleshy = 8},
|
||||
}, nil)
|
||||
end,
|
||||
|
||||
hit_mob = function(self, player)
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups = {fleshy = 8},
|
||||
}, nil)
|
||||
end,
|
||||
|
||||
hit_node = function(self, pos, node)
|
||||
mobs:explosion(pos, 1, 1, 1)
|
||||
end,
|
||||
})
|
|
@ -23,3 +23,8 @@ License for Textures, Models
|
|||
---------------------------------------
|
||||
|
||||
CC BY-SA 3.0 UNPORTED. Created by D00Med
|
||||
|
||||
License for sounds:
|
||||
Dalek_Voice.ogg - CC BY-SA 3.0 UNPORTED. By Donlock (https://commons.wikimedia.org/wiki/File:Dalek_Voice.ogg)
|
||||
|
||||
Laser.ogg - CC BY 3.0 by Mike Koenig
|
||||
|
|
BIN
textures/r2.png
Before Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 512 B |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 255 B |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 192 B |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 84 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 323 B |
After Width: | Height: | Size: 158 KiB |
After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 417 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 324 KiB After Width: | Height: | Size: 53 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 228 KiB After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 325 B |
|
@ -0,0 +1,501 @@
|
|||
--vehicles/mounts api by, based on lib_mount(see below)
|
||||
|
||||
--License of lib_mount:
|
||||
-- Minetest mod: lib_mount
|
||||
-- =======================
|
||||
-- by blert2112
|
||||
|
||||
-- Based on the Boats mod by PilzAdam.
|
||||
|
||||
|
||||
-- -----------------------------------------------------------
|
||||
-- -----------------------------------------------------------
|
||||
|
||||
|
||||
-- Minetest Game mod: boats
|
||||
-- ========================
|
||||
-- by PilzAdam
|
||||
|
||||
-- License of source code:
|
||||
-- -----------------------
|
||||
-- WTFPL
|
||||
|
||||
|
||||
--from lib_mount (required by new functions)
|
||||
|
||||
|
||||
local mobs_redo = false
|
||||
if mobs.mod and mobs.mod == "redo" then
|
||||
mobs_redo = true
|
||||
end
|
||||
|
||||
local function is_group(pos, group)
|
||||
local nn = minetest.get_node(pos).name
|
||||
return minetest.get_item_group(nn, group) ~= 0
|
||||
end
|
||||
|
||||
local function force_detach(player)
|
||||
local attached_to = player:get_attach()
|
||||
if attached_to and attached_to:get_luaentity() then
|
||||
local entity = attached_to:get_luaentity()
|
||||
if entity.driver then
|
||||
if entity ~= nil then
|
||||
entity.driver = nil
|
||||
end
|
||||
end
|
||||
player:set_detach()
|
||||
end
|
||||
default.player_attached[player:get_player_name()] = false
|
||||
player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
|
||||
end
|
||||
|
||||
function object_attach(entity, player, attach_at, eye_offset)
|
||||
eye_offset = eye_offset or {x=0, y=0, z=0}
|
||||
force_detach(player)
|
||||
entity.driver = player
|
||||
entity.loaded = true
|
||||
player:set_attach(entity.object, "", attach_at, {x=0, y=0, z=0})
|
||||
|
||||
player:set_properties({visual_size = {x=1, y=1}})
|
||||
|
||||
player:set_eye_offset(eye_offset, {x=0, y=2, z=-40})
|
||||
default.player_attached[player:get_player_name()] = true
|
||||
minetest.after(0.2, function()
|
||||
default.player_set_animation(player, "sit" , 30)
|
||||
end)
|
||||
entity.object:setyaw(player:get_look_yaw() - math.pi / 2)
|
||||
end
|
||||
|
||||
function object_detach(entity, player, offset)
|
||||
entity.driver = nil
|
||||
entity.object:setvelocity({x=0, y=0, z=0})
|
||||
player:set_detach()
|
||||
default.player_attached[player:get_player_name()] = false
|
||||
default.player_set_animation(player, "stand" , 30)
|
||||
player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
|
||||
local pos = player:getpos()
|
||||
pos = {x = pos.x + offset.x, y = pos.y + 0.2 + offset.y, z = pos.z + offset.z}
|
||||
minetest.after(0.1, function()
|
||||
player:setpos(pos)
|
||||
end)
|
||||
end
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
force_detach(player)
|
||||
end)
|
||||
|
||||
minetest.register_on_shutdown(function()
|
||||
local players = minetest.get_connected_players()
|
||||
for i = 1,#players do
|
||||
force_detach(players[i])
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_dieplayer(function(player)
|
||||
force_detach(player)
|
||||
return true
|
||||
end)
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
--mixed code(from this mod and lib_mount)
|
||||
|
||||
function object_drive(entity, dtime, speed, decell, shoots, arrow, moving_anim, stand_anim, jumps)
|
||||
local ctrl = entity.driver:get_player_control()
|
||||
local velo = entity.object:getvelocity()
|
||||
local dir = entity.driver:get_look_dir();
|
||||
local vec_forward = {x=dir.x*speed,y=velo.y+1*-2,z=dir.z*speed}
|
||||
local vec_backward = {x=-dir.x*speed,y=velo.y+1*-2,z=-dir.z*speed}
|
||||
local vec_stop = {x=velo.x*decell,y=velo.y+1*-2,z=velo.z*decell}
|
||||
local yaw = entity.driver:get_look_yaw();
|
||||
if ctrl.up then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_forward)
|
||||
elseif ctrl.down then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_backward)
|
||||
elseif not ctrl.down or ctrl.up then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_stop)
|
||||
end
|
||||
if ctrl.sneak and shoots and entity.loaded then
|
||||
entity.loaded = false
|
||||
local pos = entity.object:getpos()
|
||||
local obj = minetest.env:add_entity({x=pos.x+0+dir.x*2,y=pos.y+1.5+dir.y,z=pos.z+0+dir.z*2}, arrow)
|
||||
local vec = {x=dir.x*9,y=dir.y*9,z=dir.z*9}
|
||||
local yaw = entity.driver:get_look_yaw();
|
||||
obj:setyaw(yaw+math.pi/2)
|
||||
obj:setvelocity(vec)
|
||||
minetest.after(1, function()
|
||||
entity.loaded = true
|
||||
end)
|
||||
end
|
||||
--lib_mount animation
|
||||
if velo.x == 0 and velo.y == 0 and velo.z == 0 then
|
||||
if stand_anim and stand_anim ~= nil and mobs_redo == true then
|
||||
set_animation(entity, stand_anim)
|
||||
end
|
||||
return
|
||||
end
|
||||
if moving_anim and moving_anim ~= nil then
|
||||
set_animation(entity, moving_anim)
|
||||
end
|
||||
--jumping not working
|
||||
-- local jumps = jumps or false
|
||||
-- if jumps == true and ctrl.jump then
|
||||
-- local xvel = entity.object:getvelocity().x
|
||||
-- local zvel = entity.object:getvelocity().z
|
||||
-- local yvel = entity.object:getvelocity().y
|
||||
-- local vel = {x=xvel,y=10,z=zvel}
|
||||
-- entity.object:setvelocity(vel)
|
||||
-- minetest.after(1.5, function()
|
||||
-- local xvel = entity.object:getvelocity().x
|
||||
-- local zvel = entity.object:getvelocity().z
|
||||
-- local yvel = entity.object:getvelocity().y
|
||||
-- local vel = {x=xvel,y=-10,z=zvel}
|
||||
-- entity.object:setvelocity(vel)
|
||||
-- end)
|
||||
-- end
|
||||
end
|
||||
|
||||
function object_drive_simple(entity, dtime, speed, decell)
|
||||
local ctrl = entity.driver:get_player_control()
|
||||
local velo = entity.object:getvelocity()
|
||||
local dir = entity.driver:get_look_dir();
|
||||
local vec_forward = {x=dir.x*speed,y=velo.y+1*-2,z=dir.z*speed}
|
||||
local vec_backward = {x=-dir.x*speed,y=velo.y+1*-2,z=-dir.z*speed}
|
||||
local vec_stop = {x=velo.x*decell,y=velo.y+1*-2,z=velo.z*decell}
|
||||
local yaw = entity.driver:get_look_yaw();
|
||||
if ctrl.up then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_forward)
|
||||
elseif ctrl.down then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_backward)
|
||||
elseif not ctrl.down or ctrl.up then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_stop)
|
||||
end
|
||||
end
|
||||
|
||||
function object_turret(entity, dtime, arrow, attack_anim, stand_anim)
|
||||
local ctrl = entity.driver:get_player_control()
|
||||
local pos = entity.driver:getpos();
|
||||
local yaw = entity.driver:get_look_yaw();
|
||||
entity.object:setpos(pos)
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
if ctrl.sneak and entity.loaded then
|
||||
entity.loaded = false
|
||||
local pos = entity.object:getpos()
|
||||
local obj = minetest.env:add_entity({x=pos.x+0+dir.x*2,y=pos.y+1.5+dir.y,z=pos.z+0+dir.z*2}, arrow)
|
||||
local yaw = entity.driver:get_look_yaw();
|
||||
local vec = {x=dir.x*9, y=dir.y*9, z=dir.z*9}
|
||||
obj:setyaw(yaw+math.pi/2)
|
||||
set_animation(entity, attack_anim)
|
||||
minetest.after(1, function()
|
||||
entity.loaded = true
|
||||
end)
|
||||
else
|
||||
set_animation(entity, stand_anim_anim)
|
||||
end
|
||||
end
|
||||
|
||||
function object_fly(entity, dtime, speed, accel, decell, shoots, arrow, moving_anim, stand_anim)
|
||||
local ctrl = entity.driver:get_player_control()
|
||||
local dir = entity.driver:get_look_dir();
|
||||
local velo = entity.object:getvelocity()
|
||||
local vec_forward = {x=dir.x*speed,y=dir.y*speed+3,z=dir.z*speed}
|
||||
local acc_forward = {x=dir.x*accel/2,y=dir.y*accel/2+3,z=dir.z*accel/2}
|
||||
local vec_backward = {x=-dir.x*speed,y=dir.y*speed+3,z=-dir.z*speed}
|
||||
local acc_backward = {x=dir.x*accel/2,y=dir.y*accel/2+3,z=dir.z*accel/2}
|
||||
local vec_stop = {x=velo.x*decell, y=velo.y, z=velo.z*decell}
|
||||
local yaw = entity.driver:get_look_yaw();
|
||||
if ctrl.up then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_forward)
|
||||
entity.object:setacceleration(acc_forward)
|
||||
elseif ctrl.down then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_backward)
|
||||
entity.object:setacceleration(acc_backward)
|
||||
elseif not ctrl.down or ctrl.up then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_stop)
|
||||
entity.object:setacceleration({x=0, y=-4.5, z=0})
|
||||
end
|
||||
if ctrl.sneak and shoots and entity.loaded then
|
||||
entity.loaded = false
|
||||
local pos = entity.object:getpos()
|
||||
local obj = minetest.env:add_entity({x=pos.x+0+dir.x*2,y=pos.y+1.5+dir.y,z=pos.z+0+dir.z*2}, arrow)
|
||||
local vec = {x=dir.x*9,y=dir.y*9,z=dir.z*9}
|
||||
obj:setyaw(yaw+math.pi/2)
|
||||
obj:setvelocity(vec)
|
||||
minetest.after(1, function()
|
||||
entity.loaded = true
|
||||
end)
|
||||
end
|
||||
--lib_mount animation
|
||||
if velo.x == 0 and velo.y == 0 and velo.z == 0 then
|
||||
if stand_anim and stand_anim ~= nilthen then
|
||||
set_animation(entity, stand_anim)
|
||||
end
|
||||
return
|
||||
end
|
||||
if moving_anim and moving_anim ~= nil then
|
||||
set_animation(entity, moving_anim)
|
||||
end
|
||||
end
|
||||
|
||||
function object_fly_2(entity, dtime, speed, accel, decell, shoots, arrow, moving_anim, stand_anim)
|
||||
local ctrl = entity.driver:get_player_control()
|
||||
local dir = entity.driver:get_look_dir();
|
||||
local yvel = entity.object:getvelocity().y
|
||||
local vec_forward = {x=dir.x*speed,y=yvel,z=dir.z*speed}
|
||||
local acc_forward = {x=dir.x*accel/2,y=yvel,z=dir.z*accel/2}
|
||||
local vec_backward = {x=-dir.x*speed,y=yvel,z=-dir.z*speed}
|
||||
local acc_backward = {x=dir.x*accel/2,y=yvel,z=dir.z*accel/2}
|
||||
local vec_stop = {x=entity.object:getvelocity().x*decell, y=entity.object:getvelocity().y, z=entity.object:getvelocity().z*decell}
|
||||
local vec_rise = {x=entity.object:getvelocity().x, y=speed*accel, z=entity.object:getvelocity().z}
|
||||
local yaw = entity.driver:get_look_yaw();
|
||||
if ctrl.up then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_forward)
|
||||
entity.object:setacceleration(acc_forward)
|
||||
elseif ctrl.down then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_backward)
|
||||
entity.object:setacceleration(acc_backward)
|
||||
elseif ctrl.jump then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_rise)
|
||||
elseif not ctrl.down or ctrl.up or ctrl.jump then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_stop)
|
||||
entity.object:setacceleration({x=0, y=-4.5, z=0})
|
||||
end
|
||||
if ctrl.sneak and shoots and entity.loaded then
|
||||
entity.loaded = false
|
||||
local pos = entity.object:getpos()
|
||||
local obj = minetest.env:add_entity({x=pos.x+0+dir.x*2,y=pos.y+1.5+dir.y,z=pos.z+0+dir.z*2}, arrow)
|
||||
local vec = {x=dir.x*9,y=dir.y*9,z=dir.z*9}
|
||||
local yaw = entity.driver:get_look_yaw();
|
||||
obj:setyaw(yaw+math.pi/2)
|
||||
obj:setvelocity(vec)
|
||||
minetest.after(1, function()
|
||||
entity.loaded = true
|
||||
end)
|
||||
end
|
||||
--lib_mount animation
|
||||
local velo = entity.object:getvelocity()
|
||||
if velo.x == 0 and velo.y == 0 and velo.z == 0 then
|
||||
if stand_anim and stand_anim ~= nilthen then
|
||||
set_animation(entity, stand_anim)
|
||||
end
|
||||
entity.object:setpos(entity.object:getpos())
|
||||
return
|
||||
end
|
||||
if moving_anim and moving_anim ~= nil then
|
||||
set_animation(entity, moving_anim)
|
||||
end
|
||||
end
|
||||
|
||||
function object_glide(entity, dtime, speed, decell, gravity, moving_anim, stand_anim)
|
||||
local ctrl = entity.driver:get_player_control()
|
||||
local dir = entity.driver:get_look_dir();
|
||||
local velo = entity.object:getvelocity();
|
||||
local vec_glide = {x=dir.x*speed*decell, y=velo.y, z=dir.z*speed*decell}
|
||||
local yaw = entity.driver:get_look_yaw();
|
||||
if not ctrl.sneak then
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec_glide)
|
||||
entity.object:setacceleration({x=0, y=gravity, z=0})
|
||||
end
|
||||
if ctrl.sneak then
|
||||
local vec = {x=0,y=gravity*15,z=0}
|
||||
local yaw = entity.driver:get_look_yaw();
|
||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:setvelocity(vec)
|
||||
end
|
||||
if velo.y == 0 then
|
||||
local pos = entity.object:getpos()
|
||||
for dx=-1,1 do
|
||||
for dy=-1,1 do
|
||||
for dz=-1,1 do
|
||||
local p = {x=pos.x+dx, y=pos.y-1, z=pos.z+dz}
|
||||
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
||||
local n = minetest.env:get_node(p).name
|
||||
if n ~= "massdestruct:parachute" and n ~= "air" then
|
||||
local pos = entity.object:getpos()
|
||||
entity.object:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--lib_mount animation
|
||||
if velo.x == 0 and velo.y == 0 and velo.z == 0 then
|
||||
if stand_anim and stand_anim ~= nilthen then
|
||||
set_animation(entity, stand_anim)
|
||||
end
|
||||
return
|
||||
end
|
||||
if moving_anim and moving_anim ~= nil then
|
||||
set_animation(entity, moving_anim)
|
||||
end
|
||||
end
|
||||
|
||||
--lib_mount (not required by new functions)
|
||||
|
||||
|
||||
local function is_group(pos, group)
|
||||
local nn = minetest.get_node(pos).name
|
||||
return minetest.get_item_group(nn, group) ~= 0
|
||||
end
|
||||
|
||||
local function get_sign(i)
|
||||
i = i or 0
|
||||
if i == 0 then
|
||||
return 0
|
||||
else
|
||||
return i / math.abs(i)
|
||||
end
|
||||
end
|
||||
|
||||
local function get_velocity(v, yaw, y)
|
||||
local x = -math.sin(yaw) * v
|
||||
local z = math.cos(yaw) * v
|
||||
return {x = x, y = y, z = z}
|
||||
end
|
||||
|
||||
local function get_v(v)
|
||||
return math.sqrt(v.x ^ 2 + v.z ^ 2)
|
||||
end
|
||||
|
||||
lib_mount = {}
|
||||
|
||||
function lib_mount.attach(entity, player, attach_at, eye_offset)
|
||||
eye_offset = eye_offset or {x=0, y=0, z=0}
|
||||
force_detach(player)
|
||||
entity.driver = player
|
||||
player:set_attach(entity.object, "", attach_at, {x=0, y=0, z=0})
|
||||
|
||||
player:set_properties({visual_size = {x=1, y=1}})
|
||||
|
||||
player:set_eye_offset(eye_offset, {x=0, y=0, z=0})
|
||||
default.player_attached[player:get_player_name()] = true
|
||||
minetest.after(0.2, function()
|
||||
default.player_set_animation(player, "sit" , 30)
|
||||
end)
|
||||
entity.object:setyaw(player:get_look_yaw() - math.pi / 2)
|
||||
end
|
||||
|
||||
function lib_mount.detach(entity, player, offset)
|
||||
entity.driver = nil
|
||||
player:set_detach()
|
||||
default.player_attached[player:get_player_name()] = false
|
||||
default.player_set_animation(player, "stand" , 30)
|
||||
player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
|
||||
local pos = player:getpos()
|
||||
pos = {x = pos.x + offset.x, y = pos.y + 0.2 + offset.y, z = pos.z + offset.z}
|
||||
minetest.after(0.1, function()
|
||||
player:setpos(pos)
|
||||
end)
|
||||
end
|
||||
|
||||
function lib_mount.drive(entity, dtime, moving_anim, stand_anim, can_fly)
|
||||
entity.v = get_v(entity.object:getvelocity()) * get_sign(entity.v)
|
||||
|
||||
local ctrl = entity.driver:get_player_control()
|
||||
local yaw = entity.object:getyaw()
|
||||
if ctrl.up then
|
||||
entity.v = entity.v + 0.1
|
||||
elseif ctrl.down then
|
||||
entity.v = entity.v - 0.1
|
||||
end
|
||||
if ctrl.left then
|
||||
if entity.v < 0 then
|
||||
entity.object:setyaw(yaw - (1 + dtime) * 0.03)
|
||||
else
|
||||
entity.object:setyaw(yaw + (1 + dtime) * 0.03)
|
||||
end
|
||||
elseif ctrl.right then
|
||||
if entity.v < 0 then
|
||||
entity.object:setyaw(yaw + (1 + dtime) * 0.03)
|
||||
else
|
||||
entity.object:setyaw(yaw - (1 + dtime) * 0.03)
|
||||
end
|
||||
end
|
||||
|
||||
local velo = entity.object:getvelocity()
|
||||
if entity.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then
|
||||
if stand_anim and stand_anim ~= nil and mobs_redo == true then
|
||||
set_animation(entity, stand_anim)
|
||||
end
|
||||
entity.object:setpos(entity.object:getpos())
|
||||
return
|
||||
end
|
||||
if moving_anim and moving_anim ~= nil and mobs_redo == true then
|
||||
set_animation(entity, moving_anim)
|
||||
end
|
||||
local s = get_sign(entity.v)
|
||||
entity.v = entity.v - 0.02 * s
|
||||
if s ~= get_sign(entity.v) then
|
||||
entity.object:setvelocity({x = 0, y = 0, z = 0})
|
||||
entity.v = 0
|
||||
return
|
||||
end
|
||||
if math.abs(entity.v) > 5 then
|
||||
entity.v = 5 * get_sign(entity.v)
|
||||
end
|
||||
|
||||
local p = entity.object:getpos()
|
||||
p.y = p.y - 0.5
|
||||
local new_velo = {x = 0, y = 0, z = 0}
|
||||
local new_acce = {x = 0, y = 0, z = 0}
|
||||
if not is_group(p, "crumbly") then
|
||||
local nodedef = minetest.registered_nodes[minetest.get_node(p).name]
|
||||
if (not nodedef) or nodedef.walkable then
|
||||
entity.v = 0
|
||||
new_acce = {x = 0, y = 1, z = 0}
|
||||
else
|
||||
new_acce = {x = 0, y = -9.8, z = 0}
|
||||
end
|
||||
new_velo = get_velocity(entity.v, entity.object:getyaw(),
|
||||
entity.object:getvelocity().y)
|
||||
entity.object:setpos(entity.object:getpos())
|
||||
else
|
||||
p.y = p.y + 1
|
||||
if is_group(p, "crumbly") then
|
||||
local y = entity.object:getvelocity().y
|
||||
if y >= 5 then
|
||||
y = 5
|
||||
elseif y < 0 then
|
||||
new_acce = {x = 0, y = 20, z = 0}
|
||||
else
|
||||
new_acce = {x = 0, y = 5, z = 0}
|
||||
end
|
||||
new_velo = get_velocity(entity.v, entity.object:getyaw(), y)
|
||||
entity.object:setpos(entity.object:getpos())
|
||||
else
|
||||
new_acce = {x = 0, y = 0, z = 0}
|
||||
if math.abs(entity.object:getvelocity().y) < 1 then
|
||||
local pos = entity.object:getpos()
|
||||
pos.y = math.floor(pos.y) + 0.5
|
||||
entity.object:setpos(pos)
|
||||
new_velo = get_velocity(entity.v, entity.object:getyaw(), 0)
|
||||
else
|
||||
new_velo = get_velocity(entity.v, entity.object:getyaw(),
|
||||
entity.object:getvelocity().y)
|
||||
entity.object:setpos(entity.object:getpos())
|
||||
end
|
||||
end
|
||||
end
|
||||
if can_fly and can_fly == true and ctrl.jump then
|
||||
new_velo.y = new_velo.y + 0.75
|
||||
end
|
||||
entity.object:setvelocity(new_velo)
|
||||
entity.object:setacceleration(new_acce)
|
||||
end
|