Add entity damage and player knockback

Could not find a way to add knockback to entities.  After adding a
velocity to them they will just slide around indefinitely.  Because of
this, knockback is only enabled on players for now.
This commit is contained in:
Elias Åström 2020-04-16 23:05:50 +02:00
parent 77c95fe8c3
commit ca7c8c23c7
2 changed files with 123 additions and 10 deletions

View file

@ -103,6 +103,11 @@ minetest.register_node("mcl_tnt:tnt", {
_doc_items_usagehelp = S("Place the TNT and ignite it with one of the methods above. Quickly get in safe distance. The TNT will start to be affected by gravity and explodes in 4 seconds."),
groups = { dig_immediate = 3, tnt = 1, enderman_takable=1 },
mesecons = tnt_mesecons,
on_blast = function(pos)
minetest.chat_send_all("on_blast " .. minetest.pos_to_string(pos))
spawn_tnt(pos, "mcl_tnt:tnt")
return true
end,
_on_ignite = function(player, pointed_thing)
tnt.ignite(pointed_thing.under)
return true