]> git.lizzy.rs Git - Crafter.git/commitdiff
testing
authoroilboi <47129783+oilboi@users.noreply.github.com>
Tue, 18 Feb 2020 04:46:10 +0000 (23:46 -0500)
committeroilboi <47129783+oilboi@users.noreply.github.com>
Tue, 18 Feb 2020 04:46:10 +0000 (23:46 -0500)
mods/mob/init.lua
todo.txt

index 037a12e5f93a3fed01dcf9d8f77b2a223caeb7fe..7e3b48d4576e6beeeb8376e71f8967b8bc318e1e 100644 (file)
@@ -1,17 +1,66 @@
 --this is where mobs are defined
+local timer = 0
 minetest.register_globalstep(function(dtime)
-       --collection
-       for _,player in ipairs(minetest.get_connected_players()) do
-               --don't magnetize to dead players
-               if player:get_hp() > 0 then
-                       local pos = player:getpos()
-                       --radial detection
-                       for _,object in ipairs(minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 3)) do
-                               --[[
-                               get chunk player is in by dividing floored position by 16
+       timer = timer + dtime
+       if timer >= 0.5 then
+               timer = 0
+               --check through players
+               for _,player in ipairs(minetest.get_connected_players()) do
+                       --don't spawn near dead players
+                       if player:get_hp() > 0 then
+                       
+                               local mob_number = math.random(0,2)
+                       
+                               local pos = vector.floor(vector.add(player:getpos(),0.5))
                                
-                               ]]--
+                               local checkpos = minetest.find_nodes_in_area_under_air(vector.new(pos.x-50,pos.y-50,pos.z-50), vector.new(pos.x+50,pos.y+50,pos.z+50), {"main:grass","main:sand"})
+                               
+                               
+                               --[[
+                               local block = vector.floor(vector.divide(pos,16))
+                               block = vector.multiply(block, 16) --get the chunk actual base
+                               for x = 0,15 do
+                               for y = 0,15 do
+                               for z = 0,15 do
+                                       
+                                       if minetest.get_node(vector.new(block.x+x,block.y+y-1,block.z+z)).name ~= "air" and minetest.get_node(vector.new(block.x+x,block.y+y,block.z+z)).name == "air" then
+                                       
+                                               minetest.add_particle({
+                                                       pos = vector.new(block.x+x,block.y+y,block.z+z),
+                                                       velocity = {x=0, y=0, z=0},
+                                                       acceleration = {x=0, y=0, z=0},
+                                                       -- Spawn particle at pos with velocity and acceleration
+
+                                                       expirationtime = 0.5,
+                                                       -- Disappears after expirationtime seconds
+
+                                                       size = 2,
+                                                       -- Scales the visual size of the particle texture.
 
+                                                       collisiondetection = false,
+                                                       -- If true collides with `walkable` nodes and, depending on the
+                                                       -- `object_collision` field, objects too.
+
+                                                       collision_removal = false,
+                                                       -- If true particle is removed when it collides.
+                                                       -- Requires collisiondetection = true to have any effect.
+
+                                                       object_collision = false,
+                                                       -- If true particle collides with objects that are defined as
+                                                       -- `physical = true,` and `collide_with_objects = true,`.
+                                                       -- Requires collisiondetection = true to have any effect.
+
+                                                       vertical = false,
+                                                       -- If true faces player using y axis only
+
+                                                       texture = "dirt.png",
+
+                                               })
+                                       end
+                               end
+                               end
+                               end
+                               ]]--
                        end
                end
        end
index 20b460947a32a1ce5b3a85e683c45b41b4a662bd..f24f9b145ef3b5f10f7b71c7f4e17fe8c40627e5 100644 (file)
--- a/todo.txt
+++ b/todo.txt
@@ -18,6 +18,7 @@
 --tnt throw player - and items
 --water flow faster
 --torches with particle
+ladders - only placeable on walls
 make a mob
 crafting bench
 fishing