- code cleanup
This commit is contained in:
Leslie Krause 2020-05-14 21:27:24 -04:00
parent 67576287ef
commit 4fde68cebd
1 changed files with 2 additions and 6 deletions

View File

@ -191,9 +191,9 @@ function AxonObject( self, armor_groups )
end end
self.on_step = function ( self, dtime, pos, ... ) self.on_step = function ( self, dtime, pos, ... )
S1() --S1()
propagator.on_step( dtime, pos ) propagator.on_step( dtime, pos )
S1_() --S1_()
old_on_step( self, dtime, pos, ... ) old_on_step( self, dtime, pos, ... )
end end
@ -228,20 +228,16 @@ S1_()
end end
self.on_punch = function ( self, puncher, time_from_last_punch, tool_capabilities, direction, damage ) self.on_punch = function ( self, puncher, time_from_last_punch, tool_capabilities, direction, damage )
print( "self:onpunch():", self.object, self.name )
if puncher == self.object then if puncher == self.object then
-- filter and relay the incoming stimulus -- filter and relay the incoming stimulus
for k, v in pairs( tool_capabilities.damage_groups ) do for k, v in pairs( tool_capabilities.damage_groups ) do
local receptron = self.receptrons[ k ] local receptron = self.receptrons[ k ]
if receptron and check_limits( v, receptron.min_intensity or 1, receptron.max_intensity or 65536 ) then if receptron and check_limits( v, receptron.min_intensity or 1, receptron.max_intensity or 65536 ) then
print( "-> on_reaction(self)" )
-- if receptron returns false, then stimulus was handled -- if receptron returns false, then stimulus was handled
print( "DIR", minetest.pos_to_string( direction ) )
if not receptron.on_reaction( self, v, direction ) then return true end if not receptron.on_reaction( self, v, direction ) then return true end
end end
end end
end end
print( "-> old_on_punch(self)" )
-- if stimulus wasn't handled by a receptron, fallback to on_punch method -- if stimulus wasn't handled by a receptron, fallback to on_punch method
return old_on_punch( self, puncher, time_from_last_punch, tool_capabilities, direction, damage ) return old_on_punch( self, puncher, time_from_last_punch, tool_capabilities, direction, damage )