Working on new mobs

master
npx 2016-05-17 00:04:26 +02:00
parent 5574769b2b
commit ab0cac7dd2
8 changed files with 3451 additions and 5 deletions

BIN
models/pupumolle.b3d Normal file

Binary file not shown.

290
models/pupumolle.x Normal file
View File

@ -0,0 +1,290 @@
xof 0303txt 0032
template XSkinMeshHeader {
<3cf169ce-ff7c-44ab-93c0-f78f62d172e2>
WORD nMaxSkinWeightsPerVertex;
WORD nMaxSkinWeightsPerFace;
WORD nBones;
}
template SkinWeights {
<6f0d123b-bad2-4167-a0d0-80224f25fabb>
STRING transformNodeName;
DWORD nWeights;
array DWORD vertexIndices[nWeights];
array float weights[nWeights];
Matrix4x4 matrixOffset;
}
Frame Root {
FrameTransformMatrix {
1.000000, 0.000000, 0.000000, 0.000000,
0.000000,-0.000000, 1.000000, 0.000000,
0.000000, 1.000000, 0.000000, 0.000000,
0.000000, 0.000000, 0.000000, 1.000000;;
}
Frame Armature {
FrameTransformMatrix {
1.000000, 0.000000, 0.000000, 0.000000,
0.000000, 1.000000, 0.000000, 0.000000,
0.000000, 0.000000, 1.000000, 0.000000,
0.000000, 0.000000, 0.534085, 1.000000;;
}
Frame Armature_cacca {
FrameTransformMatrix {
1.000000, 0.000000, 0.000000, 0.000000,
0.000000, 0.000000, 1.000000, 0.000000,
0.000000,-1.000000, 0.000000, 0.000000,
0.000000, 0.000000, 0.617923, 1.000000;;
}
} // End of Armature_cacca
Frame Armature_Bone {
FrameTransformMatrix {
1.000000, 0.000000, 0.000000, 0.000000,
0.000000, 0.000000, 1.000000, 0.000000,
0.000000,-1.000000, 0.000000, 0.000000,
0.000000, 0.000000,-0.534085, 1.000000;;
}
} // End of Armature_Bone
Frame Cube {
FrameTransformMatrix {
1.000000, 0.000000, 0.000000, 0.000000,
0.000000, 1.000000, 0.000000, 0.000000,
0.000000, 0.000000, 1.000000, 0.000000,
0.000000, 0.000000, 1.575049, 1.000000;;
}
Mesh { // Cube mesh
48;
0.197559; 0.225245;-2.122665;,
0.197559;-0.225245;-2.122665;,
-0.197559;-0.225245;-2.122665;,
-0.197559; 0.225245;-2.122665;,
0.197559; 0.225245;-1.005895;,
-0.197559; 0.225245;-1.005895;,
-0.197559;-0.225245;-1.005895;,
0.197559;-0.225245;-1.005895;,
0.197559; 0.225245;-2.122665;,
0.197559; 0.225245;-1.005895;,
0.197559;-0.225245;-1.005895;,
0.197559;-0.225245;-2.122665;,
0.197559;-0.225245;-2.122665;,
0.197559;-0.225245;-1.005895;,
-0.197559;-0.225245;-1.005895;,
-0.197559;-0.225245;-2.122665;,
-0.197559;-0.225245;-2.122665;,
-0.197559;-0.225245;-1.005895;,
-0.197559; 0.225245;-1.005895;,
-0.197559; 0.225245;-2.122665;,
0.197559; 0.225245;-1.005895;,
0.197559; 0.225245;-2.122665;,
-0.197559; 0.225245;-2.122665;,
-0.197559; 0.225245;-1.005895;,
1.000000; 1.000000;-1.000000;,
1.000000;-1.000000;-1.000000;,
-1.000000;-1.000000;-1.000000;,
-1.000000; 1.000000;-1.000000;,
1.000000; 0.999999; 1.000000;,
-1.000000; 1.000000; 1.000000;,
-1.000000;-1.000000; 1.000000;,
0.999999;-1.000001; 1.000000;,
1.000000; 1.000000;-1.000000;,
1.000000; 0.999999; 1.000000;,
0.999999;-1.000001; 1.000000;,
1.000000;-1.000000;-1.000000;,
1.000000;-1.000000;-1.000000;,
0.999999;-1.000001; 1.000000;,
-1.000000;-1.000000; 1.000000;,
-1.000000;-1.000000;-1.000000;,
-1.000000;-1.000000;-1.000000;,
-1.000000;-1.000000; 1.000000;,
-1.000000; 1.000000; 1.000000;,
-1.000000; 1.000000;-1.000000;,
1.000000; 0.999999; 1.000000;,
1.000000; 1.000000;-1.000000;,
-1.000000; 1.000000;-1.000000;,
-1.000000; 1.000000; 1.000000;;
12;
4;3,2,1,0;,
4;7,6,5,4;,
4;11,10,9,8;,
4;15,14,13,12;,
4;19,18,17,16;,
4;23,22,21,20;,
4;27,26,25,24;,
4;31,30,29,28;,
4;35,34,33,32;,
4;39,38,37,36;,
4;43,42,41,40;,
4;47,46,45,44;;
MeshTextureCoords { // Cube UV coordinates
48;
0.530892; 0.333333;,
0.530892; 0.258251;,
0.465039; 0.258251;,
0.465039; 0.333333;,
0.465039; 0.258251;,
0.399186; 0.258251;,
0.399186; 0.333333;,
0.465039; 0.333333;,
0.741748; 0.480538;,
0.741748; 0.294410;,
0.666667; 0.294410;,
0.666667; 0.480538;,
0.333333; 0.147205;,
0.333333; 0.333333;,
0.399186; 0.333333;,
0.399186; 0.147205;,
0.666667; 0.480538;,
0.666667; 0.666667;,
0.741748; 0.666667;,
0.741748; 0.480538;,
0.741748; 0.480538;,
0.741749; 0.666667;,
0.807601; 0.666667;,
0.807601; 0.480538;,
0.000000; 0.333333;,
0.333333; 0.333333;,
0.333333; 0.000000;,
0.000000; 0.000000;,
1.000000; 1.000000;,
1.000000; 0.666667;,
0.666667; 0.666667;,
0.666667; 1.000000;,
0.333333; 0.333333;,
0.000000; 0.333333;,
0.000000; 0.666667;,
0.333333; 0.666666;,
0.333333; 0.666667;,
0.333333; 1.000000;,
0.666667; 1.000000;,
0.666667; 0.666667;,
0.333333; 0.666667;,
0.000000; 0.666667;,
0.000000; 1.000000;,
0.333333; 1.000000;,
0.333333; 0.666667;,
0.666667; 0.666667;,
0.666667; 0.333333;,
0.333333; 0.333333;;
} // End of Cube UV coordinates
XSkinMeshHeader {
1;
3;
2;
}
SkinWeights {
"Armature_Bone";
24;
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23;
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000;
1.000000, 0.000000, 0.000000, 0.000000,
0.000000, 0.000000,-1.000000, 0.000000,
0.000000, 1.000000, 0.000000, 0.000000,
0.000000, 2.109134, 0.000000, 1.000000;;
} // End of Armature_Bone skin weights
SkinWeights {
"Armature_cacca";
24;
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47;
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000,
1.000000;
1.000000,-0.000000, 0.000000, 0.000000,
0.000000, 0.000000,-1.000000, 0.000000,
0.000000, 1.000000, 0.000000, 0.000000,
0.000000, 0.957125, 0.000000, 1.000000;;
} // End of Armature_cacca skin weights
} // End of Cube mesh
} // End of Cube
} // End of Armature
} // End of Root

