Add files via upload

master
AiTechEye 2018-06-26 09:06:05 +02:00 committed by GitHub
parent 5cb73952ce
commit 7ac25d3a5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 5783 additions and 0 deletions

328
aliveai_threats/crystal.lua Normal file
View File

@ -0,0 +1,328 @@
minetest.register_craft( {
output = "aliveai_threats:crystal_small 3",
recipe = {
{"aliveai_threats:crystal_big"},
}
})
minetest.register_craft( {
output = "aliveai_threats:crystal_small 2",
recipe = {
{"aliveai_threats:crystal_medium"},
}
})
minetest.register_craft( {
output = "aliveai_threats:chainfence 3",
recipe = {
{"default:steel_ingot","","default:steel_ingot"},
{"default:steel_ingot","aliveai_threats:crystal_small","default:steel_ingot"},
{"default:steel_ingot","","default:steel_ingot"},
}
})
if not aliveai_electric then
aliveai_electric={}
aliveai_electric.hit=function(ob,h)
aliveai.punchdmg(ob,h)
end
end
aliveai.create_bot({
attack_players=1,
name="crystal",
team="crystal",
texture="aliveai_threats_crystals.png",
attacking=1,
talking=0,
light=0,
building=0,
escape=0,
start_with_items={["aliveai_threats:crystalrod"]=1},
type="monster",
dmg=5,
hp=40,
name_color="",
coming=0,
smartfight=0,
attack_chance=2,
death=function(self,puncher,pos)
minetest.sound_play("default_break_glass", {pos=pos, gain = 1.0, max_hear_distance = 5,})
if not self.ex then
self.ex=true
aliveai_threats.crystalblow(pos)
aliveai_threats.crystalblow(pos)
minetest.add_particlespawner({
amount = 5,
time =0.05,
minpos = pos,
maxpos = pos,
minvel = {x=-2, y=-2, z=-2},
maxvel = {x=1, y=0.5, z=1},
minacc = {x=0, y=-8, z=0},
maxacc = {x=0, y=-10, z=0},
minexptime = 2,
maxexptime = 1,
minsize = 1,
maxsize = 4,
texture = "aliveai_threats_crystals",
collisiondetection = true,
})
end
return self
end
})
aliveai_threats.crystalblow=function(pos)
local nodes=aliveai.get_nodes(pos,5,2,{"default:stone"})
for _, nodepos in pairs(nodes) do
if not minetest.is_protected(nodepos,"") and aliveai.distance(nodepos,pos)<5 then
local n=minetest.get_node(nodepos).name
if minetest.get_item_group(n,"snappy")>0 then
local na={"aliveai_threats:crystal_medium","aliveai_threats:crystal_big","aliveai_threats:crystal_small","aliveai_threats:crystal_grass"}
minetest.set_node(nodepos,{name=na[math.random(1,4)]})
elseif minetest.get_item_group(n,"choppy")>0 then
minetest.set_node(nodepos,{name="aliveai_threats:crystal_block"})
elseif minetest.get_item_group(n,"soil")>0 then
minetest.set_node(nodepos,{name="aliveai_threats:crystal_soil"})
end
end
end
for _, ob in ipairs(minetest.get_objects_inside_radius(pos, 5)) do
aliveai_electric.hit(ob,10)
end
end
minetest.register_tool("aliveai_threats:crystalrod", {
description = "Crystal rod",
inventory_image = "aliveai_threats_crystals.png",
range = 15,
groups = {not_in_creative_inventory=1},
on_use=function(itemstack, user, pointed_thing)
if user:get_luaentity() then user=user:get_luaentity() end
local typ=pointed_thing.type
local pos1=user:get_pos()
pos1.y=pos1.y+1.5
local pos2
if typ=="object" then
pos2=pointed_thing.ref:get_pos()
elseif typ=="node" then
pos2=pointed_thing.under
elseif typ=="nothing" then
local dir
if user:get_luaentity() then
if user:get_luaentity().aliveai and user:get_luaentity().fight then
local dir=aliveai.get_dir(user:get_luaentity(),user:get_luaentity().fight)
pos2={x=pos1.x+(dir.x*30),y=pos1.y+(dir.y*30),z=pos1.z+(dir.z*30)}
else
pos2=aliveai.pointat(user:get_luaentity(),30)
end
else
local dir=user:get_look_dir()
pos2={x=pos1.x+(dir.x*30),y=pos1.y+(dir.y*30),z=pos1.z+(dir.z*30)}
end
else
return itemstack
end
local d=math.floor(aliveai.distance(pos1,pos2)+0.5)
local dir={x=(pos1.x-pos2.x)/-d,y=(pos1.y-pos2.y)/-d,z=(pos1.z-pos2.z)/-d}
local p1=pos1
for i=0,d,1 do
p1={x=pos1.x+(dir.x*i),y=pos1.y+(dir.y*i),z=pos1.z+(dir.z*i)}
if aliveai.def(p1,"walkable") then
break
end
end
if p1.x~=p1.x or p1.y~=p1.y or p1.z~=p1.z then
return itemstack
end
itemstack:add_wear(65535/20)
aliveai_threats.crystalblow(p1)
minetest.sound_play("aliveai_electric_lightning", {pos = p1,max_hear_distance = 5,gain = 0.1,})
minetest.sound_play("aliveai_electric_lightning", {pos = pos1,max_hear_distance = 5,gain = 0.1,})
return itemstack
end,
})
minetest.register_node("aliveai_threats:crystal_big", {
description = "Big crystal",
drawtype = "mesh",
mesh = "aliveai_threats_crystals.obj",
visual_scale = 0.3,
wield_scale = {x=1, y=1, z=1},
alpha = 20,
tiles = {
{
name = "aliveai_threats_crystals.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
},
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
damage_per_second = 10,
walkable = false,
is_ground_content = false,
light_source=3,
selection_box = {
type = "fixed",
fixed = {-1, -1, -1, 1, 1, 1}
},
collision_box = {
type = "fixed",
fixed = {{-2, -2, -2, 2, 2, 2},}},
groups = {cracky = 1, level = 3},
on_punch = function(pos, node, puncher, pointed_thing)
aliveai_electric.hit(pointed_thing.ref,30)
end,
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type=="node" or pointed_thing.type=="nothing" then return itemstack end
local pvp=minetest.setting_getbool("enable_pvp")
local ob=pointed_thing.ref
if ob:is_player() and pvp==false then return itemstack end
aliveai_electric.hit(puncher,30)
itemstack:take_item(1)
return itemstack
end,
})
minetest.register_node("aliveai_threats:crystal_medium", {
description = "Medium crystal",
drawtype = "mesh",
mesh = "aliveai_threats_crystals.obj",
visual_scale = 0.2,
wield_scale = {x=1, y=1, z=1},
alpha = 20,
tiles = {
{
name = "aliveai_threats_crystals.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
},
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
damage_per_second = 4,
walkable = false,
is_ground_content = false,
light_source=3,
groups = {cracky = 2, level = 2},
on_punch = function(pos, node, puncher, pointed_thing)
aliveai_electric.hit(puncher,15)
end,
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type=="node" or pointed_thing.type=="nothing" then return itemstack end
local pvp=minetest.setting_getbool("enable_pvp")
local ob=pointed_thing.ref
if ob:is_player() and pvp==false then return itemstack end
aliveai_electric.hit(pointed_thing.ref,15)
itemstack:take_item(1)
return itemstack
end,
})
minetest.register_node("aliveai_threats:crystal_small", {
description = "Small crystal",
drawtype = "mesh",
mesh = "aliveai_threats_crystal.obj",
visual_scale = 2,
wield_scale = {x=2, y=2, z=2},
alpha = 20,
tiles = {
{
name = "aliveai_threats_crystals.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
},
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
damage_per_second = 5,
walkable = false,
is_ground_content = false,
light_source=8,
selection_box = {
type = "fixed",
fixed = {-0.1, -0.5, -0.1, 0.1, 0.25, 0.1}
},
groups = {cracky = 1, level = 1},
on_punch = function(pos, node, puncher, pointed_thing)
aliveai_electric.hit(puncher,5)
end,
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type=="node" or pointed_thing.type=="nothing" then return itemstack end
local pvp=minetest.setting_getbool("enable_pvp")
local ob=pointed_thing.ref
if ob:is_player() and pvp==false then return itemstack end
aliveai_electric.hit(pointed_thing.ref,5)
itemstack:take_item(1)
return itemstack
end,
})
minetest.register_node("aliveai_threats:crystal_block", {
description = "Crystal block",
tiles = {
{
name = "aliveai_threats_crystals.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
},
groups = {cracky = 1, puts_out_fire = 1, not_in_creative_inventory=1},
sounds = default.node_sound_stone_defaults(),
light_source=8,
paramtype = "light",
is_ground_content = false,
on_punch = function(pos, node, puncher, pointed_thing)
aliveai_electric.hit(pointed_thing.ref,5)
end,
})
minetest.register_node("aliveai_threats:crystal_soil", {
description = "Crystal soil",
tiles = {"default_obsidian.png^[colorize:#6d1d7caa"},
groups = { oddly_breakable_by_hand = 1,choppy = 1, not_in_creative_inventory=1},
sounds = default.node_sound_dirt_defaults(),
light_source=5,
paramtype = "light",
is_ground_content = false,
on_punch = function(pos, node, puncher, pointed_thing)
aliveai_electric.hit(pointed_thing.ref,5)
end,
})
minetest.register_node("aliveai_threats:crystal_grass", {
description = "Crystal grass",
tiles = {"aliveai_threats_crystal_grass.png"},
groups = {cracky = 2, puts_out_fire = 1, not_in_creative_inventory=1},
sounds = default.node_sound_glass_defaults(),
paramtype = "light",
walkable = false,
sunlight_propagates = true,
drawtype = "plantlike",
damage_per_second = 3,
})

View File

@ -0,0 +1,5 @@
default
aliveai
nitroglycerine?
vessels?
aliveai_electric?

252
aliveai_threats/eyes.lua Normal file
View File

@ -0,0 +1,252 @@
aliveai_threats_eyes={active={}}
if aliveai.spawning then
minetest.register_abm({
nodenames = {"group:tree"},
interval = 30,
chance = 300,
action = function(pos)
aliveai_threats_eyes.spawn(pos)
end,
})
end
aliveai_threats_eyes.checkspace=function(pos)
for i=1,4,1 do
local p1=minetest.get_node({x=pos.x+i,y=pos.y,z=pos.z}).name=="air"
local p2=minetest.get_node({x=pos.x-i,y=pos.y,z=pos.z}).name=="air"
local p3=minetest.get_node({x=pos.x,y=pos.y,z=pos.z+i}).name=="air"
local p4=minetest.get_node({x=pos.x,y=pos.y,z=pos.z-i}).name=="air"
if not (p1 and p2 and p3 and p4) then
return false
end
end
return true
end
aliveai_threats_eyes.spawn=function(pos)
for i,v in pairs(aliveai_threats_eyes.active) do
if not v:get_luaentity() or v:get_hp()<1 then
table.remove(aliveai_threats_eyes.active,i)
elseif pos.x==v:get_luaentity().stat.x and pos.z==v:get_luaentity().stat.z then
return false
end
end
local pos1={x=pos.x,y=pos.y-1,z=pos.z}
local pos2={x=pos.x,y=pos.y+1,z=pos.z}
if minetest.get_item_group(minetest.get_node(pos).name,"tree")~=0 and
aliveai_threats_eyes.checkspace(pos) then
local p={
{x=pos.x+1,y=pos.y,z=pos.z},
{x=pos.x-1,y=pos.y,z=pos.z},
{x=pos.x,y=pos.y,z=pos.z+1},
{x=pos.x,y=pos.y,z=pos.z-1}
}
local side=math.random(1,4)
local ob=minetest.add_entity(p[side], "aliveai_threats:eyes")
ob:get_luaentity().side=side
ob:get_luaentity().stat=pos
return true
end
return false
end
aliveai_threats_eyes.sweating=function(self,pos)
local p1={x=pos.x,y=pos.y+0.3,z=pos.z}
local p2={x=pos.x,y=pos.y-0.3,z=pos.z}
if self.side==1 or self.side==2 then
p1.z=p1.z+0.3
p2.z=p2.z-0.3
else
p1.x=p1.x+0.3
p2.x=p2.x-0.3
end
minetest.add_particlespawner({
amount = 1,
time =0.1,
maxpos = p1,
minpos = p2,
minvel = {x=0, y=-8, z=0},
maxvel = {x=0, y=-8, z=0},
minacc = {x=0, y=-8, z=0},
maxacc = {x=0, y=-10, z=0},
minexptime = 0.3,
maxexptime = 0.3,
minsize = 0.5,
maxsize = 0.1,
texture = "default_water.png",
})
end
aliveai_threats_eyes.shoot=function(self)
if not (self.fight and math.random(1,20)==1) then return end
local e=minetest.add_item(aliveai.pointat(self,1),"default:stick")
local dir=aliveai.get_dir(self,self.fight)
local vc = {x = dir.x*30, y = dir.y*30, z = dir.z*30}
if not (vc and vc.x and vc.y and vc.z) or vc.x==math.huge or vc.x~=vc.x then return end
e:setvelocity(vc)
e:get_luaentity().age=(tonumber(minetest.setting_get("item_entity_ttl")) or 900)-2
table.insert(aliveai_threats.debris,{ob=e,n=self.botname})
end
minetest.register_craftitem("aliveai_threats:tree_eyes", {
description = "Tree eyes spawner",
inventory_image = "aliveai_threats_eyes.png",
on_place = function(itemstack, user, pointed_thing)
if pointed_thing.type=="node" and aliveai_threats_eyes.spawn(pointed_thing.under) then
itemstack:take_item()
end
return itemstack
end
})
minetest.register_entity("aliveai_threats:eyes",{
hp_max = 10,
physical =false,
weight = 0,
collisionbox = {0,0,0,0,0,0},
visual = "upright_sprite",
visual_size = {x=1,y=1},
textures ={"aliveai_threats_eyes.png"},
colors = {},
spritediv = {x=1, y=1},
initial_sprite_basepos = {x=0, y=0},
is_visible = true,
makes_footstep_sound = false,
automatic_rotate = false,
on_punch=function(self, puncher, time_from_last_punch, tool_capabilities, dir)
local en=puncher:get_luaentity()
if not self.exp and tool_capabilities and tool_capabilities.damage_groups and tool_capabilities.damage_groups.fleshy then
self.hp=self.hp-tool_capabilities.damage_groups.fleshy
self.object:set_hp(self.hp)
end
end,
get_staticdata = function(self)
return aliveai.convertdata({side=self.side,opos=self.opos,stat=self.stat})
end,
on_activate=function(self, staticdata)
self.hp=self.object:get_hp()
local r=aliveai.convertdata(staticdata)
if r and r~="" then
self.side=r.side
self.opos=r.opos
self.stat=r.stat
end
self.botname=aliveai.genname()
self.opos=aliveai.roundpos(self.object:get_pos())
minetest.after(0.1, function(self)
if not self.stat then self.stat=self.object:get_pos() end
local s=3.14
if not self.side then self.side=1 end
if self.side==1 then
s=4.71
elseif self.side==2 then
s=1.57
elseif self.side==3 then
s=0
end
self.object:setyaw(s)
table.insert(aliveai_threats_eyes.active,self.object)
if self.side==1 then
self.opos.x=self.opos.x-0.49
elseif self.side==2 then
self.opos.x=self.opos.x+0.49
elseif self.side==3 then
self.opos.z=self.opos.z-0.49
elseif self.side==4 then
self.opos.z=self.opos.z+0.49
end
self.object:set_pos(self.opos)
end,self)
return self
end,
on_step=function(self, dtime)
self.time=self.time+dtime
self.time2=self.time2+dtime
if self.time<self.timer then return self end
self.time=0
local pos=self.object:get_pos()
if minetest.get_node(self.stat).name=="air" then aliveai.punch(self,self.object,100) return self end
if not self.lookat and math.random(1,10)~=1 then return end
local ob
for _, o in ipairs(minetest.get_objects_inside_radius(pos, 10)) do
local en=o:get_luaentity()
local op=o:get_pos()
if not (en and en.aliveai_eyes) and aliveai.visiable(self,o:get_pos()) and aliveai.viewfield(self,o) then ob=o break end
end
if not ob then
self.timer=2
self.time2=0
if self.lookat then
self.type=""
self.fight=nil
self.lookat=nil
self.object:moveto(self.opos)
self.object:set_properties({textures = {"aliveai_threats_eyes.png"}})
end
return
end
local obpos=ob:get_pos()
if ob:is_player() then obpos.y=obpos.y+2 end
local x,y,z=0,0,0
local d=aliveai.distance(pos,obpos)*2
if self.side==1 or self.side==2 then
z=(obpos.z-self.opos.z)/d
if z>0.3 then z=0.3 end
if z<-0.3 then z=-0.3 end
else
x=(obpos.x-self.opos.x)/d
if x>0.3 then x=0.3 end
if x<-0.3 then x=-0.3 end
end
y=(obpos.y-self.opos.y)/d
if y>0.3 then y=0.3 end
if y<-0.3 then y=-0.3 end
local spos=false
if self.lookat then spos=aliveai.samepos(self.lookat,obpos) end
self.object:moveto({x=self.opos.x+x,y=self.opos.y+y,z=self.opos.z+z})
self.lookat=obpos
self.timer=0.1
if self.fight then
aliveai_threats_eyes.shoot(self)
end
if not self.fight and spos and self.time2>10 then
if d<4 then
aliveai_threats_eyes.sweating(self,pos)
else
self.object:set_properties({textures = {"aliveai_threats_eyes_mad.png"}})
self.fight=ob
self.time2=0
self.type="monster"
end
elseif self.fight and self.time2>20 then
self.object:moveto(self.opos)
self.timer=2
self.time2=0
self.fight=nil
self.lookat=nil
self.object:moveto(self.opos)
self.object:set_properties({textures = {"aliveai_threats_eyes.png"}})
self.type=""
elseif not spos then
self.time2=0
end
return self
end,
time=0,
timer=2,
time2=0,
type="",
team="tree",
aliveai_eyes=1,
})
aliveai.loaded("aliveai_threats:eyes")

View File

@ -0,0 +1,77 @@
aliveai.create_bot({
attack_players=1,
name="flower",
team="flowers",
texture="flowers_rose.png",
talking=0,
light=0,
building=0,
type="monster",
hp=1,
dmg=1,
arm=1,
name_color="",
collisionbox={-0.1,-0.5,-0.1,0.1,0.2,0.1},
visual="cube",
drop_dead_body=0,
escape=0,
spawn_on={"group:flora"},
attack_chance=1,
spawn_chance=50,
--spawn_interval=5,
spawn_y=-1,
smartfight=0,
basey=-1,
spawn=function(self,t,t2)
if not self.storge2 then
local pos=self.object:get_pos()
if aliveai.group(pos,"flora")==0 or minetest.is_protected(pos,"") then
aliveai.kill(self)
return self
end
self.storge1=minetest.get_node(pos).name
self.inv[self.storge1]=1
minetest.remove_node(pos)
pos={x=pos.x,y=pos.y+1,z=pos.z}
self.object:set_pos(pos)
end
self.object:set_properties({visual="wielditem",visual_size={x=0.5,y=0.5},textures={self.storge1}})
end,
on_load=function(self)
self.spawn(self)
end,
on_step=function(self,dtime)
if self.fight and not self.storge2 then
local nodes=aliveai.get_nodes(self,self.distance,1)
for _, nodepos in ipairs(nodes) do
if aliveai.group(nodepos,"flora")>0 then
local f=minetest.add_entity(nodepos, "aliveai_threats:flower")
f:setyaw(math.random(0,6.28))
local en=f:get_luaentity()
aliveai.known(en,self.fight,"fight")
en.folow=self.fight
en.fight=self.fight
en.temper=10
en.storge2=1
aliveai.folowing(en)
return
end
end
elseif not self.fight and self.storge2 and aliveai.def(self.object:get_pos(),"buildable_to") then
if minetest.get_node(self.object:get_pos()).name~="air" then return end
local pos=self.object:get_pos()
if minetest.is_protected(pos,"") then
aliveai.kill(self)
else
minetest.set_node(pos,{name=self.storge1})
self.object:remove()
end
end
end,
death=function(self,puncher,pos)
end,
on_punched=function(self,puncher)
local pos=self.object:get_pos()
aliveai.lookat(self,pos)
end
})

207
aliveai_threats/fort.lua Normal file
View File

@ -0,0 +1,207 @@
aliveai_threats.fort={furnishings={"aliveai_threats:toxic_tank","aliveai_threats:labbottle_containing","aliveai_threats:timed_bumb","aliveai_threats:timed_nitrobumb","aliveai_threat_eletric:timed_ebumb","aliveai_threats:landmine","aliveai_threats:deadlock","aliveai_massdestruction:nuclearbarrel"},}
minetest.register_tool("aliveai_threats:fortspawner", {
description = "fort spawner",
range=15,
groups={not_in_creative_inventory=1},
inventory_image = "default_stick.png",
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type=="node" then
aliveai_threats.fort.spawning(pointed_thing.under,1)
end
end,
})
minetest.register_ore({
ore_type = "scatter",
ore = "aliveai_threats:fort_spawner",
wherein = "default:dirt_with_grass",
clust_scarcity = 20 * 20 * 20,
clust_num_ores = 1,
clust_size = 1,
y_min = -1,
y_max = 50,
})
minetest.register_ore({
ore_type = "scatter",
ore = "aliveai_threats:fort_spawner",
wherein = "default:snow",
clust_scarcity = 20 * 20 * 20,
clust_num_ores = 1,
clust_size = 1,
y_min = -1,
y_max = 50,
})
minetest.register_ore({
ore_type = "scatter",
ore = "aliveai_threats:fort_spawner",
wherein = "default:snowblock",
clust_scarcity = 20 * 20 * 20,
clust_num_ores = 1,
clust_size = 1,
y_min = -1,
y_max = 50,
})
minetest.register_abm({
nodenames = {"aliveai_threats:fort_spawner"},
interval = 10,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.set_node(pos,{name="default:stone"})
aliveai_threats.fort.spawning(pos)
end
})
aliveai_threats.fort.spawning=function(pos,nrnd)
if not nrnd and math.random(1,20)~=1 then return end
local test1=0
local test2=0
for y=-5,6,1 do
for x=-5,31,1 do
for z=-5,31,1 do
local p={x=pos.x+x,y=pos.y+y,z=pos.z+z}
if nrnd and minetest.is_protected(p,"") then return end
if y<1 and aliveai.def(p,"walkable") then
test1=test1+1
elseif y>0 and aliveai.def(p,"walkable") then
test2=test2+1
if test2>3000 then return end
end
end
end
end
if test1<7000 then return end
local door=math.random(11,17)
local n
local cam
local start
for y=0,6,1 do
for x=-5,31,1 do
for z=-5,31,1 do
local p={x=pos.x+x,y=pos.y+y,z=pos.z+z}
local n="air"
local param=0
if y==0 then
n="default:silver_sandstone_brick"
elseif y==6 and ((x==9 and z==9) or (x==18 and z==18) or (x==18 and z==9) or (x==9 and z==18)) then
n="aliveai_threats:secam2"
cam=1
elseif y<5 and (x==1 or x==26 or z==1 or z==26) and (x>0 and z>0 and x<27 and z<27) then
n="aliveai_threats:chainfence"
if aliveai_electric then start=1 end
param=1
if x==1 then
param=1
elseif x==26 then
param=3
elseif z==1 then
param=2
else
param=0
end
elseif (y==1 or y==2) and (((x==door and (z==9 or z==18)) or (z==door and (x==9 or x==18))))then
if y==1 then n="aliveai:door_steel" end
elseif (y==1 or y==2) and (x==door or z==door) then
elseif (y==1 or y==2) and (((x==10 or x==17) and (z>9 and z<18)) or ((z==10 or z==17) and (x>9 and x<18))) then
if y==1 then
n="aliveai_threats:labtable"
elseif math.random(1,3)==1 then
n=aliveai_threats.fort.furnishings[math.random(1,#aliveai_threats.fort.furnishings)]
end
elseif y<5 and (((x==9 or x==18) and (z>8 and z<19)) or ((z==9 or z==18) and (x>8 and x<19))) then
n="default:silver_sandstone_brick"
elseif y==5 and (x>8 and x<19 and z>8 and z<19) then
n="default:silver_sandstone_brick"
end
if n then
minetest.set_node(p,{name=n,param2=param})
if cam then
minetest.get_meta(p):set_string("team","nuke")
minetest.get_node_timer(p):start(1)
cam=nil
elseif start then
minetest.get_node_timer(p):start(1)
start=nil
end
end
end
end
end
if math.random(1,3)==1 then return end
for y=-5,0,1 do
for x=-4,30,1 do
for z=-4,30,1 do
local p={x=pos.x+x,y=pos.y+y,z=pos.z+z}
local n=nil
if y==-5 and ((x<0 or x>26) or (z<0 or z>26)) then
n="default:silver_sandstone_brick"
elseif x==-4 or x==30 or z==-4 or z==30 then
n="default:silver_sandstone_brick"
elseif (x>-4 and x<0) or (x>26 and x<30) or (z>-5 and z<0) or (z>26 and z<30) then
n="aliveai_threats:slime"
elseif x==0 or x==26 or z==0 or z==26 then
n="default:silver_sandstone_brick"
end
if n then
minetest.set_node(p,{name=n})
end
end
end
end
end
minetest.register_node("aliveai_threats:fort_spawner", {
tiles={"default_stone.png"},
groups = {not_in_creative_inventory=1},
is_ground_content = false
})
minetest.register_node("aliveai_threats:chainfence", {
description = "Chain fence",
tiles = {"aliveai_threats_chainfence.png"},
drawtype = "nodebox",
groups = {cracky=1, not_in_creative_inventory=0,level=3},
sounds = default.node_sound_stone_defaults(),
is_ground_content = false,
paramtype2 = "facedir",
paramtype = "light",
node_box = {type="fixed",fixed={-0.5,-0.5,0.45,0.5,0.5,0.5}},
on_punch = function(pos, node, puncher, pointed_thing)
if not (puncher:is_player() and minetest.get_meta(pos):get_string("owner")==puncher:get_player_name()) then
if aliveai_electric and aliveai.team(puncher)~="nuke" then
aliveai_electric.hit(puncher,20,5)
end
end
end,
after_place_node = function(pos, placer)
if placer:is_player() then
minetest.get_meta(pos):set_string("owner",placer:get_player_name())
end
end,
on_construct = function(pos)
if aliveai_electric then
minetest.get_node_timer(pos):start(5)
end
end,
on_timer = function (pos, elapsed)
if math.random(1,4)~=1 then return true end
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 2)) do
if aliveai.team(ob)~="nuke" then
aliveai_electric.hit(ob,20,5)
end
end
return true
end
})

2921
aliveai_threats/init.lua Normal file

File diff suppressed because it is too large Load Diff

712
aliveai_threats/lab.lua Normal file
View File

@ -0,0 +1,712 @@
aliveai_threats.lab={
furnishings1={"vessels:shelf","aliveai:chair","aliveai_threats:timed_bumb","aliveai_threats:timed_nitrobumb","aliveai_threat_eletric:timed_ebumb","aliveai_threats:landmine","aliveai_threats:deadlock","aliveai_massdestruction:nuclearbarrel"},
furnishings2={"vessels:steel_bottle","vessels:glass_bottle","vessels:drinking_glass","aliveai_threats:toxic_tank","aliveai_threats:labbottle_containing","aliveai_threats:labbottle"},
cam={"aliveai_threats:secam","aliveai_threats:secam2","aliveai_threat_eletric:secam"}
}
minetest.register_tool("aliveai_threats:labspawner", {
description = "labspawner",
range=15,
groups={not_in_creative_inventory=1},
inventory_image = "default_stick.png",
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type=="node" then
aliveai_threats.lab.spawning(pointed_thing.under,1)
end
end,
on_place = function(itemstack, user, pointed_thing)
if pointed_thing.type=="node" then
aliveai_threats.lab.gen_stair2(pointed_thing.above)
end
end
})
minetest.register_ore({
ore_type = "scatter",
ore = "aliveai_threats:lab_spawner",
wherein = "default:stone",
clust_scarcity = 36 * 36 * 36,
clust_num_ores = 1,
clust_size = 1,
y_min = -100,
y_max = 20,
})
minetest.register_ore({
ore_type = "scatter",
ore = "aliveai_threats:lab_spawner",
wherein = "default:desert_stone",
clust_scarcity = 36 * 36 * 36,
clust_num_ores = 1,
clust_size = 1,
y_min = -100,
y_max = 20,
})
minetest.register_abm({
nodenames = {"aliveai_threats:lab_spawner"},
interval = 1,
chance = 10,
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.set_node(pos,{name="default:stone"})
aliveai_threats.lab.spawning(pos)
end
})
aliveai_threats.lab.spawning=function(p,nrnd)
if not nrnd and math.random(1,100)~=1 then return end
local pos4
for i=1,20,1 do
pos4={x=p.x,y=p.y+i,z=p.z}
local get_light=minetest.get_node_light(pos4)
if minetest.get_node(pos4).name=="ignore" or (get_light and get_light>3) or minetest.is_protected(pos4,"") then return end
end
p={x=p.x-20,y=p.y-3,z=p.z-20}
local sta
local by=math.random(4,6)
local bx=12
local bz=12
local floor=math.random(1,4)
local cfloor=0
local croom=0
aliveai_threats.lab.gen_stairs2=1
for y=6,floor*6,6 do
cfloor=cfloor+1
for x=0,24,12 do
for z=0,24,12 do
croom=croom+1
aliveai_threats.lab.gen_room({x=p.x+x,y=p.y+y,z=p.z+z},bx,by,bz,floor,cfloor,croom)
end
end
end
if aliveai_threats.lab.gen_stairs2==1 then --force add stair if none is spawned
aliveai_threats.lab.gen_stair2({x=p.x+12+1,y=p.y+(floor*6)+1,z=p.z+12+1})
aliveai_threats.lab.gen_stairs2=nil
end
end
aliveai_threats.lab.spawn=function(pos)
local bots={}
local c=0
for i, v in pairs(aliveai.registered_bots) do
if (v.team=="nuke" or v.team=="alien") and v.mod_name~="aliveai_massdestruction" then
table.insert(bots,v.bot)
end
end
local addbot=bots[aliveai.random(1,#bots)]
if addbot then minetest.add_entity(pos, addbot) end
end
aliveai_threats.lab.gen_stair2=function(pos)
local ys=0
local base="default:silver_sandstone_brick"
local stair="stairs:stair_steelblock"
local pos3
local get_light
local light="aliveai_threats:lablight"
local light2="aliveai_threats:lablight2"
local set_timer=false
for i=1,1000,1 do
pos3={x=pos.x,y=pos.y+i,z=pos.z}
get_light=minetest.get_node_light(pos3)
if minetest.get_node(pos3).name=="ignore" then return end
if i>6 and get_light and get_light>3 and pos3.y>7 and aliveai.def(pos3,"buildable_to") then
ys=i-1
break
end
end
if ys==0 then return end
pos3={x=pos.x+2,y=pos3.y-1,z=pos.z+2}
local pos4
for y=0,6,1 do
for x=-6,6,1 do
for z=-6,6,1 do
pos4={x=pos3.x+x,y=pos3.y+y,z=pos3.z+z}
if not minetest.is_protected(pos4,"") then
if (y==0 or y==6 or x==-6 or x==6 or z==-6 or z==6) and not ((y==1 or y==2) and (x==0 or z==0)) then
minetest.set_node(pos4,{name=base})
elseif y==5 and ((x==-4 and z==-4) or (x==4 and z==4) or (x==-4 and z==4) or (x==4 and z==-4)) then
local r=math.random(1,4)
if r==3 then
local r2=math.random(1,#aliveai_threats.lab.cam)
if aliveai_threats.lab.cam[r2] then
minetest.set_node(pos4,{name=aliveai_threats.lab.cam[r2],param2=21})
minetest.get_meta(pos4):set_string("team","nuke")
minetest.get_node_timer(pos4):start(1)
end
elseif r==1 then
minetest.set_node(pos4,{name=light})
elseif r==2 then
minetest.set_node(pos4,{name=light2})
minetest.get_node_timer(pos4):start(1)
else
minetest.set_node(pos4,{name=light2})
end
else
minetest.set_node(pos4,{name="air"})
end
end
end
end
end
local a={x=0,y=0,z=0}
local pos2
local n
local k=true
local m
local p=0
local st=(ys+1)*5*5
local s=0
local ss=0
local set_timer=false
for y=0,ys,1 do
for x=-1,5,1 do
for z=-1,5,1 do
ss=ss+1
pos2={x=pos.x+x,y=pos.y+y,z=pos.z+z}
if y==a.y and x==a.x and z==a.z then --stair
n=stair
a.y=a.y+1
s=s+1
if s<=4 then
p=1
if s==1 then p=2 end
a.x=a.x+1
elseif s<=8 then
if s==5 then p=1 end
a.z=a.z+1
elseif s<=12 then
p=3
if s==9 then p=0 end
a.x=a.x-1
elseif s<=16 then
p=2
if s==13 then p=3 end
a.z=a.z-1
if s==16 then s=0 end
end
elseif y==ys and not (x==-1 or x==5 or z==-1 or z==5) then --floor table
n="aliveai_threats:labtable2"
set_timer=true
elseif s==5 and x==4 and z==4 then
local r=math.random(1,4)
if r==1 then
n=light
elseif r==2 then
n=light2
set_timer=true
else
n=light2
end
p=12
elseif y>=4 and (x==-1 or x==5 or z==-1 or z==5) then --walls
n=base
elseif y<4 and (x==-1 or x==5 or z==-1 or z==5) then
n=""
elseif y<ys then --clean
n="air"
end
--set
if n~="" then minetest.set_node(pos2,{name=n,param2=p}) end
if set_timer then
minetest.get_node_timer(pos2):start(1)
set_timer=false
end
p=0
end
end
end
end
aliveai_threats.lab.gen_stair=function(pos)
local base="default:silver_sandstone_brick"
local stair="stairs:stair_steelblock"
local a={x=0,y=0,z=0}
local pos2
local n
local k=true
local m
local p=0
for y=0,6,1 do
for x=0,4,1 do
for z=0,4,1 do
if y==a.y and y<6 and x==a.x and z==a.z then --stair
n=stair
a.y=a.y+1
if y==0 then
a.x=a.x+1
p=2
elseif y<4 then
a.x=a.x+1
p=1
else
if y==4 then p=1 end
a.z=a.z+1
end
elseif y>2 and ((z==0 and x>0) or (z==1 and x==4)) then --hole
n="air"
if y==5 and (x==1 or x==2) then
n="aliveai_threats:labtable2"
end
else --clean
n="air"
if y>2 then n="" end
end
if n~="" then --set
pos2={x=pos.x+x,y=pos.y+y,z=pos.z+z}
minetest.set_node(pos2,{name=n,param2=p})
end
p=0
end
end
end
end
aliveai_threats.lab.gen_room=function(pos,bx,by,bz,floor,cfloor,croom)
if not pos then return end
pos=aliveai.roundpos(pos)
local base="default:silver_sandstone_brick"
local n="air"
local door="aliveai:door_steel"
local light="aliveai_threats:lablight"
local light2="aliveai_threats:lablight2"
local furn="aliveai_threats:labtable"
local pos2
local set_timer=false
local get_light=0
local m=nil
local d={}
local a={x=bx,y=by,z=bz}
local doors={
x1=math.random(1,5)>1,
x2=math.random(1,5)>1,
z1=math.random(1,5)>1,
z2=math.random(1,5)>1,
xb1=math.random(1,5)>1,
xb2=math.random(1,5)>1,
zb1=math.random(1,5)>1,
zb2=math.random(1,5)>1
}
local wall={n=0,
x1=math.random(0,20)>5,
x2=math.random(0,20)>5,
z1=math.random(0,20)>5,
z2=math.random(0,20)>5
}
--door inside ... pos of 1/2 box
local x1=a.x/2
local z1=a.z/2
--door boxes sides
local x2a=a.x/4
local x2b=a.x-x2a
local z2a=a.z/4
local z2b=a.z-z2a
--walls count
if wall.x1 then wall.n=wall.n+1 end
if wall.x2 then wall.n=wall.n+1 end
if wall.z1 then wall.n=wall.n+1 end
if wall.z2 then wall.n=wall.n+1 end
local all_nodes={}
for y=0,a.y,1 do
for x=0,a.x,1 do
for z=0,a.z,1 do
pos2={x=pos.x+x,y=pos.y+y,z=pos.z+z}
get_light=minetest.get_node_light(pos2)
if (get_light and get_light>7) or minetest.is_protected(pos2,"") then return end
if x==0 or x==a.x --wall box
or y==0
or y==a.y
or z==0 or z==a.z then
if (y==1 or y==2) and ((x==x2a and doors.xb1) or (x==x2b and doors.xb2) or (z==z2a and doors.zb1) or (z==z2b and doors.zb2)) and minetest.get_node(pos2).name==base then
if y==1 then
n=door
else
n="air"
end
else
n=base
end
elseif y==1 and ((x==1 and z==1) or (x==x1+1 and z==z1+1)) then --set stair
if aliveai_threats.lab.gen_stairs2 and cfloor==floor and (math.random(1,20)==1 or croom==9) then
aliveai_threats.lab.gen_stairs2=nil
n="stair2"
elseif cfloor<floor and math.random(1,8)==1 then
n="stair"
end
elseif wall.n>1 and ( --middle walls
(wall.x1 and x<x1 and z==z1) or
(wall.x2 and x>x1 and z==z1) or
(wall.z1 and z<z1 and x==x1) or
(wall.z2 and z>x1 and x==x1)) then
if (y==1 or y==2) and ( --door
(doors.x1 and wall.x1 and x==x1/2) or
(doors.x2 and wall.x2 and x==x1*1.5) or
(doors.z1 and wall.z1 and z==z1/2) or
(doors.z2 and wall.z2 and z==z1*1.5)) then
if y==1 then
n=door
else
n="air"
end
else
n=base
end
elseif wall.n>1 and x==x1 and z==z1 then --center
n=base
elseif y==a.y-1 and ((x==x2a and z==z2a) or (x==x2b and z==z2b) or (x==x2a and z==z2b) or (x==x2b and z==z2a)) then
local r=math.random(1,10)
if r==5 and math.random(1,2)==1 then
local r2=math.random(1,#aliveai_threats.lab.cam)
if aliveai_threats.lab.cam[r2] then
n=aliveai_threats.lab.cam[r2]
m=1
set_timer=true
end
elseif r>4 then
n=light
elseif r<4 then
n=light2
else
n=light
set_timer=true
end
elseif y==1 and (x==1 or z==1 or x==a.x-1 or z==a.z-1) then --set furns
n=furn
set_timer=true
else --else
n="air"
end
table.insert(all_nodes,{n=n,pos=pos2,m=m})
m=nil
if set_timer then
set_timer=false
minetest.get_node_timer(pos2):start(1)
end
end
end
end
for i, v in pairs(all_nodes) do
if v.m then
minetest.set_node(v.pos,{name=v.n,param2=21})
minetest.get_meta(pos):set_string("team","nuke")
elseif v.n=="stair" then
minetest.after(math.random(1), function(v)
aliveai_threats.lab.gen_stair(v.pos)
end,v)
elseif v.n=="stair2" then
minetest.after(math.random(1), function(v)
aliveai_threats.lab.gen_stair2(v.pos)
end,v)
else
minetest.set_node(v.pos,{name=v.n})
end
end
end
minetest.register_node("aliveai_threats:lablight", {
description = "Lab light",
tiles = {"default_cloud.png"},
drawtype = "nodebox",
groups = {snappy = 3, not_in_creative_inventory=0},
sounds = default.node_sound_glass_defaults(),
is_ground_content = false,
paramtype = "light",
paramtype2 = "facedir",
node_box = {type="fixed",fixed={-0.2,0.3,-0.4,0.2,0.5,0.4}},
light_source=14,
on_punch = function(pos, node, puncher, pointed_thing)
if minetest.is_protected(pos,puncher:get_player_name())==false then
minetest.sound_play("default_break_glass", {pos=pos, gain = 1.0, max_hear_distance = 5})
minetest.get_node_timer(pos):start(1)
minetest.swap_node(pos, {name = "aliveai_threats:lablight2",param2=minetest.get_node(pos).param2})
end
end,
on_timer = function (pos, elapsed)
if math.random(3)==1 then
minetest.swap_node(pos, {name = "aliveai_threats:lablight2",param2=minetest.get_node(pos).param2})
end
return true
end,
on_blast=function(pos)
minetest.get_node_timer(pos):start(1)
end,
})
minetest.register_node("aliveai_threats:lablight2", {
description = "Lab light damaged (off)",
tiles = {"default_cloud.png"},
drawtype = "nodebox",
groups = {snappy = 3, not_in_creative_inventory=1},
sounds = default.node_sound_glass_defaults(),
is_ground_content = false,
node_box = {type="fixed",fixed={-0.2,0.3,-0.4,0.2,0.5,0.4}},
drop="aliveai_threats:lablight",
paramtype2 = "facedir",
on_construct = function(pos)
minetest.get_node_timer(pos):start(1)
end,
on_timer = function (pos, elapsed)
if math.random(3)==1 then
minetest.swap_node(pos, {name = "aliveai_threats:lablight",param2=minetest.get_node(pos).param2})
end
return true
end,
on_blast=function(pos)
minetest.get_node_timer(pos):stop()
end,
on_punch = function(pos, node, puncher, pointed_thing)
if minetest.is_protected(pos,puncher:get_player_name())==false then
minetest.sound_play("default_break_glass", {pos=pos, gain = 1.0, max_hear_distance = 5})
minetest.get_node_timer(pos):stop()
end
end,
})
minetest.register_node("aliveai_threats:labtable2", {
description = "Lab table2",
tiles = {"default_silver_sandstone_brick.png"},
drawtype = "nodebox",
node_box = {type="fixed",fixed={-0.5,0.4,-0.5,0.5,0.5,0.5}},
groups = {cracky = 3, not_in_creative_inventory=1},
sounds = default.node_sound_stone_defaults(),
is_ground_content = false,
on_timer = function (pos, elapsed)
for i=1,3,1 do
if aliveai.def({x=pos.x,y=pos.y-i,z=pos.z},"walkable") then
minetest.set_node(pos,{name="air"})
return false
end
end
return false
end,
})
minetest.register_node("aliveai_threats:lab_spawner", {
description = "Lab spawner",
drawtype="airlike",
groups = {not_in_creative_inventory=1},
is_ground_content = false
})
minetest.register_node("aliveai_threats:deadlock", {
description = "Deadlock",
groups = {cracky=3,not_in_creative_inventory=1},
tiles={"default_steel_block.png^aliveai_threats_quantum_monster_lights.png"},
paramtype = "light",
is_ground_content = false,
drawtype = "nodebox",
node_box = {type="fixed",fixed={-0.5,-0.5,-0.5,0.5,-0.4,0.5}},
on_construct = function(pos)
minetest.get_node_timer(pos):start(1)
end,
on_timer = function (pos, elapsed)
for _, ob in ipairs(minetest.get_objects_inside_radius(pos, 1)) do
if aliveai.is_bot(ob) then
ob:get_luaentity().timer=-1
return true
end
end
return true
end,
})
minetest.register_node("aliveai_threats:toxic_tank", {
description = "Toxic tank",
groups = {cracky=3,snappy = 3,not_in_creative_inventory=1},
tiles={"default_glass.png"},
special_tiles = {
{
name = "default_lava_source_animated.png^[colorize:#d8ff2d77",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1,
},
},
},
paramtype = "light",
is_ground_content = false,
drawtype = "glasslike_framed",
paramtype2 = "glasslikeliquidlevel",
sounds = default.node_sound_glass_defaults(),
on_punch = function(pos, node, puncher, pointed_thing)
minetest.get_node_timer(pos):start(1)
end,
on_construct = function(pos)
local a=math.random(32,64)
minetest.get_meta(pos):set_int("v",a)
minetest.swap_node(pos, {name = "aliveai_threats:toxic_tank",param2=a})
end,
on_timer = function (pos, elapsed)
local v=minetest.get_meta(pos):get_int("v")
minetest.get_meta(pos):set_int("v",v-1)
for _, ob in ipairs(minetest.get_objects_inside_radius(pos, 3)) do
if aliveai.visiable(pos,ob:get_pos()) then aliveai_threats.tox(ob) end
end
if v>0 then
minetest.swap_node(pos, {name = "aliveai_threats:toxic_tank",param2=v})
return true
else
minetest.set_node(pos,{name="default:glass"})
return false
end
end,
})
minetest.register_node("aliveai_threats:labbottle_containing", {
description = "Lab bottle",
groups = {not_in_creative_inventory=1,dig_immediate = 3, attached_node = 1},
inventory_image = "aliveai_threats_testbottle_containin.png",
tiles={"aliveai_threats_testbottle_containin.png"},
paramtype = "light",
is_ground_content = false,
drawtype = "plantlike",
walkable = false,
sounds = default.node_sound_glass_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.27, -0.5, -0.27, 0.27, 0.2, 0.27}
},
drop = {
max_items=2,
items = {
{items = {"aliveai_threats:labbottle"}},
{items = {"aliveai:hypnotics"}, rarity = 2},
{items = {"aliveai_threats:mind_manipulator"}, rarity = 3},
{items = {"aliveai_threats:acid"}, 2},
{items = {"aliveai_massdestruction:blackholecore"}, rarity = 2},
{items = {"aliveai:relive"}, rarity = 2},
{items = {"aliveai:team_gift"}, rarity = 3},
}}
})
minetest.register_node("aliveai_threats:labbottle", {
description = "Lab bottle",
groups = {vessel = 1, not_in_creative_inventory=1,dig_immediate = 3, attached_node = 1},
tiles={"aliveai_threats_testbottle.png"},
inventory_image = "aliveai_threats_testbottle.png",
paramtype = "light",
is_ground_content = false,
drawtype = "plantlike",
walkable = false,
sounds = default.node_sound_glass_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.27, -0.5, -0.27, 0.27, 0.2, 0.27}
},
on_use = function(itemstack, user, pointed_thing)
local pos=user:get_pos()
local dir=user:get_look_dir()
local e=minetest.add_item({x=pos.x+(dir.x*2),y=pos.y+2+(dir.y*2),z=pos.z+(dir.z*2)},"aliveai_threats:labbottle")
local vc = {x = dir.x*15, y = dir.y*15, z = dir.z*15}
e:setvelocity(vc)
e:get_luaentity().age=(tonumber(minetest.setting_get("item_entity_ttl")) or 900)-10
e:get_luaentity().on_punch=nil
e:get_luaentity().hp_max=10
table.insert(aliveai_threats.debris,{ob=e,n=user:get_player_name()})
itemstack:take_item()
return itemstack
end,
})
minetest.register_craft( {
output = "vessels:glass_fragments",
recipe = {
{"aliveai_threats:labbottle"},
{"aliveai_threats:labbottle"},
}
})
minetest.override_item("vessels:drinking_glass", {
on_use = function(itemstack, user, pointed_thing)
local pos=user:get_pos()
local dir=user:get_look_dir()
local e=minetest.add_item({x=pos.x+(dir.x*2),y=pos.y+2+(dir.y*2),z=pos.z+(dir.z*2)},"vessels:drinking_glass")
local vc = {x = dir.x*15, y = dir.y*15, z = dir.z*15}
e:setvelocity(vc)
e:get_luaentity().age=(tonumber(minetest.setting_get("item_entity_ttl")) or 900)-10
table.insert(aliveai_threats.debris,{ob=e,n=user:get_player_name()})
itemstack:take_item()
return itemstack
end,
})
minetest.override_item("vessels:glass_bottle", {
on_use = function(itemstack, user, pointed_thing)
local pos=user:get_pos()
local dir=user:get_look_dir()
local e=minetest.add_item({x=pos.x+(dir.x*2),y=pos.y+2+(dir.y*2),z=pos.z+(dir.z*2)},"vessels:glass_bottle")
local vc = {x = dir.x*15, y = dir.y*15, z = dir.z*15}
e:setvelocity(vc)
e:get_luaentity().age=(tonumber(minetest.setting_get("item_entity_ttl")) or 900)-10
table.insert(aliveai_threats.debris,{ob=e,n=user:get_player_name()})
itemstack:take_item()
return itemstack
end,
})
minetest.register_node("aliveai_threats:labtable", {
description = "Lab table",
tiles = {"default_silver_sandstone_block.png^[colorize:#ffffff77"},
groups = {cracky = 3, not_in_creative_inventory=1},
sounds = default.node_sound_stone_defaults(),
is_ground_content = false,
on_timer = function (pos, elapsed)
local d="aliveai:door_steel"
if minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z}).name==d
or minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z}).name==d
or minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1}).name==d
or minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1}).name==d then
minetest.set_node(pos,{name="air"})
return false
end
local r1=math.random(1,5)
if r1>3 then
local n=math.random(1,#aliveai_threats.lab.furnishings2+5)
if aliveai_threats.lab.furnishings2[n] then
pos.y=pos.y+1
minetest.set_node(pos,{name=aliveai_threats.lab.furnishings2[n]})
end
elseif r1==3 and math.random(1,10)==1 then
local n=math.random(1,#aliveai_threats.lab.furnishings1)
if aliveai_threats.lab.furnishings1[n] then
minetest.set_node(pos,{name=aliveai_threats.lab.furnishings1[n]})
if aliveai_threats.lab.furnishings1[n]=="aliveai_threats:deadlock" then
aliveai_threats.lab.spawn(pos)
end
end
elseif r1<3 then
minetest.set_node(pos,{name="air"})
if math.random(1,30)==1 then
aliveai_threats.lab.spawn(pos)
end
end
return false
end,
})

