added pets mod (pig)

This commit is contained in:
cale 2016-01-15 16:11:29 +01:00
parent e845b631b0
commit a117fc3b68
9 changed files with 3309 additions and 2629 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 552 B

After

Width:  |  Height:  |  Size: 417 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

16
mods/pets/LICENSE.txt Normal file
View File

@ -0,0 +1,16 @@
License for Code
----------------
Copyright (C) 2016 cd2 (cdqwertz) <cdqwertz@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
http://www.gnu.org/licenses/lgpl-2.1.html
License for Media
-----------------
CC-BY-SA 3.0 UNPORTED. Created by cd2 (cdqwertz)

72
mods/pets/init.lua Normal file
View File

@ -0,0 +1,72 @@
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
minetest.register_entity("pets:pig", {
hp_max = 30,
physical = true,
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
visual = "mesh",
visual_size = {x=1, y=1},
mesh = "pets_pig.x",
textures = {"pets_pig.png",},
spritediv = {x=1, y=1},
initial_sprite_basepos = {x=0, y=0},
is_visible = true,
makes_footstep_sound = false,
automatic_rotate = true,
speed = 0,
pl = nil,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction)
if not puncher or not puncher:is_player() then
return
end
self.pl = puncher
end,
on_step = function(self, dtime)
if self.pl ~= nil then
if vector.distance(self.object:getpos(), self.pl:getpos()) > 2 then
local vec = vector.direction(self.object:getpos(), self.pl:getpos())
vec.y = vec.y * 10
self.object:setvelocity(vector.multiply(vec, 3))
local yaw = math.atan(vec.z/vec.x)+math.pi/2
yaw = yaw+(math.pi/2)
if self.pl:getpos().x > self.object:getpos().x then
yaw = yaw+math.pi
end
self.object:setyaw(yaw)
end
else
if math.random(0, 50) == 15 then
local vec = {x=math.random(-3, 3), y=-4, z=math.random(-3, 3)}
self.object:setvelocity(vec)
local yaw = math.atan(vec.z/vec.x)+math.pi/2
yaw = yaw+(math.pi/2)
if vec.x + self.object:getpos().x > self.object:getpos().x then
yaw = yaw+math.pi
end
self.object:setyaw(yaw)
end
end
end,
})
minetest.register_craftitem("pets:pig", {
description = "Pig",
inventory_image = "pets_pig_spawn.png",
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return
end
minetest.add_entity(pointed_thing.above, "pets:pig")
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end,
})

72
mods/pets/init.lua~ Normal file
View File

@ -0,0 +1,72 @@
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
minetest.register_entity("pets:pig", {
hp_max = 30,
physical = true,
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
visual = "mesh",
visual_size = {x=1, y=1},
mesh = "pets_pig.x",
textures = {"pets_pig.png",},
spritediv = {x=1, y=1},
initial_sprite_basepos = {x=0, y=0},
is_visible = true,
makes_footstep_sound = false,
automatic_rotate = true,
speed = 0,
pl = nil,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction)
if not puncher or not puncher:is_player() then
return
end
self.pl = puncher
end,
on_step = function(self, dtime)
if self.pl ~= nil then
if vector.distance(self.object:getpos(), self.pl:getpos()) > 2 then
local vec = vector.direction(self.object:getpos(), self.pl:getpos())
vec.y = vec.y * 10
self.object:setvelocity(vector.multiply(vec, 3))
local yaw = math.atan(vec.z/vec.x)+math.pi/2
yaw = yaw+(math.pi/2)
if self.pl:getpos().x > self.object:getpos().x then
yaw = yaw+math.pi
end
self.object:setyaw(yaw)
end
else
if math.random(0, 50) == 15 then
local vec = {x=math.random(-3, 3), y=-4, z=math.random(-3, 3)}
self.object:setvelocity(vec)
local yaw = math.atan(vec.z/vec.x)+math.pi/2
yaw = yaw+(math.pi/2)
if vec.x + self.object:getpos().x > self.object:getpos().x then
yaw = yaw+math.pi
end
self.object:setyaw(yaw)
end
end
end,
})
minetest.register_craftitem("pets:pig", {
description = "Pig",
inventory_image = "pets_pig_spawn.png",
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return
end
minetest.add_entity(pointed_thing.above, "pets:pig")
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end,
})

520
mods/pets/models/pets_pig.x Normal file
View File

