Compare commits

...

5 Commits

Author SHA1 Message Date
Nathan Salapat 6ce3fb040c Added license info. Fixes #1 2021-02-07 07:49:57 -06:00
NathanSalapat 46490be39e added saddle to pet scorpion so you can ride it. 2020-06-01 14:12:05 -05:00
NathanSalapat 73996d7571 little tweaks 2020-04-12 20:36:22 -05:00
NathanSalapat 06d167a175 minor updates. 2019-09-07 14:19:21 -05:00
NathanSalapat 3e123fcef9 tidied code, added pet scorpion. 2019-08-05 09:35:04 -05:00
11 changed files with 334 additions and 133 deletions

90
big.lua
View File

@ -1,46 +1,56 @@
mobs:register_mob("scorpion:big", {
type = "monster",
passive = false,
attack_type = "dogfight",
damage = 15,
hp_min = 50, hp_max = 100, armor = 30,
collisionbox = {-1.2, -.6, -1, 1.2, 0.6, 1},
visual = "mesh",
mesh = "scorpion.b3d",
drawtype = "front",
textures = {
{"scorpion_red.png"},
{"scorpion_green.png"},
},
blood_texture = "mobs_blood.png",
visual_size = {x=13,y=13},
makes_footstep_sound = true,
mobs:register_mob('scorpion:big', {
type = 'monster',
passive = false,
attack_type = 'dogfight',
damage = 15,
hp_min = 50, hp_max = 100, armor = 30,
collisionbox = {-1.2, -.6, -1, 1.2, 0.6, 1},
visual = 'mesh',
mesh = 'scorpion.b3d',
drawtype = 'front',
textures = {
{'scorpion_red.png'},
{'scorpion_green.png'},
{'scorpion_tan.png'},
},
blood_texture = 'mobs_blood.png',
visual_size = {x=13,y=13},
makes_footstep_sound = true,
sounds = {
war_cry = "scorpion_squeak",
},
war_cry = 'scorpion_squeak',
},
walk_velocity = .5,
run_velocity = 2,
jump = true,
stepheight = 2.2,
run_velocity = 2,
jump = true,
stepheight = 2.2,
reach = 4,
view_range = 4,
view_range = 8,
fear_height = 5,
drops = {
{name = "mobs:meat_raw", chance = 1, min = 5, max = 20},
},
water_damage = 1,
lava_damage = 20,
light_damage = 0,
animation = {
speed_normal = 15, speed_run = 15,
stand_start = 0, stand_end = 60,
walk_start = 150, walk_end = 210,
run_start = 150, run_end = 210,
punch_start = 220, punch_end = 260,
punch2_start = 265, punch2_end = 305,
punch3_start = 70, punch3_end = 140,
},
drops = {
{name = 'mobs:meat_raw', chance = 1, min = 5, max = 20},
{name = 'scorpion:shell', chance = 1, min = 5, max = 20},
},
water_damage = 2,
lava_damage = 60,
light_damage = 0,
animation = {
speed_normal = 15, speed_run = 15,
stand_start = 0, stand_end = 60,
walk_start = 150, walk_end = 210,
run_start = 150, run_end = 210,
punch_start = 220, punch_end = 260,
punch2_start = 265, punch2_end = 305,
punch3_start = 70, punch3_end = 140,
},
})
mobs:register_spawn("scorpion:big", {"default:desert_sand"}, 20, 0, 1000, 5, 31000)
mobs:register_egg("scorpion:big", "Big Scorpion", "default_grass.png", 1)
mobs:spawn({
name = 'scorpion:big',
nodes = {'default:desert_sand'},
max_light = 14,
min_height = -10,
max_height = 150,
interval = 45,
chance = 5000,
active_object_count = 5,
})

140
boss.lua
View File

@ -1,59 +1,103 @@
mobs:register_mob("scorpion:boss", {
type = "monster",
passive = false,
attack_type = "dogfight",
damage = 20,
hp_min = 75, hp_max = 175, armor = 20,
collisionbox = {-1, -0.95, -1, 1, .35, 1},
visual = "mesh",
mesh = "scorpion.b3d",
drawtype = "front",
textures = {
{"scorpion_red.png^scorpion_armor.png"},
{"scorpion_green.png^scorpion_armor.png"},
},
blood_texture = "mobs_blood.png",
visual_size = {x=20,y=20},
makes_footstep_sound = true,
sounds = {
war_cry = "scorpion_squeak",
},
walk_velocity = 3,
run_velocity = 7,
jump = true,
stepheight = 3,
drops = {
{name = "mobs:meat_raw", chance = 1, min = 5, max = 15},
{name = "default:diamondblock", chance = 3, min = 4, max = 15},
{name = "default:mese", chance = 3, min = 4, max = 15},
{name = "default:steel_ingot", chance = 2, min = 10, max = 40},
},
water_damage = 1,
lava_damage = 20,
light_damage = 0,
mobs:register_mob('scorpion:boss', {
type = 'monster',
passive = false,
attack_type = 'dogfight',
damage = 2,
hp_min = 75, hp_max = 175, armor = 20,
collisionbox = {-1, -0.95, -1, 1, .35, 1},
visual = 'mesh',
mesh = 'scorpion.b3d',
drawtype = 'front',
textures = {
{'scorpion_red.png^scorpion_armor.png'},
{'scorpion_green.png^scorpion_armor.png'},
{'scorpion_tan.png^scorpion_armor.png'},
},
blood_texture = 'mobs_blood.png',
visual_size = {x=20,y=20},
makes_footstep_sound = true,
sounds = {
war_cry = 'scorpion_squeak',
},
walk_velocity = 3,
run_velocity = 7,
jump = true,
stepheight = 3,
drops = {
{name = 'mobs:meat_raw', chance = 1, min = 5, max = 15},
{name = 'default:diamondblock', chance = 3, min = 4, max = 15},
{name = 'default:mese', chance = 3, min = 4, max = 15},
{name = 'default:steel_ingot', chance = 2, min = 10, max = 40},
{name = 'scorpion:shell', chance = 1, min = 20, max = 100},
},
water_damage = 20,
lava_damage = 60,
light_damage = 0,
reach = 5,
view_range = 10,
view_range = 12,
fear_height = 9,
animation = {
speed_normal = 15, speed_run = 15,
stand_start = 0, stand_end = 60,
walk_start = 150, walk_end = 210,
run_start = 150, run_end = 210,
punch_start = 220, punch_end = 260,
punch2_start = 265, punch2_end = 305,
punch3_start = 70, punch3_end = 140,
},
animation = {
speed_normal = 15, speed_run = 15,
stand_start = 0, stand_end = 60,
walk_start = 150, walk_end = 210,
run_start = 150, run_end = 210,
punch_start = 220, punch_end = 260,
punch2_start = 265, punch2_end = 305,
punch3_start = 70, punch3_end = 140,
},
custom_attack = function(self)
local random_number = math.random(0,8)
local random_number = math.random(20)
print (random_number)
if random_number == 3 then
if random_number < 5 then
local s = self.object:get_pos()
local pos1 = {x=s.x+math.random(-3,3), y=s.y, z=s.z+math.random(-3,3)}
minetest.add_entity(pos1, "scorpion:little")
minetest.add_entity(pos1, 'scorpion:little')
elseif random_number == 16 then
local s = self.object:get_pos()
local pos1 = {x=s.x+math.random(-3,3), y=s.y, z=s.z+math.random(-3,3)}
minetest.add_entity(pos1, 'scorpion:big')
end
end,
on_die = function(self)
local random_number = math.random(0,2)
if random_number == 1 then
local pos = self.object:get_pos()
local objs = minetest.get_objects_inside_radius(pos, 4)
for _, obj in pairs(objs) do
if obj:is_player() then
local pos1 = {x=pos.x+math.random(-2,2), y=pos.y, z=pos.z+math.random(-2,2)}
local mob = minetest.add_entity(pos1, 'scorpion:pet')
local ent2 = mob:get_luaentity()
mob:set_properties({
visual_size = {
x = ent2.base_size.x / 2,
y = ent2.base_size.y / 2
},
collisionbox = {
ent2.base_colbox[1] / 2,
ent2.base_colbox[2] / 2,
ent2.base_colbox[3] / 2,
ent2.base_colbox[4] / 2,
ent2.base_colbox[5] / 2,
ent2.base_colbox[6] / 2
},
})
ent2.child = true
end
end
end
end,
})
mobs:register_spawn("scorpion:boss", {"default:desert_stone"}, 20, 0, 5000, 1, 31000)
mobs:register_egg("scorpion:boss", "Boss Scorpion", "default_grass.png", 1)
mobs:spawn({
name = 'scorpion:boss',
nodes = {'default:desert_stone'},
max_light = 10,
min_height = 0,
max_height = 150,
interval = 45,
chance = 10000,
active_object_count = 1,
})

View File

@ -1,7 +1,9 @@
if mobs.mod and mobs.mod == "redo" then
dofile(minetest.get_modpath('scorpion')..'/little.lua')
dofile(minetest.get_modpath('scorpion')..'/big.lua')
dofile(minetest.get_modpath('scorpion')..'/boss.lua')
dofile(minetest.get_modpath('scorpion')..'/pet.lua')
end
minetest.register_craftitem('scorpion:shell', {
description = 'Piece of insect shell',
inventory_image = 'scorpion_shell_piece.png',
})

6
license.txt Normal file
View File

@ -0,0 +1,6 @@
Code:
Nathan Salapat MIT
Media:
Textures and Sounds
Nathan Salapat CC by SA 3.0

View File

@ -1,46 +1,54 @@
mobs:register_mob("scorpion:little", {
type = "monster",
passive = false,
attack_type = "dogfight",
damage = 3,
hp_min = 30, hp_max = 75, armor = 45,
collisionbox = {-0.6, -0.35, -0.5, 0.6, 0.3, 0.5},
visual = "mesh",
mesh = "scorpion.b3d",
drawtype = "front",
textures = {
{"scorpion_red.png"},
{"scorpion_green.png"},
},
blood_texture = "mobs_blood.png",
visual_size = {x=7,y=7},
makes_footstep_sound = true,
mobs:register_mob('scorpion:little', {
type = 'monster',
passive = false,
attack_type = 'dogfight',
damage = 5,
hp_min = 30, hp_max = 75, armor = 45,
collisionbox = {-0.6, -0.35, -0.5, 0.6, 0.3, 0.5},
visual = 'mesh',
mesh = 'scorpion.b3d',
textures = {
{'scorpion_red.png'},
{'scorpion_green.png'},
{'scorpion_tan.png'},
},
blood_texture = 'mobs_blood.png',
visual_size = {x=7,y=7},
makes_footstep_sound = true,
sounds = {
war_cry = "scorpion_squeak",
},
walk_velocity = 2,
run_velocity = 6,
jump = true,
stepheight = 1.7,
reach = 2,
view_range = 2,
war_cry = 'scorpion_squeak',
},
walk_velocity = 2,
run_velocity = 6,
jump = true,
stepheight = 1.7,
reach = 3,
view_range = 7,
fear_height = 2,
drops = {
{name = "mobs:meat_raw", chance = 1, min = 2, max = 8},
},
water_damage = 2,
lava_damage = 20,
light_damage = 0,
animation = {
speed_normal = 45, speed_run = 90,
stand_start = 0, stand_end = 60,
walk_start = 150, walk_end = 210,
run_start = 150, run_end = 210,
punch_start = 220, punch_end = 260,
punch2_start = 265, punch2_end = 305,
punch3_start = 70, punch3_end = 140,
},
drops = {
{name = 'mobs:meat_raw', chance = 1, min = 2, max = 8},
{name = 'scorpion:shell', chance = 1, min = 1, max = 10},
},
water_damage = 2,
lava_damage = 60,
light_damage = 0,
animation = {
speed_normal = 45, speed_run = 90,
stand_start = 0, stand_end = 60,
walk_start = 150, walk_end = 210,
run_start = 150, run_end = 210,
punch_start = 220, punch_end = 260,
punch2_start = 265, punch2_end = 305,
punch3_start = 70, punch3_end = 140,
},
})
mobs:register_spawn("scorpion:little", {"default:dirt_with_rainforest_litter", "default:desert_sand"}, 20, 0, 1000, 15, 31000)
mobs:register_egg("scorpion:little", "Little Scorpion", "default_grass.png", 1)
mobs:spawn({
name = 'scorpion:little',
nodes = {'default:desert_sand', 'default:dirt_with_rainforest_litter', 'default:dry_dirt_with_grass'},
min_height = -10,
max_height = 200,
interval = 45,
chance = 3000,
active_object_count = 5,
})

131
pet.lua Normal file
View File

@ -0,0 +1,131 @@
local get_distance = function(a, b)
local x, y, z = a.x - b.x, a.y - b.y, a.z - b.z
return (x * x + y * y + z * z)
end
mobs:register_mob('scorpion:pet', {
type = 'npc',
passive = false,
attack_type = 'dogfight',
owner_loyal = true,
pathfinding = true,
damage = 10,
hp_min = 30, hp_max = 75, armor = 20,
collisionbox = {-0.6, -0.35, -0.5, 0.6, 0.3, 0.5},
visual = 'mesh',
mesh = 'scorpion.b3d',
textures = {
{'scorpion_red.png^scorpion_pet.png'},
{'scorpion_green.png^scorpion_pet.png'},
{'scorpion_tan.png^scorpion_pet.png'},
},
follow = {'mobs:meat_raw', 'mobs:chicken_raw'},
blood_texture = 'mobs_blood.png',
visual_size = {x=8,y=8},
makes_footstep_sound = true,
sounds = {
war_cry = 'scorpion_squeak',
},
walk_velocity = 3,
run_velocity = 6,
jump = true,
stepheight = 1.7,
reach = 4,
view_range = 15,
fear_height = 2,
owner = '',
order = 'follow',
drops = {
{name = 'mobs:meat_raw', chance = 1, min = 2, max = 8},
{name = 'scorpion:shell', chance = 1, min = 5, max = 20},
},
water_damage = 1,
lava_damage = 6,
light_damage = 0,
animation = {
speed_normal = 45, speed_run = 90,
stand_start = 0, stand_end = 60,
walk_start = 150, walk_end = 210,
run_start = 150, run_end = 210,
punch_start = 220, punch_end = 260,
punch2_start = 265, punch2_end = 305,
punch3_start = 70, punch3_end = 140,
},
on_spawn = function(self)
local pos = self.object:get_pos()
local objs = minetest.get_objects_inside_radius(pos, 4)
for _, obj in pairs(objs) do
if obj:is_player() then
local owner = obj:get_player_name()
self.owner = owner
minetest.chat_send_player(owner, "Aww, a baby scorpion think you're its parent!")
end
end
return true
end,
on_rightclick = function(self, clicker)
local name = clicker:get_player_name()
if mobs:feed_tame(self, clicker, 10, false, true) then
return
end
if self.owner and self.owner == name then
if item ~= 'mobs:saddle' then
if self.order == 'follow' then
self.order = 'stand'
minetest.chat_send_player(name, ('Scorpion holding ground.'))
else
self.order = 'follow'
minetest.chat_send_player(name, ('Scorpion following you.'))
end
mobs:capture_mob(self, clicker, 20, 0, 100, false, nil)
end
-- detatch player
if self.driver and clicker == self.driver then
mobs.detach(clicker, {x = 1, y = 0, z = 1})
-- add saddle back to inventory
if inv:room_for_item("main", "mobs:saddle") then
inv:add_item("main", "mobs:saddle")
else
minetest.add_item(clicker:get_pos(), "mobs:saddle")
end
self.saddle = nil
-- attach player
elseif (not self.driver and not self.child and item == "mobs:saddle")
or self.saddle then
self.object:set_properties({stepheight = 1.1})
mobs.attach(self, clicker)
if not self.saddle then
inv:remove_item("main", "mobs:saddle")
end
self.saddle = true
end
end
end,
on_grown = function(self)
local owner = self.owner
minetest.chat_send_player(owner, ('Your pet scorpion grew up!'))
end,
do_custom = function(self, dtime) --Thanks to IhrFussel for many ideas used in this code block.
self.dtime = (self.dtime or 0) + dtime
if self.dtime < 5 then
return
end
self.dtime = 0
local pet_pos = self.object:get_pos()
local owner = minetest.get_player_by_name(self.owner) or false
if owner then --and self.state == "walk
local distance = get_distance(owner:getpos(), pet_pos)
if distance > 1000 then --should teleport to player
if self.order == 'follow' then --but only if following
self.object:set_pos(owner:getpos())
end
end
end
end,
})
mobs:register_egg('scorpion:pet', 'Pet Scorpion', 'default_grass.png', 1)

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 100 KiB

BIN
textures/scorpion_pet.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
textures/scorpion_tan.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 KiB