View File

@ -0,0 +1,94 @@
# Blender v2.78 (sub 0) OBJ File: 'pollution_crystal.blend'
# www.blender.org
mtllib pollution_crystal.mtl
o Cube_Cube.001
v -0.031811 0.002414 0.031811
v -0.031811 0.066037 0.031811
v -0.031811 0.002414 -0.031811
v -0.031811 0.066037 -0.031811
v 0.031811 0.002414 0.031811
v 0.031811 0.066037 0.031811
v 0.031811 0.002414 -0.031811
v 0.031811 0.066037 -0.031811
v -0.003181 0.116534 0.003181
v -0.003181 0.116534 -0.003181
v 0.003181 0.116534 0.003181
v 0.003181 0.116534 -0.003181
v -0.012462 -0.264709 0.012462
v -0.012462 -0.264709 -0.012462
v 0.012462 -0.264709 0.012462
v 0.012462 -0.264709 -0.012462
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 0.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 1.0000 0.0000 0.0000
vn 0.0000 0.0000 1.0000
vn 0.9974 -0.0722 0.0000
vn 0.0000 0.4932 -0.8699
vn 0.0000 1.0000 0.0000
vn 0.8699 0.4932 0.0000
vn -0.8699 0.4932 0.0000
vn 0.0000 0.4932 0.8699
vn 0.0000 -1.0000 0.0000
vn 0.0000 -0.0722 0.9974
vn 0.0000 -0.0722 -0.9974
vn -0.9974 -0.0722 0.0000
usemtl Material.002
s off
f 1/1/1 2/2/1 4/3/1 3/4/1
f 3/5/2 4/6/2 8/7/2 7/8/2
f 7/9/3 8/10/3 6/11/3 5/12/3
f 5/13/4 6/14/4 2/15/4 1/16/4
f 7/9/5 5/17/5 15/18/5 16/19/5
f 8/20/6 4/6/6 10/21/6 12/22/6
f 12/23/7 10/24/7 9/25/7 11/26/7
f 6/27/8 8/10/8 12/28/8 11/26/8
f 4/29/9 2/2/9 9/25/9 10/30/9
f 2/31/10 6/14/10 11/32/10 9/33/10
f 14/34/11 16/35/11 15/18/11 13/36/11
f 5/13/12 1/37/12 13/38/12 15/39/12
f 3/5/13 7/40/13 16/41/13 14/42/13
f 1/1/14 3/43/14 14/44/14 13/36/14

