Compare commits
5 Commits
4426003f32
...
3908d70a1f
Author | SHA1 | Date |
---|---|---|
maikerumine | 3908d70a1f | |
maikerumine | 6a948e45e4 | |
maikerumine | 09af131478 | |
maikerumine | eb60605330 | |
maikerumine | f6d2f0db01 |
34
api.lua
34
api.lua
|
@ -41,7 +41,7 @@ function dirtmons:register_mob(name, def)
|
||||||
knock_back = def.knock_back or 3,
|
knock_back = def.knock_back or 3,
|
||||||
blood_offset = def.blood_offset or 0,
|
blood_offset = def.blood_offset or 0,
|
||||||
blood_amount = def.blood_amount or 5, -- 15
|
blood_amount = def.blood_amount or 5, -- 15
|
||||||
blood_texture = def.blood_texture or "mobs_blood.png",
|
blood_texture = def.blood_texture or "default_dirt.png",
|
||||||
rewards = def.rewards or nil,
|
rewards = def.rewards or nil,
|
||||||
stimer = 0,
|
stimer = 0,
|
||||||
timer = 0,
|
timer = 0,
|
||||||
|
@ -50,17 +50,17 @@ function dirtmons:register_mob(name, def)
|
||||||
state = "stand",
|
state = "stand",
|
||||||
v_start = false,
|
v_start = false,
|
||||||
old_y = nil,
|
old_y = nil,
|
||||||
lifetimer = 600,
|
lifetimer = 60,
|
||||||
last_state = nil,
|
last_state = nil,
|
||||||
pause_timer = 0,
|
pause_timer = 0,
|
||||||
|
|
||||||
do_attack = function(self, player, dist)
|
do_attack = function(self, player, dist)
|
||||||
if self.state ~= "attack" then
|
if self.state ~= "attack" then
|
||||||
-- if self.sounds.war_cry then
|
if self.sounds.war_cry then
|
||||||
-- if math.random(0,100) < 90 then
|
if math.random(0,100) < 90 then
|
||||||
-- minetest.sound_play(self.sounds.war_cry,{ object = self.object })
|
minetest.sound_play(self.sounds.war_cry,{ object = self.object })
|
||||||
-- end
|
end
|
||||||
-- end
|
end
|
||||||
self.state = "attack"
|
self.state = "attack"
|
||||||
self.attack.player = player
|
self.attack.player = player
|
||||||
self.attack.dist = dist
|
self.attack.dist = dist
|
||||||
|
@ -273,7 +273,7 @@ function dirtmons:register_mob(name, def)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- FIND SOMEONE TO ATTACK
|
-- FIND SOMEONE TO ATTACK
|
||||||
if ( self.type == "monster" or self.type == "npc" ) and minetest.setting_getbool("enable_damage") and self.state ~= "attack" then
|
if ( self.type == "monster" or self.type == "badp" ) and minetest.setting_getbool("enable_damage") and self.state ~= "attack" then
|
||||||
local s = self.object:getpos()
|
local s = self.object:getpos()
|
||||||
local inradius = minetest.get_objects_inside_radius(s,self.view_range)
|
local inradius = minetest.get_objects_inside_radius(s,self.view_range)
|
||||||
local player = nil
|
local player = nil
|
||||||
|
@ -290,7 +290,7 @@ function dirtmons:register_mob(name, def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if type == "player" or type == "badp" then
|
if type == "player" or type == "npc" then
|
||||||
local s = self.object:getpos()
|
local s = self.object:getpos()
|
||||||
local p = player:getpos()
|
local p = player:getpos()
|
||||||
local sp = s
|
local sp = s
|
||||||
|
@ -314,7 +314,7 @@ function dirtmons:register_mob(name, def)
|
||||||
for _, oir in pairs(inradius) do
|
for _, oir in pairs(inradius) do
|
||||||
local obj = oir:get_luaentity()
|
local obj = oir:get_luaentity()
|
||||||
if obj then
|
if obj then
|
||||||
if obj.type == "badp" or obj.type == "barbarian" then
|
if obj.type == "npc" or obj.type == "barbarian" then
|
||||||
-- attack monster
|
-- attack monster
|
||||||
local p = obj.object:getpos()
|
local p = obj.object:getpos()
|
||||||
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
|
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
|
||||||
|
@ -553,7 +553,7 @@ function dirtmons:register_mob(name, def)
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
if self.type ~= "npc" then
|
if self.type ~= "npc" then
|
||||||
self.lifetimer = 600 - dtime_s
|
self.lifetimer = 60 - dtime_s
|
||||||
end
|
end
|
||||||
if staticdata then
|
if staticdata then
|
||||||
local tmp = minetest.deserialize(staticdata)
|
local tmp = minetest.deserialize(staticdata)
|
||||||
|
@ -593,16 +593,16 @@ function dirtmons:register_mob(name, def)
|
||||||
local d = ItemStack(drop.name.." "..math.random(drop.min, drop.max))
|
local d = ItemStack(drop.name.." "..math.random(drop.min, drop.max))
|
||||||
-- default.drop_item(pos,d)
|
-- default.drop_item(pos,d)
|
||||||
local pos2 = pos
|
local pos2 = pos
|
||||||
pos2.y = pos2.y + 0.5 -- drop items half block higher
|
pos2.y = pos2.y + 3.5 -- drop items half block higher
|
||||||
minetest.add_item(pos2,d)
|
minetest.add_item(pos2,d)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if self.sounds.death ~= nil then
|
if self.sounds.death ~= nil then
|
||||||
-- minetest.sound_play(self.sounds.death,{
|
minetest.sound_play(self.sounds.death,{
|
||||||
-- object = self.object,
|
object = self.object,
|
||||||
-- })
|
})
|
||||||
-- end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
85
init.lua
85
init.lua
|
@ -1,9 +1,10 @@
|
||||||
dofile(minetest.get_modpath("dirtmons").."/api.lua")
|
dofile(minetest.get_modpath("dirtmons").."/api.lua")
|
||||||
-- dirtmons:register_spawn(name, description, nodes, max_light, min_light, chance, active_object_count, max_height)
|
-- dirtmons:register_spawn(name, description, nodes, max_light, min_light, chance, active_object_count, max_height)
|
||||||
dirtmons:register_spawn("dirtmons:dirt", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble"}, 18, -1, 7000, 2, 31000)
|
dirtmons:register_spawn("dirtmons:dirt", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble"}, 7, 4, 12000, 2, 31000)
|
||||||
dirtmons:register_mob("dirtmons:dirt", {
|
dirtmons:register_mob("dirtmons:dirt", {
|
||||||
type = "monster",
|
type = "monster",
|
||||||
hp_max = 70,
|
hp_min = 30,
|
||||||
|
hp_max = 50,
|
||||||
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
|
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "dirt.x",
|
mesh = "dirt.x",
|
||||||
|
@ -11,14 +12,23 @@ dirtmons:register_mob("dirtmons:dirt", {
|
||||||
visual_size = {x=3.5, y=2.8},
|
visual_size = {x=3.5, y=2.8},
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
view_range = 24,
|
view_range = 24,
|
||||||
|
follow = "flowers:viola",--swap out type randomly for server players"flowers:tulip","flowers:rose","flowers:geranium","flowers:dandelion_yellow","flowers:dandelion_white",
|
||||||
walk_velocity = 2.5,
|
walk_velocity = 2.5,
|
||||||
run_velocity = 3.8,
|
run_velocity = 3.8,
|
||||||
damage = 2.7,
|
damage = 2.7,
|
||||||
drops = {
|
drops = {
|
||||||
{name = "default:dirt",
|
{name = "default:dirt",
|
||||||
chance = 1,
|
chance = 1,
|
||||||
min = 3,
|
min = 1,
|
||||||
max = 6,},
|
max = 2,},
|
||||||
|
{name = "bones:bones",
|
||||||
|
chance = 1,
|
||||||
|
min = 1,
|
||||||
|
max = 1,},
|
||||||
|
{name = "flowers:viola",
|
||||||
|
chance = 10,
|
||||||
|
min = 0,
|
||||||
|
max = 1,},
|
||||||
},
|
},
|
||||||
armor = 75,
|
armor = 75,
|
||||||
drawtype = "front",
|
drawtype = "front",
|
||||||
|
@ -38,8 +48,71 @@ dirtmons:register_mob("dirtmons:dirt", {
|
||||||
run_end = 63,
|
run_end = 63,
|
||||||
punch_start = 40,
|
punch_start = 40,
|
||||||
punch_end = 63,
|
punch_end = 63,
|
||||||
}
|
},
|
||||||
|
sounds = {
|
||||||
|
war_cry = "mobs_stone",
|
||||||
|
death = "mobs_death2",
|
||||||
|
attack = "mobs_stone_attack",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dirtmons:register_spawn("dirtmons:dirt2", {"default:dirt_with_grass","default:stone", "default:stonebrick","default:cobble"}, 7, 4, 7000, 5, -100)
|
||||||
|
dirtmons:register_mob("dirtmons:dirt2", {
|
||||||
|
type = "monster",
|
||||||
|
hp_min = 30,
|
||||||
|
hp_max = 50,
|
||||||
|
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
|
||||||
|
visual = "mesh",
|
||||||
|
mesh = "dirt.x",
|
||||||
|
textures = {"dirt2.png"},
|
||||||
|
visual_size = {x=3.5, y=2.8},
|
||||||
|
makes_footstep_sound = true,
|
||||||
|
view_range = 24,
|
||||||
|
follow = "flowers:rose",--swap out type randomly for server players"flowers:tulip","flowers:rose","flowers:geranium","flowers:dandelion_yellow","flowers:dandelion_white",
|
||||||
|
walk_velocity = 1.5,
|
||||||
|
run_velocity = 2.8,
|
||||||
|
damage = 2.7,
|
||||||
|
drops = {
|
||||||
|
{name = "default:dirt",
|
||||||
|
chance = 1,
|
||||||
|
min = 1,
|
||||||
|
max = 2,},
|
||||||
|
{name = "bones:bones",
|
||||||
|
chance = 1,
|
||||||
|
min = 1,
|
||||||
|
max = 1,},
|
||||||
|
{name = "flowers:rose",
|
||||||
|
chance = 10,
|
||||||
|
min = 0,
|
||||||
|
max = 1,},
|
||||||
|
},
|
||||||
|
armor = 75,
|
||||||
|
drawtype = "front",
|
||||||
|
water_damage = 0,
|
||||||
|
lava_damage = 0,
|
||||||
|
light_damage = 0,
|
||||||
|
on_rightclick = nil,
|
||||||
|
attack_type = "dogfight",
|
||||||
|
animation = {
|
||||||
|
speed_normal = 15,
|
||||||
|
speed_run = 15,
|
||||||
|
stand_start = 0,
|
||||||
|
stand_end = 14,
|
||||||
|
walk_start = 15,
|
||||||
|
walk_end = 38,
|
||||||
|
run_start = 40,
|
||||||
|
run_end = 63,
|
||||||
|
punch_start = 40,
|
||||||
|
punch_end = 63,
|
||||||
|
},
|
||||||
|
sounds = {
|
||||||
|
war_cry = "mobs_stone",
|
||||||
|
death = "mobs_death2",
|
||||||
|
attack = "mobs_stone_attack",
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
if minetest.setting_get("log_mods") then
|
if minetest.setting_get("log_mods") then
|
||||||
|
@ -50,5 +123,3 @@ end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
|
Version 2, December 2004
|
||||||
|
|
||||||
|
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim or modified
|
||||||
|
copies of this license document, and changing it is allowed as long
|
||||||
|
as the name is changed.
|
||||||
|
|
||||||
|
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. You just DO WHAT THE FUCK YOU WANT TO.
|
Binary file not shown.
After Width: | Height: | Size: 4.5 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 730 B |
Loading…
Reference in New Issue