added saddle to pet scorpion so you can ride it.

master
NathanSalapat 2020-06-01 14:12:05 -05:00
parent 73996d7571
commit 46490be39e
3 changed files with 38 additions and 17 deletions

View File

@ -92,12 +92,12 @@ mobs:register_mob('scorpion:boss', {
}) })
mobs:spawn({ mobs:spawn({
name = 'scorpion:big', name = 'scorpion:boss',
nodes = {'default:desert_stone'}, nodes = {'default:desert_stone'},
max_light = 14, max_light = 10,
min_height = 0, min_height = 0,
max_height = 150, max_height = 150,
interval = 60, interval = 45,
chance = 9000, chance = 10000,
active_object_count = 1, active_object_count = 1,
}) })

View File

@ -2,7 +2,7 @@ mobs:register_mob('scorpion:little', {
type = 'monster', type = 'monster',
passive = false, passive = false,
attack_type = 'dogfight', attack_type = 'dogfight',
damage = 3, damage = 5,
hp_min = 30, hp_max = 75, armor = 45, hp_min = 30, hp_max = 75, armor = 45,
collisionbox = {-0.6, -0.35, -0.5, 0.6, 0.3, 0.5}, collisionbox = {-0.6, -0.35, -0.5, 0.6, 0.3, 0.5},
visual = 'mesh', visual = 'mesh',

45
pet.lua
View File

@ -14,7 +14,6 @@ mobs:register_mob('scorpion:pet', {
collisionbox = {-0.6, -0.35, -0.5, 0.6, 0.3, 0.5}, collisionbox = {-0.6, -0.35, -0.5, 0.6, 0.3, 0.5},
visual = 'mesh', visual = 'mesh',
mesh = 'scorpion.b3d', mesh = 'scorpion.b3d',
drawtype = 'front',
textures = { textures = {
{'scorpion_red.png^scorpion_pet.png'}, {'scorpion_red.png^scorpion_pet.png'},
{'scorpion_green.png^scorpion_pet.png'}, {'scorpion_green.png^scorpion_pet.png'},
@ -71,17 +70,39 @@ mobs:register_mob('scorpion:pet', {
if mobs:feed_tame(self, clicker, 10, false, true) then if mobs:feed_tame(self, clicker, 10, false, true) then
return return
end end
if self.owner and self.owner == name then if self.owner and self.owner == name then
if self.order == 'follow' then if item ~= 'mobs:saddle' then
self.order = 'stand' if self.order == 'follow' then
minetest.chat_send_player(name, ('Scorpion holding ground.')) self.order = 'stand'
else minetest.chat_send_player(name, ('Scorpion holding ground.'))
self.order = 'follow' else
minetest.chat_send_player(name, ('Scorpion following you.')) self.order = 'follow'
end minetest.chat_send_player(name, ('Scorpion following you.'))
mobs:capture_mob(self, clicker, 20, 0, 100, false, nil) end
end mobs:capture_mob(self, clicker, 20, 0, 100, false, nil)
end, 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) on_grown = function(self)
local owner = self.owner local owner = self.owner