View File

@ -32,7 +32,7 @@ mobs:register_mob("nssm:mordain", {
on_rightclick = nil,
attack_type = "dogfight",
animation = {
speed_normal = 20,
speed_normal = 15,
speed_run = 20,
stand_start = 10,
stand_end = 90,
@ -44,11 +44,14 @@ mobs:register_mob("nssm:mordain", {
punch_end = 225,
},
custom_attack = function(self)
if self.timer > 1 then
self.timer = 0
self.mordain_timer = (self.mordain_timer or os.time())
if (os.time() - self.mordain_timer) > 1 then
self.mordain_timer = os.time()
local s = self.object:getpos()
local p = self.attack:getpos()
set_animation(self, "punch")
if minetest.line_of_sight({x = p.x, y = p.y +1.5, z = p.z}, {x = s.x, y = s.y +1.5, z = s.z}) == true then
-- play attack sound
if self.sounds.attack then

View File

@ -44,5 +44,51 @@ mobs:register_mob("nssm:morde", {
run_end = 120,
punch_start = 130,
punch_end = 160,
}
},
custom_attack = function (self)
self.morde_timer = (self.morde_timer or os.time())
if (os.time() - self.morde_timer) > 1 then
self.morde_timer = os.time()
local s = self.object:getpos()
local p = self.attack:getpos()
set_animation(self, "punch")
self.health = self.health + self.damage
local m = 3
if minetest.line_of_sight({x = p.x, y = p.y +1.5, z = p.z}, {x = s.x, y = s.y +1.5, z = s.z}) == true then
-- play attack sound
if self.sounds.attack then
minetest.sound_play(self.sounds.attack, {
object = self.object,
max_hear_distance = self.sounds.distance
})
end
-- punch player
self.attack:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=self.damage}
}, nil)
minetest.add_particlespawner(
6, --amount
1, --time
{x=p.x-0.5, y=p.y-0.5, z=p.z-0.5}, --minpos
{x=p.x+0.5, y=p.y+0.5, z=p.z+0.5}, --maxpos
{x=(s.x-p.x)*m, y=(s.y-p.y+1)*m, z=(s.z-p.z)*m}, --minvel
{x=(s.x-p.x)*m, y=(s.y-p.y+1)*m, z=(s.z-p.z)*m}, --maxvel
{x=s.x-p.x, y=s.y-p.y+1, z=s.z-p.z}, --minacc
{x=s.x-p.x, y=s.y-p.y+1, z=s.z-p.z}, --maxacc
0.2, --minexptime
0.3, --maxexptime
2, --minsize
3, --maxsize
false, --collisiondetection
"morparticle.png" --texture
)
end
end
end
})