View File

@ -0,0 +1,549 @@
# Blender v2.78 (sub 0) OBJ File: 'pollution_crystals.blend'
# www.blender.org
mtllib pollution_crystals.mtl
o Cube_Cube.001
v 0.023448 1.441446 0.586645
v 0.023448 2.541710 0.586645
v 0.023448 1.441446 -0.513619
v 0.023448 2.541710 -0.513619
v 1.123712 1.441446 0.586645
v 1.123712 2.541710 0.586645
v 1.123712 1.441446 -0.513619
v 1.123712 2.541710 -0.513619
v 0.518567 3.414985 0.091526
v 0.518567 3.414985 -0.018500
v 0.628593 3.414985 0.091526
v 0.628593 3.414985 -0.018500
v 0.358072 -3.178070 0.252021
v 0.358072 -3.178070 -0.178995
v 0.789088 -3.178070 0.252021
v 0.789088 -3.178070 -0.178995
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 0.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 1.0000 0.0000 0.0000
vn 0.0000 0.0000 1.0000
vn 0.9974 -0.0722 0.0000
vn 0.0000 0.4932 -0.8699
vn 0.0000 1.0000 0.0000
vn 0.8699 0.4932 0.0000
vn -0.8699 0.4932 0.0000
vn 0.0000 0.4932 0.8699
vn 0.0000 -1.0000 0.0000
vn 0.0000 -0.0722 0.9974
vn 0.0000 -0.0722 -0.9974
vn -0.9974 -0.0722 0.0000
usemtl Material.002
s off
f 1/1/1 2/2/1 4/3/1 3/4/1
f 3/5/2 4/6/2 8/7/2 7/8/2
f 7/9/3 8/10/3 6/11/3 5/12/3
f 5/13/4 6/14/4 2/15/4 1/16/4
f 7/9/5 5/17/5 15/18/5 16/19/5
f 8/20/6 4/6/6 10/21/6 12/22/6
f 12/23/7 10/24/7 9/25/7 11/26/7
f 6/27/8 8/10/8 12/28/8 11/26/8
f 4/29/9 2/2/9 9/25/9 10/30/9
f 2/31/10 6/14/10 11/32/10 9/33/10
f 14/34/11 16/35/11 15/18/11 13/36/11
f 5/13/12 1/37/12 13/38/12 15/39/12
f 3/5/13 7/40/13 16/41/13 14/42/13
f 1/1/14 3/43/14 14/44/14 13/36/14
o Cube.001_Cube.000
v -1.894439 2.054051 0.079474
v -2.195457 3.333790 -0.070682
v -1.947618 1.863163 -1.440799
v -2.248636 3.142902 -1.590955
v -0.288794 2.419751 -0.022609
v -0.589812 3.699489 -0.172765
v -0.341973 2.228863 -1.542881
v -0.642991 3.508601 -1.693038
v -1.735764 4.428179 -0.919921
v -1.741082 4.409090 -1.071949
v -1.575200 4.464748 -0.930129
v -1.580517 4.445660 -1.082157
v -0.158446 -3.265836 0.216506
v -0.179278 -3.340614 -0.379043
v 0.470547 -3.122577 0.176517
v 0.449715 -3.197355 -0.419033
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 0.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vn -0.9732 -0.2216 0.0619
vn -0.0347 -0.1245 -0.9916
vn 0.9732 0.2216 -0.0619
vn 0.0347 0.1245 0.9916
vn 0.9897 0.1337 -0.0514
vn -0.1539 0.4269 -0.8911
vn -0.2275 0.9671 -0.1135
vn 0.6633 0.7393 -0.1160
vn -0.9260 0.3773 -0.0150
vn -0.0959 0.6351 0.7665
vn 0.2275 -0.9671 0.1135
vn 0.0536 0.0432 0.9976
vn -0.0155 -0.2050 -0.9786
vn -0.9488 -0.3077 0.0718
usemtl Material.000
s off
f 17/45/15 18/46/15 20/47/15 19/48/15
f 19/49/16 20/50/16 24/51/16 23/52/16
f 23/53/17 24/54/17 22/55/17 21/56/17
f 21/57/18 22/58/18 18/59/18 17/60/18
f 23/53/19 21/61/19 31/62/19 32/63/19
f 24/64/20 20/50/20 26/65/20 28/66/20
f 28/67/21 26/68/21 25/69/21 27/70/21
f 22/71/22 24/54/22 28/72/22 27/70/22
f 20/73/23 18/46/23 25/69/23 26/74/23
f 18/75/24 22/58/24 27/76/24 25/77/24
f 30/78/25 32/79/25 31/62/25 29/80/25
f 21/57/26 17/81/26 29/82/26 31/83/26
f 19/49/27 23/84/27 32/85/27 30/86/27
f 17/45/28 19/87/28 30/88/28 29/80/28
o Cube.002
v 1.019832 0.351057 -0.502994
v 1.367006 0.919804 -0.732864
v 0.504731 0.273778 -1.472158
v 0.851905 0.842524 -1.702028
v 1.827034 -0.294273 -0.880556
v 2.174208 0.274473 -1.110426
v 1.311933 -0.371553 -1.849720
v 1.659107 0.197194 -2.079590
v 1.774001 1.046041 -1.521338
v 1.722491 1.038313 -1.618254
v 1.854721 0.981508 -1.559094
v 1.803211 0.973780 -1.656010
v -0.348957 -2.256623 0.052547
v -0.550742 -2.286896 -0.327111
v -0.032745 -2.509424 -0.095358
v -0.234530 -2.539697 -0.475017
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 0.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vn -0.7336 0.5865 0.3432
vn -0.4682 -0.0702 -0.8808
vn 0.7336 -0.5865 -0.3432
vn 0.4682 0.0702 0.8808
vn 0.6737 -0.6735 -0.3043
vn -0.0242 0.4822 -0.8758
vn 0.4925 0.8069 -0.3261
vn 0.8758 0.0955 -0.4731
vn -0.2230 0.9740 0.0408
vn 0.6770 0.5873 0.4435
vn -0.4925 -0.8069 0.3261
vn 0.4099 -0.0209 0.9119
vn -0.5205 -0.1604 -0.8386
vn -0.7843 0.4922 0.3776
usemtl Material.001
s off
f 33/89/29 34/90/29 36/91/29 35/92/29
f 35/93/30 36/94/30 40/95/30 39/96/30
f 39/97/31 40/98/31 38/99/31 37/100/31
f 37/101/32 38/102/32 34/103/32 33/104/32
f 39/97/33 37/105/33 47/106/33 48/107/33
f 40/108/34 36/94/34 42/109/34 44/110/34
f 44/111/35 42/112/35 41/113/35 43/114/35
f 38/115/36 40/98/36 44/116/36 43/114/36
f 36/117/37 34/90/37 41/113/37 42/118/37
f 34/119/38 38/102/38 43/120/38 41/121/38
f 46/122/39 48/123/39 47/106/39 45/124/39
f 37/101/40 33/125/40 45/126/40 47/127/40
f 35/93/41 39/128/41 48/129/41 46/130/41
f 33/89/42 35/131/42 46/132/42 45/124/42
o Cube.003
v 2.253079 3.729011 -0.132745
v 2.700144 5.055216 -0.203345
v 2.198353 3.710644 -0.824298
v 2.645419 5.036849 -0.894898
v 3.065754 3.452025 -0.189699
v 3.512820 4.778230 -0.260299
v 3.011029 3.433659 -0.881253
v 3.458094 4.759863 -0.951853
v 3.396056 5.974911 -0.596208
v 3.390583 5.973074 -0.665363
v 3.477323 5.947213 -0.601903
v 3.471851 5.945376 -0.671059
v 0.606566 -1.928959 -0.063972
v 0.585128 -1.936154 -0.334880
v 0.924922 -2.037465 -0.086283
v 0.903484 -2.044660 -0.357192
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 0.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vn -0.9445 0.3219 0.0662
vn -0.0789 -0.0265 -0.9965
vn 0.9445 -0.3219 -0.0662
vn 0.0789 0.0265 0.9965
vn 0.9293 -0.3636 -0.0639
vn 0.0103 0.2304 -0.9731
vn 0.3190 0.9464 -0.0504
vn 0.9968 0.0072 -0.0791
vn -0.7871 0.6152 0.0459
vn 0.1622 0.2813 0.9458
vn -0.3190 -0.9464 0.0504
vn 0.0674 -0.0075 0.9977
vn -0.0902 -0.0604 -0.9941
vn -0.9577 0.2795 0.0684
usemtl Material.003
s off
f 49/133/43 50/134/43 52/135/43 51/136/43
f 51/137/44 52/138/44 56/139/44 55/140/44
f 55/141/45 56/142/45 54/143/45 53/144/45
f 53/145/46 54/146/46 50/147/46 49/148/46
f 55/141/47 53/149/47 63/150/47 64/151/47
f 56/152/48 52/138/48 58/153/48 60/154/48
f 60/155/49 58/156/49 57/157/49 59/158/49
f 54/159/50 56/142/50 60/160/50 59/158/50
f 52/161/51 50/134/51 57/157/51 58/162/51
f 50/163/52 54/146/52 59/164/52 57/165/52
f 62/166/53 64/167/53 63/150/53 61/168/53
f 53/145/54 49/169/54 61/170/54 63/171/54
f 51/137/55 55/172/55 64/173/55 62/174/55
f 49/133/56 51/175/56 62/176/56 61/168/56
o Cube.004
v -1.694765 2.986474 3.834678
v -1.899361 4.593619 4.538314
v -1.968595 3.940166 1.576767
v -2.173192 5.547312 2.280403
v 0.611890 3.337655 3.703268
v 0.407293 4.944800 4.406904
v 0.338060 4.291347 1.445356
v 0.133463 5.898493 2.148992
v -1.146978 6.456398 4.021592
v -1.174361 6.551767 3.795801
v -0.916312 6.491516 4.008451
v -0.943695 6.586885 3.782660
v -0.217511 -3.364362 0.153758
v -0.324781 -2.990764 -0.730752
v 0.686095 -3.226791 0.102280
v 0.578825 -2.853193 -0.782231
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 0.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vn -0.9870 -0.1503 0.0562
vn -0.1110 0.3867 -0.9155
vn 0.9870 0.1503 -0.0562
vn 0.1110 -0.3867 0.9155
vn 0.9936 0.0628 -0.0940
vn -0.1589 0.8679 -0.4705
vn -0.1158 0.9099 0.3984
vn 0.7201 0.6662 0.1941
vn -0.8591 0.4258 0.2840
vn 0.0152 0.2616 0.9651
vn 0.1158 -0.9099 -0.3984
vn 0.1221 -0.4763 0.8708
vn -0.0988 0.2932 -0.9509
vn -0.9715 -0.2364 0.0180
usemtl Material.004
s off
f 65/177/57 66/178/57 68/179/57 67/180/57
f 67/181/58 68/182/58 72/183/58 71/184/58
f 71/185/59 72/186/59 70/187/59 69/188/59
f 69/189/60 70/190/60 66/191/60 65/192/60
f 71/185/61 69/193/61 79/194/61 80/195/61
f 72/196/62 68/182/62 74/197/62 76/198/62
f 76/199/63 74/200/63 73/201/63 75/202/63
f 70/203/64 72/186/64 76/204/64 75/202/64
f 68/205/65 66/178/65 73/201/65 74/206/65
f 66/207/66 70/190/66 75/208/66 73/209/66
f 78/210/67 80/211/67 79/194/67 77/212/67
f 69/189/68 65/213/68 77/214/68 79/215/68
f 67/181/69 71/216/69 80/217/69 78/218/69
f 65/177/70 67/219/70 78/220/70 77/212/70
o Cube.005
v -0.943184 0.837558 -2.455390
v -1.036841 1.439106 -3.049282
v -0.792203 0.083860 -3.242615
v -0.885859 0.685407 -3.836507
v 0.139915 1.029677 -2.431600
v 0.046259 1.631224 -3.025491
v 0.290897 0.275978 -3.218825
v 0.197240 0.877526 -3.812716
v -0.555839 1.663841 -3.864197
v -0.540741 1.588471 -3.942919
v -0.447529 1.683053 -3.861818
v -0.432431 1.607683 -3.940540
v -0.174641 -1.858866 -0.194089
v -0.115495 -2.154119 -0.502475
v 0.249651 -1.783606 -0.184769
v 0.308796 -2.078859 -0.493156
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 0.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vn -0.9844 -0.1746 -0.0216
vn 0.1372 -0.6850 -0.7155
vn 0.9844 0.1746 0.0216
vn -0.1372 0.6850 0.7155
vn 0.9904 0.1079 0.0867
vn 0.0455 -0.1340 -0.9899
vn -0.1101 0.7073 -0.6983
vn 0.7286 0.5591 -0.3956
vn -0.8589 0.2775 -0.4304
vn -0.1758 0.9707 0.1639
vn 0.1101 -0.7073 0.6983
vn -0.1264 0.6160 0.7775
vn 0.1469 -0.7480 -0.6472
vn -0.9698 -0.2398 0.0436
usemtl Material.005
s off
f 81/221/71 82/222/71 84/223/71 83/224/71
f 83/225/72 84/226/72 88/227/72 87/228/72
f 87/229/73 88/230/73 86/231/73 85/232/73
f 85/233/74 86/234/74 82/235/74 81/236/74
f 87/229/75 85/237/75 95/238/75 96/239/75
f 88/240/76 84/226/76 90/241/76 92/242/76
f 92/243/77 90/244/77 89/245/77 91/246/77
f 86/247/78 88/230/78 92/248/78 91/246/78
f 84/249/79 82/222/79 89/245/79 90/250/79
f 82/251/80 86/234/80 91/252/80 89/253/80
f 94/254/81 96/255/81 95/238/81 93/256/81
f 85/233/82 81/257/82 93/258/82 95/259/82
f 83/225/83 87/260/83 96/261/83 94/262/83
f 81/221/84 83/263/84 94/264/84 93/256/84