@ -0,0 +1,520 @@
xof 0303txt 0032
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 Cube_002 {
FrameTransformMatrix {
2.000000, 0.000000, 0.000000, 0.000000,
0.000000, 2.000000, 0.000000, 0.000000,
0.000000, 0.000000, 2.000000, 0.000000,
0.000000, 0.000000, 0.000000, 1.000000;;
}
Mesh { // Cube_002 mesh
160;
-1.440000;-1.000000; 0.250000;,
-1.440000; 1.000000; 0.250000;,
-1.440000; 1.000000;-1.550000;,
-1.440000;-1.000000;-1.550000;,
-1.440000; 1.000000; 0.250000;,
1.440000; 1.000000; 0.250000;,
1.440000; 1.000000;-1.550000;,
-1.440000; 1.000000;-1.550000;,
1.440000; 1.000000; 0.250000;,
1.440000;-1.000000; 0.250000;,
1.440000;-1.000000;-1.550000;,
1.440000; 1.000000;-1.550000;,
1.440000;-1.000000; 0.250000;,
-1.440000;-1.000000; 0.250000;,
-1.440000;-1.000000;-1.550000;,
1.440000;-1.000000;-1.550000;,
-1.440000;-1.000000;-1.550000;,
-1.440000; 1.000000;-1.550000;,
1.440000; 1.000000;-1.550000;,
1.440000;-1.000000;-1.550000;,
1.440000;-1.000000; 0.250000;,
1.440000; 1.000000; 0.250000;,
-1.440000; 1.000000; 0.250000;,
-1.440000;-1.000000; 0.250000;,
-1.400020;-0.849990;-1.211772;,
-1.400020;-0.273990;-1.211772;,
-1.400020;-0.273990;-2.411772;,
-1.400020;-0.849990;-2.411772;,
-1.400020;-0.273990;-1.211772;,
-0.824021;-0.273990;-1.211772;,
-0.824021;-0.273990;-2.411772;,
-1.400020;-0.273990;-2.411772;,
-0.824021;-0.273990;-1.211772;,
-0.824021;-0.849990;-1.211772;,
-0.824021;-0.849990;-2.411772;,
-0.824021;-0.273990;-2.411772;,
-0.824021;-0.849990;-1.211772;,
-1.400020;-0.849990;-1.211772;,
-1.400020;-0.849990;-2.411772;,
-0.824021;-0.849990;-2.411772;,
-1.400020;-0.849990;-2.411772;,
-1.400020;-0.273990;-2.411772;,
-0.824021;-0.273990;-2.411772;,
-0.824021;-0.849990;-2.411772;,
-0.824021;-0.849990;-1.211772;,
-0.824021;-0.273990;-1.211772;,
-1.400020;-0.273990;-1.211772;,
-1.400020;-0.849990;-1.211772;,
-1.353819; 0.278024;-1.211772;,
-1.353819; 0.854024;-1.211772;,
-1.353819; 0.854024;-2.411772;,
-1.353819; 0.278024;-2.411772;,
-1.353819; 0.854024;-1.211772;,
-0.777819; 0.854024;-1.211772;,
-0.777819; 0.854024;-2.411772;,
-1.353819; 0.854024;-2.411772;,
-0.777819; 0.854024;-1.211772;,
-0.777819; 0.278024;-1.211772;,
-0.777819; 0.278024;-2.411772;,
-0.777819; 0.854024;-2.411772;,
-0.777819; 0.278024;-1.211772;,
-1.353819; 0.278024;-1.211772;,
-1.353819; 0.278024;-2.411772;,
-0.777819; 0.278024;-2.411772;,
-1.353819; 0.278024;-2.411772;,
-1.353819; 0.854024;-2.411772;,
-0.777819; 0.854024;-2.411772;,
-0.777819; 0.278024;-2.411772;,
-0.777819; 0.278024;-1.211772;,
-0.777819; 0.854024;-1.211772;,
-1.353819; 0.854024;-1.211772;,
-1.353819; 0.278024;-1.211772;,
0.712000; 0.278024;-1.211772;,
0.712000; 0.854024;-1.211772;,
0.712000; 0.854024;-2.411772;,
0.712000; 0.278024;-2.411772;,
0.712000; 0.854024;-1.211772;,
1.288000; 0.854024;-1.211772;,
1.288000; 0.854024;-2.411772;,
0.712000; 0.854024;-2.411772;,
1.288000; 0.854024;-1.211772;,
1.288000; 0.278024;-1.211772;,
1.288000; 0.278024;-2.411772;,
1.288000; 0.854024;-2.411772;,
1.288000; 0.278024;-1.211772;,
0.712000; 0.278024;-1.211772;,
0.712000; 0.278024;-2.411772;,
1.288000; 0.278024;-2.411772;,
0.712000; 0.278024;-2.411772;,
0.712000; 0.854024;-2.411772;,
1.288000; 0.854024;-2.411772;,
1.288000; 0.278024;-2.411772;,
1.288000; 0.278024;-1.211772;,
1.288000; 0.854024;-1.211772;,
0.712000; 0.854024;-1.211772;,
0.712000; 0.278024;-1.211772;,
0.712000;-0.849990;-1.211772;,
0.712000;-0.273990;-1.211772;,
0.712000;-0.273990;-2.411772;,
0.712000;-0.849990;-2.411772;,
0.712000;-0.273990;-1.211772;,
1.288000;-0.273990;-1.211772;,
1.288000;-0.273990;-2.411772;,
0.712000;-0.273990;-2.411772;,
1.288000;-0.273990;-1.211772;,
1.288000;-0.849990;-1.211772;,
1.288000;-0.849990;-2.411772;,
1.288000;-0.273990;-2.411772;,
1.288000;-0.849990;-1.211772;,
0.712000;-0.849990;-1.211772;,
0.712000;-0.849990;-2.411772;,
1.288000;-0.849990;-2.411772;,
0.712000;-0.849990;-2.411772;,
0.712000;-0.273990;-2.411772;,
1.288000;-0.273990;-2.411772;,
1.288000;-0.849990;-2.411772;,
1.288000;-0.849990;-1.211772;,
1.288000;-0.273990;-1.211772;,
0.712000;-0.273990;-1.211772;,
0.712000;-0.849990;-1.211772;,
0.767678;-0.800000; 0.431469;,
0.767678; 0.800000; 0.431469;,
0.767678; 0.800000;-1.168531;,
0.767678;-0.800000;-1.168531;,
0.767678; 0.800000; 0.431469;,
2.367678; 0.800000; 0.431469;,
2.367678; 0.800000;-1.168531;,
0.767678; 0.800000;-1.168531;,
2.367678;-0.800000;-1.168531;,
2.367678; 0.800000;-1.168531;,
2.390530; 0.720000;-1.088531;,
2.390530;-0.720000;-1.088531;,
2.367678;-0.800000; 0.431469;,
0.767678;-0.800000; 0.431469;,
0.767678;-0.800000;-1.168531;,
2.367678;-0.800000;-1.168531;,
0.767678;-0.800000;-1.168531;,
0.767678; 0.800000;-1.168531;,
2.367678; 0.800000;-1.168531;,
2.367678;-0.800000;-1.168531;,
2.367678;-0.800000; 0.431469;,
2.367678; 0.800000; 0.431469;,
0.767678; 0.800000; 0.431469;,
0.767678;-0.800000; 0.431469;,
2.390530; 0.720000; 0.351469;,
2.390530;-0.720000; 0.351469;,
2.390530;-0.720000;-1.088531;,
2.390530; 0.720000;-1.088531;,
2.367678;-0.800000; 0.431469;,
2.367678;-0.800000;-1.168531;,
2.390530;-0.720000;-1.088531;,
2.390530;-0.720000; 0.351469;,
2.367678; 0.800000; 0.431469;,
2.367678;-0.800000; 0.431469;,
2.390530;-0.720000; 0.351469;,
2.390530; 0.720000; 0.351469;,
2.367678; 0.800000;-1.168531;,
2.367678; 0.800000; 0.431469;,
2.390530; 0.720000; 0.351469;,
2.390530; 0.720000;-1.088531;;
40;
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;,
4;51,50,49,48;,
4;55,54,53,52;,
4;59,58,57,56;,
4;63,62,61,60;,
4;67,66,65,64;,
4;71,70,69,68;,
4;75,74,73,72;,
4;79,78,77,76;,
4;83,82,81,80;,
4;87,86,85,84;,
4;91,90,89,88;,
4;95,94,93,92;,
4;99,98,97,96;,
4;103,102,101,100;,
4;107,106,105,104;,
4;111,110,109,108;,
4;115,114,113,112;,
4;119,118,117,116;,
4;123,122,121,120;,
4;127,126,125,124;,
4;131,130,129,128;,
4;135,134,133,132;,
4;139,138,137,136;,
4;143,142,141,140;,
4;147,146,145,144;,
4;151,150,149,148;,
4;155,154,153,152;,
4;159,158,157,156;;
MeshNormals { // Cube_002 normals
40;
-1.000000; 0.000000; 0.000000;,
0.000000; 1.000000;-0.000000;,
1.000000; 0.000000;-0.000000;,
0.000000;-1.000000; 0.000000;,
-0.000000; 0.000000;-1.000000;,
-0.000000; 0.000000; 1.000000;,
-1.000000; 0.000000; 0.000000;,
0.000000; 1.000000;-0.000000;,
1.000000; 0.000000;-0.000000;,
0.000000;-1.000000; 0.000000;,
-0.000000; 0.000000;-1.000000;,
-0.000000; 0.000000; 1.000000;,
-1.000000; 0.000000; 0.000000;,
0.000000; 1.000000;-0.000000;,
1.000000; 0.000000;-0.000000;,
0.000000;-1.000000; 0.000000;,
-0.000000; 0.000000;-1.000000;,
-0.000000; 0.000000; 1.000000;,
-1.000000; 0.000000; 0.000000;,
0.000000; 1.000000;-0.000000;,
1.000000; 0.000000;-0.000000;,
0.000000;-1.000000; 0.000000;,
-0.000000; 0.000000;-1.000000;,
-0.000000; 0.000000; 1.000000;,
-1.000000; 0.000000; 0.000000;,
0.000000; 1.000000;-0.000000;,
1.000000; 0.000000;-0.000000;,
0.000000;-1.000000; 0.000000;,
-0.000000; 0.000000;-1.000000;,
-0.000000; 0.000000; 1.000000;,
-1.000000; 0.000000; 0.000000;,
0.000000; 1.000000;-0.000000;,
0.961543; 0.000000;-0.274655;,
0.000000;-1.000000; 0.000000;,
-0.000000; 0.000000;-1.000000;,
-0.000000; 0.000000; 1.000000;,
1.000000; 0.000000;-0.000000;,
0.961543;-0.274655; 0.000000;,
0.961543; 0.000000; 0.274656;,
0.961543; 0.274655; 0.000000;;
40;
4;0,0,0,0;,
4;1,1,1,1;,
4;2,2,2,2;,
4;3,3,3,3;,
4;4,4,4,4;,
4;5,5,5,5;,
4;6,6,6,6;,
4;7,7,7,7;,
4;8,8,8,8;,
4;9,9,9,9;,
4;10,10,10,10;,
4;11,11,11,11;,
4;12,12,12,12;,
4;13,13,13,13;,
4;14,14,14,14;,
4;15,15,15,15;,
4;16,16,16,16;,
4;17,17,17,17;,
4;18,18,18,18;,
4;19,19,19,19;,
4;20,20,20,20;,
4;21,21,21,21;,
4;22,22,22,22;,
4;23,23,23,23;,
4;24,24,24,24;,
4;25,25,25,25;,
4;26,26,26,26;,
4;27,27,27,27;,
4;28,28,28,28;,
4;29,29,29,29;,
4;30,30,30,30;,
4;31,31,31,31;,
4;32,32,32,32;,
4;33,33,33,33;,
4;34,34,34,34;,
4;35,35,35,35;,
4;36,36,36,36;,
4;37,37,37,37;,
4;38,38,38,38;,
4;39,39,39,39;;
} // End of Cube_002 normals
MeshTextureCoords { // Cube_002 UV coordinates
160;
0.220805; 0.646713;,
0.220805; 0.401374;,
0.000000; 0.401374;,
0.000000; 0.646713;,
0.245339; 0.293425;,
0.245339; 0.646712;,
0.466143; 0.646713;,
0.466143; 0.293425;,
0.711482; 0.892051;,
0.711482; 0.646713;,
0.490677; 0.646713;,
0.490677; 0.892051;,
0.819431; 0.425908;,
0.466143; 0.425908;,
0.466143; 0.646713;,
0.819431; 0.646713;,
0.490677; 0.646713;,
0.245339; 0.646713;,
0.245339; 1.000000;,
0.490677; 1.000000;,
0.000000; 1.000000;,
0.245339; 1.000000;,
0.245339; 0.646713;,
0.000000; 0.646713;,
0.220805; 0.134446;,
0.220805; 0.063788;,
0.073602; 0.063788;,
0.073602; 0.134446;,
0.782139; 0.842983;,
0.711482; 0.842983;,
0.711482; 0.990186;,
0.782139; 0.990186;,
0.978410; 0.646713;,
0.907753; 0.646713;,
0.907753; 0.793916;,
0.978410; 0.793916;,
0.073602; 0.057900;,
0.002944; 0.057900;,
0.002944; 0.205103;,
0.073602; 0.205103;,
0.466143; 0.026497;,
0.395486; 0.026497;,
0.395486; 0.097154;,
0.466143; 0.097154;,
0.929343; 0.229637;,
1.000000; 0.229637;,
1.000000; 0.158979;,
0.929343; 0.158979;,
0.220805; 0.205103;,
0.220805; 0.134446;,
0.073602; 0.134446;,
0.073602; 0.205103;,
0.852797; 0.842983;,
0.782139; 0.842983;,
0.782139; 0.990186;,
0.852797; 0.990186;,
0.994112; 0.842983;,
0.923454; 0.842983;,
0.923454; 0.990186;,
0.994112; 0.990186;,
0.923454; 0.842983;,
0.852797; 0.842983;,
0.852797; 0.990186;,
0.923454; 0.990186;,
1.000000; 0.011776;,
0.929343; 0.011776;,
0.929343; 0.082434;,
1.000000; 0.082434;,
0.591757; 0.088322;,
0.662414; 0.088322;,
0.662414; 0.017664;,
0.591757; 0.017664;,
0.662414; 0.158979;,
0.662414; 0.088322;,
0.515211; 0.088322;,
0.515211; 0.158979;,
0.858685; 0.229637;,
0.929343; 0.229637;,
0.929343; 0.082434;,
0.858685; 0.082434;,
0.890088; 0.573111;,
0.960746; 0.573111;,
0.960746; 0.425908;,
0.890088; 0.425908;,
0.929343; 0.229637;,
0.858685; 0.229637;,
0.858685; 0.376840;,
0.929343; 0.376840;,
0.585869; 0.017664;,
0.515211; 0.017664;,
0.515211; 0.088322;,
0.585869; 0.088322;,
0.929343; 0.082434;,
0.929343; 0.011776;,
0.858685; 0.011776;,
0.858685; 0.082434;,
0.966634; 0.646713;,
0.966634; 0.576055;,
0.819431; 0.576055;,
0.819431; 0.646713;,
0.515211; 0.158979;,
0.515211; 0.229637;,
0.662414; 0.229637;,
0.662414; 0.158979;,
0.490677; 0.929342;,
0.490677; 1.000000;,
0.637880; 1.000000;,
0.637880; 0.929343;,
0.890088; 0.425908;,
0.819431; 0.425908;,
0.819431; 0.573111;,
0.890088; 0.573111;,
0.269873; 0.026497;,
0.269873; 0.097154;,
0.340530; 0.097154;,
0.340530; 0.026497;,
0.637880; 1.000000;,
0.708538; 1.000000;,
0.708538; 0.929342;,
0.637880; 0.929342;,
0.858685; 0.425908;,
0.858685; 0.229637;,
0.662414; 0.229637;,
0.662414; 0.425908;,
0.466143; 0.425908;,
0.662414; 0.425908;,
0.662414; 0.229637;,
0.466143; 0.229637;,
0.269873; 0.097154;,
0.269873; 0.293425;,
0.279686; 0.283611;,
0.279686; 0.106968;,
0.220805; 0.205103;,
0.024534; 0.205103;,
0.024534; 0.401374;,
0.220805; 0.401374;,
0.662414; 0.229637;,
0.858685; 0.229637;,
0.858685; 0.033366;,
0.662414; 0.033366;,
0.907753; 0.646713;,
0.711482; 0.646713;,
0.711482; 0.842983;,
0.907753; 0.842983;,
0.456330; 0.283611;,
0.456330; 0.106968;,
0.279686; 0.106968;,
0.279686; 0.283611;,
0.466143; 0.097154;,
0.269873; 0.097154;,
0.279686; 0.106968;,
0.456330; 0.106968;,
0.466143; 0.293425;,
0.466143; 0.097154;,
0.456330; 0.106968;,
0.456330; 0.283611;,
0.269873; 0.293425;,
0.466143; 0.293425;,
0.456330; 0.283611;,
0.279686; 0.283611;;
} // End of Cube_002 UV coordinates
MeshMaterialList { // Cube_002 material list
1;
40;
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0;;
Material pig {
0.640000; 0.267757; 0.218744; 1.000000;;
96.078431;
0.500000; 0.500000; 0.500000;;
0.000000; 0.000000; 0.000000;;
TextureFilename {"pets_pig.png";}
}
} // End of Cube_002 material list
} // End of Cube_002 mesh
} // End of Cube_002
} // End of Root

Binary file not shown.

After

Width:  |  Height:  |  Size: 906 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B