View File

@ -14,6 +14,7 @@ mobs:register_mob("nssm:morgut", {
reach =2,
run_velocity = 3.5,
damage = 4,
runaway = true,
jump = true,
--[[sounds = {
random = "",
@ -44,5 +45,37 @@ mobs:register_mob("nssm:morgut", {
run_end = 120,
punch_start = 130,
punch_end = 160,
}
},
do_custom = function (self)
self.flag = (self.flag or 0)
--[[if self.flag == 1 then
local pyaw = self.curr_attack:get_look_yaw()
self.object:setyaw(pyaw + self.rotate)
set_velocity(self, run_velocity)
end
]]
end,
custom_attack = function (self)
self.curr_attack = (self.curr_attack or self.attack)
self.morgut_timer = (self.morgut_timer or os.time())
if (os.time() - self.morgut_timer) > 1 then
self.morgut_timer = os.time()
local s = self.object:getpos()
local p = self.attack:getpos()
set_animation(self, "punch")
self.flag = 1
self.curr_attack = self.attack
self.state = "runaway"
local pyaw = self.curr_attack: get_look_yaw()
self.object:setyaw(pyaw)
set_velocity(self, self.run_velocity)
minetest.chat_send_all("Stato = "..self.state)
end
end,
})

2925
nuovo_api.lua Normal file

File diff suppressed because it is too large Load Diff

149
pupumolle.lua Normal file
View File

@ -0,0 +1,149 @@
nssm:register_mob("nssm:pupumolle", {
type = "animal",
hp_max = 15,
hp_min = 14,
collisionbox = {-0.56, -2.2, -0.56, 0.56, 1.2, 0.56},
visual = "mesh",
mesh = "pupumolle.x",
textures = {{"pupumolle.png"}},
visual_size = {x=4, y=4},
makes_footstep_sound = true,
view_range = 8,
fear_height = 4,
walk_velocity = 1,
run_velocity = 2.5,
rotate = 270,
sounds = {
random = "pupumolle",
},
damage = 2,
jump = true,
drops = {
{name = "nssm:life_energy",
chance = 1,
min = 1,
max = 1,},
{name = "default:stone",
chance = 1,
min = 2,
max = 3,},
},
armor = 60,
drawtype = "front",
water_damage = 3,
lava_damage = 1,
light_damage = 0,
on_rightclick = nil,
attack_type = "dogfight",
animation = {
speed_normal = 20,
speed_run = 20,
stand_start = 90,
stand_end = 110,
walk_start = 1,
walk_end = 80,
run_start = 120,
run_end = 160,
punch_start = 170,
punch_end = 190,
},
do_custom = function (self)
local pos = self.object:getpos()
--[[
if self.inventory == nil then
minetest.chat_send_all("Inventario non creato")
else
minetest.chat_send_all("Inventario creato")
end
]]--
if self.flag ~= 1 then
self.inventory = {}
for i=1,32 do
self.inventory[i]={name = '', num = 0}
end
end
self.flag = (self.flag or 1)
local objects = minetest.env:get_objects_inside_radius(pos, 10)
local pl = nil
for _,obj in ipairs(objects) do
if (obj:is_player()) then
pl = obj
end
end
if pl ~= nil then
local pname = pl:get_player_name()
local player_inv = minetest.get_inventory({type='player', name = pname})
if player_inv:is_empty('main') then
--minetest.chat_send_all("Inventario vuoto")
else
for i = 1,32 do
--minetest.chat_send_all("Inventario non vuoto")
--local items = ItemStack()
local items = player_inv:get_stack('main', i)
local n = items:get_name()
--minetest.chat_send_all("Primo oggetto dell'inventario: "..n)
if minetest.get_item_group(n, "eatable")==1 then
--minetest.chat_send_all("L'oggetto si può mangiare, te lo rubo!")
--local items2 = items
--items2:set_count(1)
local index
local found = 0
for j = 1,33 do
if found == 0 then
if self.inventory[j].num == 0 then
found = 2
index = j
else
if self.inventory[j].name == n then
self.inventory[j].num = self.inventory[j].num +1
found = 1
end
end
if j == 33 then
found = 4
end
end
end
minetest.chat_send_all("Found = "..found)
if found == 2 then
minetest.chat_send_all("Sto inserendo qualcosa di nuovo nell'iinventario")
self.inventory[index].name = n
self.inventory[index].num = 1
end
items:take_item()
player_inv:set_stack('main', i, items)
end
end
end
end
end,
on_die = function(self)
local pos = self.object:getpos()
if (self.inventory ~= nil) then
local elem
for i = 1,32 do
if self.inventory[i].num~=0 then
local items = ItemStack(self.inventory[i].name.." "..self.inventory[i].num)
local obj = minetest.add_item(pos, items)
obj:setvelocity({
x = math.random(-1, 1),
y = 6,
z = math.random(-1, 1)
})
end
end
if elem ~= nil then
minetest.chat_send_all("Numero di cibi diversi nel mio inventario: "..elem)
else
minetest.chat_send_all("Non ti ho rubato nulla")
end
end
end,
})

BIN
textures/pupumolle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B