View File

@ -0,0 +1 @@
threates / evil npc for aliveai

427
aliveai_threats/sec.lua Normal file
View File

@ -0,0 +1,427 @@
minetest.register_craft({
output = "aliveai_threats:secam_off",
recipe = {
{"default:steel_ingot", "dye:black", "default:steel_ingot"},
{"default:glass", "default:steel_ingot", "default:glass"},
{"default:steel_ingot", "dye:black", "default:steel_ingot"},
}
})
minetest.register_craft({
output = "aliveai_threats:landmine 2",
recipe = {
{"","default:coal_lump",""},
{"default:steel_ingot","default:mese_crystal_fragment",""},
{"","default:steel_ingot",""},
}
})
minetest.register_craft({
output = "aliveai_threats:timed_bumb 2",
recipe = {
{"default:steel_ingot","default:coal_lump","default:steel_ingot"},
{"default:steel_ingot","default:mese_crystal_fragment","default:steel_ingot"},
{"","default:coal_lump",""},
}
})
minetest.register_craft({
output = "aliveai_threats:timed_nitrobumb 4",
recipe = {
{"default:steel_ingot","default:coal_lump","default:steel_ingot"},
{"default:steel_ingot","default:mese_crystal_fragment","default:steel_ingot"},
{"default:ice","default:coal_lump","default:ice"},
}
})
minetest.register_node("aliveai_threats:secam_off", {
description = "Security cam",
tiles = {"aliveai_threats_cam2.png"},
drawtype = "nodebox",
walkable=false,
groups = {dig_immediate = 3},
sounds = default.node_sound_glass_defaults(),
is_ground_content = false,
paramtype = "light",
paramtype2 = "facedir",
node_box = {type="fixed",
fixed={ {-0.2, -0.5, -0.2, 0.2, -0.4, 0.2},
{-0.1, -0.2, -0.1, 0.1, -0.4, 0.1}}
},
on_place = minetest.rotate_node,
on_construct = function(pos)
minetest.get_meta(pos):set_string("infotext","click to activate and secure")
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
minetest.set_node(pos, {name ="aliveai_threats:secam", param1 = node.param1, param2 = node.param2})
minetest.get_meta(pos):set_string("team",aliveai.team(player))
minetest.get_node_timer(pos):start(1)
minetest.sound_play("aliveai_threats_on", {pos=pos, gain = 1, max_hear_distance = 15})
end,
})
minetest.register_node("aliveai_threats:secam", {
description = "Security cam",
tiles = {
{
name = "aliveai_threats_cam1.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 3.0,
},
},
},
drawtype = "nodebox",
walkable=false,
groups = {dig_immediate = 3,stone=1,not_in_creative_inventory=1},
sounds = default.node_sound_glass_defaults(),
is_ground_content = false,
paramtype = "light",
paramtype2 = "facedir",
drop="aliveai_threats:secam_off",
node_box = {type="fixed",
fixed={ {-0.2, -0.5, -0.2, 0.2, -0.4, 0.2},
{-0.1, -0.2, -0.1, 0.1, -0.4, 0.1}}
},
on_timer=function(pos, elapsed)
local t=minetest.get_meta(pos):get_string("team")
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 15)) do
local te=aliveai.team(ob)
if te~="" and te~="animal" and te~=t and aliveai.visiable(pos,ob:get_pos()) then
local v=ob:get_pos()
local s={x=(v.x-pos.x)*3,y=(v.y-pos.y)*3,z=(v.z-pos.z)*3}
local m=minetest.add_entity(pos, "aliveai_threats:bullet1")
m:setvelocity(s)
m:setacceleration(s)
minetest.sound_play("aliveai_threats_bullet1", {pos=pos, gain = 1, max_hear_distance = 15})
minetest.after((math.random(1,9)*0.1), function(pos,s)
local m=minetest.add_entity(pos, "aliveai_threats:bullet1")
m:get_luaentity().team=t
m:setvelocity(s)
m:setacceleration(s)
minetest.sound_play("aliveai_threats_bullet1", {pos=pos, gain = 1, max_hear_distance = 15})
end, pos,s)
return true
end
end
return true
end,
})
minetest.register_entity("aliveai_threats:bullet1",{
hp_max = 1,
physical = false,
weight = 5,
visual = "sprite",
visual_size = {x=0.1, y=0.1},
textures = {"default_mese_block.png"},
initial_sprite_basepos = {x=0, y=0},
is_visible = true,
makes_footstep_sound = false,
automatic_rotate = false,
on_step=function(self, dtime)
local pos=self.object:get_pos()
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 2)) do
local t=aliveai.team(ob)
if t~="" and t~="animal" and t~=self.team then
aliveai.punchdmg(ob,3)
self.timer=2
break
end
end
self.timer=self.timer+dtime
local n=minetest.get_node(self.object:get_pos()).name
if self.timer>1 or (n and minetest.registered_nodes[n].walkable) then aliveai.kill(self) end
end,
timer=0,
team="",
})
if aliveai_nitroglycerine then
minetest.register_node("aliveai_threats:landmine_on", {
description = "Landmine",
tiles = {"aliveai_threats_c4_controller.png"},
drawtype = "nodebox",
groups = {attached_node = 1,dig_immediate = 3,stone=1,not_in_creative_inventory=1},
sounds = default.node_sound_glass_defaults(),
is_ground_content = false,
paramtype = "light",
drop="aliveai_threats:landmine",
node_box = {type="fixed",
fixed={{-0.3, -0.7, -0.3, 0.3, -0.6, 0.3}}
},
on_blast=function(pos)
minetest.set_node(pos,{name="air"})
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 2)) do
local en=ob:get_luaentity()
if en and en.aliveai then en.drop_dead_body=0 end
ob:punch(ob,1,{full_punch_interval=1,damage_groups={fleshy=250}})
end
if aliveai_nitroglycerine then
aliveai_nitroglycerine.explode(pos,{
radius=2,
set="air",
})
end
end,
on_timer=function(pos, elapsed)
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 2)) do
local en=ob:get_luaentity()
if en and en.aliveai then en.drop_dead_body=0 end
ob:punch(ob,1,{full_punch_interval=1,damage_groups={fleshy=250}})
aliveai_nitroglycerine.explode(pos,{
radius=2,
set="air",
})
end
return true
end,
})
minetest.register_node("aliveai_threats:landmine", {
description = "Landmine",
tiles = {"aliveai_threats_c4_controller.png"},
drawtype = "nodebox",
groups = {attached_node = 1,dig_immediate = 3,stone=1,not_in_creative_inventory=0},
sounds = default.node_sound_glass_defaults(),
is_ground_content = false,
paramtype = "light",
node_box = {type="fixed",
fixed={{-0.3, -0.5, -0.3, 0.3, -0.4, 0.3}}
},
on_blast=function(pos)
minetest.set_node(pos,{name="air"})
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 2)) do
local en=ob:get_luaentity()
if en and en.aliveai then en.drop_dead_body=0 end
ob:punch(ob,1,{full_punch_interval=1,damage_groups={fleshy=250}})
end
aliveai_nitroglycerine.explode(pos,{
radius=2,
set="air",
})
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
minetest.set_node(pos,{name="aliveai_threats:landmine_on"})
minetest.after(3, function(pos)
minetest.get_node_timer(pos):start(1)
minetest.sound_play("aliveai_threats_on", {pos=pos, gain = 1, max_hear_distance = 7})
end, pos)
end,
})
minetest.register_node("aliveai_threats:timed_bumb", {
description = "Timed bomb",
tiles = {"aliveai_threats_c4_controller.png"},
groups = {dig_immediate = 2,mesecon = 2,flammable = 5},
sounds = default.node_sound_wood_defaults(),
on_blast=function(pos)
minetest.set_node(pos,{name="air"})
minetest.after(0.1, function(pos)
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 5)) do
local en=ob:get_luaentity()
if en and en.aliveai then en.drop_dead_body=0 end
ob:punch(ob,1,{full_punch_interval=1,damage_groups={fleshy=250}})
end
aliveai_nitroglycerine.explode(pos,{radius=5,set="air"})
end,pos)
end,
on_timer=function(pos, elapsed)
minetest.registered_nodes["aliveai_threats:timed_bumb"].on_blast(pos)
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local meta=minetest.get_meta(pos)
if meta:get_int("b")==1 then return end
meta:set_int("b",1)
minetest.get_node_timer(pos):start(5)
minetest.sound_play("aliveai_threats_on", {pos=pos, gain = 1, max_hear_distance = 7})
end,
mesecons = {effector =
{action_on=function(pos)
minetest.registered_nodes["aliveai_threats:timed_bumb"].on_rightclick(pos)
end
}
},
on_burn = function(pos)
minetest.registered_nodes["aliveai_threats:timed_bumb"].on_rightclick(pos)
end,
on_ignite = function(pos, igniter)
minetest.registered_nodes["aliveai_threats:timed_bumb"].on_rightclick(pos)
end,
})
minetest.register_node("aliveai_threats:timed_nitrobumb", {
description = "Timed nitrobomb",
tiles = {"aliveai_threats_c4_controller.png^[colorize:#51ffe255"},
groups = {dig_immediate = 2,mesecon = 2,flammable = 5},
sounds = default.node_sound_wood_defaults(),
on_blast=function(pos)
minetest.set_node(pos,{name="air"})
minetest.after(0.1, function(pos)
aliveai_nitroglycerine.crush(pos)
local radius=5
aliveai_nitroglycerine.explode(pos,{
radius=radius,
hurt=0,
place={"default:snowblock","default:ice","default:snowblock"},
place_chance=2,
})
for _, ob in ipairs(minetest.get_objects_inside_radius(pos, radius*2)) do
local pos2=ob:get_pos()
local d=math.max(1,vector.distance(pos,pos2))
local dmg=(8/d)*radius
local en=ob:get_luaentity()
if ob:is_player() or not (en and en.name=="aliveai_nitroglycerine:ice" or en.aliveai_ice) then
if ob:get_hp()<=dmg+5 then
aliveai_nitroglycerine.freeze(ob)
else
ob:punch(ob,1,{full_punch_interval=1,damage_groups={fleshy=dmg}})
end
end
end
end,pos)
end,
on_timer=function(pos, elapsed)
minetest.registered_nodes["aliveai_threats:timed_nitrobumb"].on_blast(pos)
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local meta=minetest.get_meta(pos)
if meta:get_int("b")==1 then return end
meta:set_int("b",1)
minetest.get_node_timer(pos):start(5)
minetest.sound_play("aliveai_threats_on", {pos=pos, gain = 1, max_hear_distance = 7})
end,
mesecons = {effector =
{action_on=function(pos)
minetest.registered_nodes["aliveai_threats:timed_nitrobumb"].on_rightclick(pos)
end
}
},
on_burn = function(pos)
minetest.registered_nodes["aliveai_threats:timed_nitrobumb"].on_rightclick(pos)
end,
on_ignite = function(pos, igniter)
minetest.registered_nodes["aliveai_threats:timed_nitrobumb"].on_rightclick(pos)
end,
})
end
if aliveai_nitroglycerine then
minetest.register_craft({
output = "aliveai_threats:secam2_off 3",
recipe = {
{"default:diamond","aliveai_threats:secam_off", "default:ice"},
}
})
minetest.register_node("aliveai_threats:secam2_off", {
description = "Nitro security cam",
tiles = {"aliveai_threats_cam2.png^[colorize:#51ffe255"},
drawtype = "nodebox",
walkable=false,
groups = {dig_immediate = 3},
sounds = default.node_sound_glass_defaults(),
is_ground_content = false,
paramtype = "light",
paramtype2 = "facedir",
node_box = {type="fixed",
fixed={ {-0.2, -0.5, -0.2, 0.2, -0.4, 0.2},
{-0.1, -0.2, -0.1, 0.1, -0.4, 0.1}}
},
on_place = minetest.rotate_node,
on_construct = function(pos)
minetest.get_meta(pos):set_string("infotext","click to activate and secure")
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
minetest.set_node(pos, {name ="aliveai_threats:secam2", param1 = node.param1, param2 = node.param2})
minetest.get_meta(pos):set_string("team",aliveai.team(player))
minetest.get_node_timer(pos):start(1)
minetest.sound_play("aliveai_threats_on", {pos=pos, gain = 1, max_hear_distance = 15})
end,
})
minetest.register_node("aliveai_threats:secam2", {
description = "Security cam",
tiles = {
{
name = "aliveai_threats_cam1.png^[colorize:#51ffe255",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 3.0,
},
},
},
drawtype = "nodebox",
walkable=false,
groups = {dig_immediate = 3,stone=1,not_in_creative_inventory=1},
sounds = default.node_sound_glass_defaults(),
is_ground_content = false,
paramtype = "light",
paramtype2 = "facedir",
drop="aliveai_threats:secam2_off",
node_box = {type="fixed",
fixed={ {-0.2, -0.5, -0.2, 0.2, -0.4, 0.2},
{-0.1, -0.2, -0.1, 0.1, -0.4, 0.1}}
},
on_timer=function(pos, elapsed)
local t=minetest.get_meta(pos):get_string("team")
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 15)) do
local te=aliveai.team(ob)
if te~="" and te~="animal" and te~=t and aliveai.visiable(pos,ob:get_pos()) then
local v=ob:get_pos()
local s={x=(v.x-pos.x)*3,y=(v.y-pos.y)*3,z=(v.z-pos.z)*3}
local m=minetest.add_entity(pos, "aliveai_threats:bullet2")
m:get_luaentity().team=t
m:setvelocity(s)
m:setacceleration(s)
minetest.sound_play("aliveai_threats_bullet1", {pos=pos, gain = 1, max_hear_distance = 15})
return true
end
end
return true
end,
})
minetest.register_entity("aliveai_threats:bullet2",{
hp_max = 1,
physical = false,
weight = 5,
visual = "sprite",
visual_size = {x=0.1, y=0.1},
textures = {"default_mese_block.png^[colorize:#51ffe2ff"},
initial_sprite_basepos = {x=0, y=0},
is_visible = true,
makes_footstep_sound = false,
automatic_rotate = false,
on_step=function(self, dtime)
local pos=self.object:get_pos()
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 2)) do
local t=aliveai.team(ob)
if t~="" and t~="animal" and t~=self.team then
if aliveai.gethp(ob)<=5 then
if ob:get_luaentity() then ob:get_luaentity().destroy=1 end
minetest.after(0.1, function(ob)
aliveai_nitroglycerine.freeze(ob)
end,ob)
else
aliveai.punchdmg(ob,5)
end
self.timer=2
break
end
end
self.timer=self.timer+dtime
local n=minetest.get_node(self.object:get_pos()).name
if self.timer>1 or (n and minetest.registered_nodes[n].walkable) then aliveai.kill(self) end
end,
timer=0,
team=""
})
end

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

