- Double flying pigs sight radius
- Add hurt_inside group
- Add lava and fire to hurt_inside group
+- Make mobs get damaged in fire and lava
---
## REDSTONE:
- breaker (mines whatever is in front of it)
- dispenser (shoots out first item in inventory, or shoots item into pipe)
-- sticky piston (pulls node in front of it)
- piston in general (if node is falling and piston is pointing up then FLING IT, if detects falling node entity FLING IT)
exploder.speed = 5
exploder.jump_timer = 0
+exploder.hurt_inside_timer = 0
exploder.death_animation_timer = 0
exploder.dead = false
local hp = hp-hurt
- if (self.punched_timer <= 0 and hp > 1) or puncher == self.object then
+ if (self.punched_timer <= 0 and hp > 1) then
self.hostile = true
self.hostile_timer = 20
self.punched_timer = 0.8
self.speed = math.random(0,6)
--self.object:set_yaw(yaw)
end
+
+ self.hurt_inside(self,dtime)
local currentvel = self.object:getvelocity()
local goal = vector.multiply(self.direction,self.speed)
self.object:add_velocity(acceleration)
end
+
+local get_group = minetest.get_node_group
+local get_node = minetest.get_node
+exploder.hurt_inside = function(self,dtime)
+ if self.hp > 0 and self.hurt_inside_timer <= 0 then
+ local pos = self.object:getpos()
+ local hurty = get_group(get_node(pos).name, "hurt_inside")
+ if hurty > 0 then
+ self.object:punch(self.object, 2,
+ {
+ full_punch_interval=1.5,
+ damage_groups = {damage=hurty},
+ })
+ end
+ else
+ self.hurt_inside_timer = self.hurt_inside_timer - dtime
+ end
+end
+
--use raycasting to jump
exploder.jump = function(self)
if self.jump_timer <= 0 then
local hp = hp-hurt
- if (self.punched_timer <= 0 and hp > 1) or puncher == self.object then
+ if (self.punched_timer <= 0 and hp > 1) then
self.hostile = true
self.hostile_timer = 20
self.punched_timer = 0.8
--self.object:set_yaw(yaw)
end
+ self.hurt_inside(self,dtime)
+
local currentvel = self.object:getvelocity()
local goal = vector.multiply(self.direction,self.speed)
local acceleration = vector.new(goal.x-currentvel.x,0,goal.z-currentvel.z)
self.object:add_velocity(acceleration)
end
+
+local get_group = minetest.get_node_group
+local get_node = minetest.get_node
+pig.hurt_inside = function(self,dtime)
+ if self.hp > 0 and self.hurt_inside_timer <= 0 then
+ local pos = self.object:getpos()
+ local hurty = get_group(get_node(pos).name, "hurt_inside")
+ if hurty > 0 then
+ self.object:punch(self.object, 2,
+ {
+ full_punch_interval=1.5,
+ damage_groups = {damage=hurty},
+ })
+ end
+ else
+ self.hurt_inside_timer = self.hurt_inside_timer - dtime
+ end
+end
+
--use raycasting to jump
pig.jump = function(self)
if self.jump_timer <= 0 then
pig.speed = 5
pig.jump_timer = 0
+pig.hurt_inside_timer = 0
pig.death_animation_timer = 0
pig.dead = false
local hp = hp-hurt
- if (self.punched_timer <= 0 and hp > 1) or puncher == self.object then
+ if (self.punched_timer <= 0 and hp > 1) then
self.hostile = true
self.hostile_timer = 20
self.punched_timer = 0.8
self.speed = math.random(0,6)
--self.object:set_yaw(yaw)
end
-
+
+ self.hurt_inside(self,dtime)
local currentvel = self.object:getvelocity()
if currentvel.y ~= 0 then
end
end
+
+local get_group = minetest.get_node_group
+local get_node = minetest.get_node
+slime.hurt_inside = function(self,dtime)
+ if self.hp > 0 and self.hurt_inside_timer <= 0 then
+ local pos = self.object:getpos()
+ local hurty = get_group(get_node(pos).name, "hurt_inside")
+ if hurty > 0 then
+ self.object:punch(self.object, 2,
+ {
+ full_punch_interval=1.5,
+ damage_groups = {damage=hurty},
+ })
+ end
+ else
+ self.hurt_inside_timer = self.hurt_inside_timer - dtime
+ end
+end
+
--use raycasting to jump
slime.jump = function(self)
local vel = self.object:get_velocity()
slime.speed = 5
slime.jump_timer = 0
+slime.hurt_inside_timer = 0
slime.death_animation_timer = 0
slime.dead = false