diff options
author | Perttu Ahola <celeron55@gmail.com> | 2012-03-10 01:38:48 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-03-10 11:28:14 +0200 |
commit | f9da2c9507f10a9193c9bd94d69cc85e53b58ba2 (patch) | |
tree | 00885e82f4ab7ff193d481637bbfdeb80c41d0a6 /data/mods/experimental | |
parent | 989aba1966373885d4cac306daea25e102f8d68d (diff) | |
download | minetest-f9da2c9507f10a9193c9bd94d69cc85e53b58ba2.tar.gz minetest-f9da2c9507f10a9193c9bd94d69cc85e53b58ba2.tar.bz2 minetest-f9da2c9507f10a9193c9bd94d69cc85e53b58ba2.zip |
Immediate smoke puff when a normal entity is punched to death
Diffstat (limited to 'data/mods/experimental')
-rw-r--r-- | data/mods/experimental/init.lua | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/data/mods/experimental/init.lua b/data/mods/experimental/init.lua index 76b787031..1ee3fdc2e 100644 --- a/data/mods/experimental/init.lua +++ b/data/mods/experimental/init.lua @@ -378,10 +378,9 @@ minetest.register_alias("TNT", "experimental:tnt") -- The dummyball! -- -minetest.register_alias("dummyball", "experimental:dummyball") - minetest.register_entity("experimental:dummyball", { -- Static definition + hp_max = 20, physical = false, collisionbox = {-0.4,-0.4,-0.4, 0.4,0.4,0.4}, visual = "sprite", @@ -419,6 +418,32 @@ minetest.register_entity("experimental:dummyball", { end, }) +minetest.register_on_chat_message(function(name, message) + local cmd = "/dummyball" + if message:sub(0, #cmd) == cmd then + if not minetest.get_player_privs(name)["give"] then + minetest.chat_send_player(name, "you don't have permission to spawn (give)") + return true -- Handled chat message + end + if not minetest.get_player_privs(name)["interact"] then + minetest.chat_send_player(name, "you don't have permission to interact") + return true -- Handled chat message + end + local player = minetest.env:get_player_by_name(name) + if player == nil then + print("Unable to spawn entity, player is nil") + return true -- Handled chat message + end + local entityname = "experimental:dummyball" + local p = player:getpos() + p.y = p.y + 1 + minetest.env:add_entity(p, entityname) + minetest.chat_send_player(name, '"'..entityname + ..'" spawned.'); + return true -- Handled chat message + end +end) + -- -- A test entity for testing animated and yaw-modulated sprites -- |