210
aliveai_threats/tree.lua Normal file
View File

@ -0,0 +1,210 @@
aliveai_threats.spawn_tree=function(self)
if not (self and self.object) then return false end
local pos=aliveai.roundpos(self.object:getpos())
if minetest.get_node(pos).name=="air" then return false end
self.tree_by_nodes={}
local trunk=""
local leaves=""
local tree={}
local hight=1
local g=0
local gm=2
local xx
local zz
for x=-5,5,1 do
for z=-5,5,1 do
for y=0,15,1 do
local p={x=pos.x+x,y=pos.y+y,z=pos.z+z}
local name=minetest.get_node(p).name
local det=0
if minetest.is_protected(p,"") then
return false
elseif aliveai.group(p,"leaves")>0 and (leaves=="" or name==leaves) then
det=1
elseif (aliveai.group(p,"tree")>0 or name=="default:acacia_bush_stem" or name=="default:bush_stem") and (trunk=="" or name==trunk) then
det=2
end
if det>0 then
xx=math.abs(x)
zz=math.abs(z)
if xx>g and xx<=gm then
g=xx
gm=g+1
end
if zz>g and zz<=gm then
g=zz
gm=g+1
end
if xx<gm and zz<gm then
if det==1 then leaves=name end
if det==2 then trunk=name end
table.insert(tree,{x,y,z,name,p})
if y>hight then hight=y end
end
end
end
end
end
if #tree<2 then return false end
self.storge2=hight/2
local c=self.object:get_properties().collisionbox
c[5]=self.storge2
self.object:set_properties({collisionbox=c})
if trunk~="" then
self.object:set_properties({textures={trunk}})
self.storge1=trunk
else
self.storge1="default:tree"
end
for _, d in ipairs(tree) do
if d[1]+d[2]+d[3]~=0 then
local e=minetest.add_entity(pos, "aliveai_threats:trees_block")
e:set_properties({textures={d[4]}})
e:set_attach(self.object, "", {x=d[1]*30,y=d[2]*30,z=d[3]*30}, {x=0,y=0,z=0})
e:get_luaentity().contenta=d[4]
table.insert(self.tree_by_nodes,{ob=e,pos={x=d[1],y=d[2],z=d[3]},it=d[4]})
end
minetest.remove_node(d[5])
end
return true
end
aliveai_threats.load_tree=function(self)
if not (self and self.object) then return false end
local pos=aliveai.roundpos(self.object:getpos())
self.tree_by_nodes={}
local c=self.object:get_properties().collisionbox
c[5]=self.storge2
self.object:set_properties({textures={self.storge1},collisionbox=c})
for _, d in ipairs(self.tree_by_nodes_load) do
local e=minetest.add_entity(pos, "aliveai_threats:trees_block")
e:set_properties({textures={d[4]}})
e:set_attach(self.object, "", {x=d[1]*30,y=d[2]*30,z=d[3]*30}, {x=0,y=0,z=0})
e:get_luaentity().contenta=d[4]
table.insert(self.tree_by_nodes,{ob=e,pos={x=d[1],y=d[2],z=d[3]},it=d[4]})
end
self.tree_by_nodes_load=nil
return true
end
aliveai.savedata.trees=function(self)
if self.tree_by_nodes then
local dat=""
for _, d in ipairs(self.tree_by_nodes) do
if dat~="" then
dat=dat .. "!"
end
dat=dat .. d.pos.x .."#" .. d.pos.y .."#" .. d.pos.z .."#" .. d.it
end
return {tree_by_nodes=dat}
end
end
aliveai.loaddata.trees=function(self,r)
if r.tree_by_nodes and type(r.tree_by_nodes)=="string" then
local dat={}
local a1=r.tree_by_nodes.split(r.tree_by_nodes,"!")
for _, d in ipairs(a1) do
local a2=d.split(d,"#")
local p=aliveai.strpos(a2[1] .."," .. a2[2] .."," .. a2[3],true)
table.insert(dat,{p.x,p.y,p.z,a2[4]})
end
self.tree_by_nodes_load=dat
end
return self
end
aliveai.create_bot({
attack_players=1,
name="trees",
team="tree",
texture="default_tree.png",
talking=0,
light=0,
building=0,
type="monster",
hp=30,
dmg=9,
arm=2,
name_color="",
collisionbox={-0.5,-0.5,-0.5,0.5,3,0.5},
visual="wielditem",
basey=-0.5,
drop_dead_body=0,
escape=0,
spawn_on={"group:tree","default:acacia_bush_stem","default:bush_stem"},
spawn_y=0,
visual_size={x=0.5,y=0.5},
smartfight=0,
check_spawn_space=0,
spawn_chance=500,
spawn=function(self)
if aliveai_threats.spawn_tree(self)==false then
self.object:remove()
return self
end
end,
on_load=function(self)
if not self.tree_by_nodes_load then
self.object:remove()
return self
end
aliveai_threats.load_tree(self)
end,
death=function(self,puncher,pos)
if self.tree_by_nodes then
for _, d in ipairs(self.tree_by_nodes) do
if d and d.ob then
d.ob:set_detach()
d.ob:setacceleration({x=0, y=-10, z=0})
d.ob:setvelocity({x=math.random(-2,2), y=math.random(0,1), z=math.random(-2,2)})
d.ob:set_pos({x=pos.x+d.pos.x,y=pos.y+d.pos.y,z=pos.z+d.pos.z})
d.ob:set_properties({visual_size={x=0.65,y=0.65}})
end
end
end
end,
on_punched=function(self,puncher)
end
})
minetest.register_entity("aliveai_threats:trees_block",{
hp_max = 10,
physical =true,
pointable=true,
visual = "wielditem",
textures ={"air"},
visual_size={x=2,y=2},
on_activate=function(self, staticdata)
minetest.after(0.1, function(self)
if not self.object:get_attach() then
self.object:remove()
end
end,self)
self.endtime=math.random(1,4)
end,
on_step=function(self, dtime)
self.time=self.time+dtime
if self.time<2 then return self end
self.time=0
if not self.object:get_attach() then
self.time2=self.time2+1
if self.time2>self.endtime then
if math.random(1,2)==1 then
minetest.add_item(self.object:get_pos(),self.contenta):get_luaentity().age=890
end
self.object:remove()
end
end
end,
endtime=1,
time=0,
time2=0,
})