diff options
Diffstat (limited to 'builtin/client/cheats')
-rw-r--r-- | builtin/client/cheats/combat.lua | 47 | ||||
-rw-r--r-- | builtin/client/cheats/init.lua | 2 |
2 files changed, 49 insertions, 0 deletions
diff --git a/builtin/client/cheats/combat.lua b/builtin/client/cheats/combat.lua new file mode 100644 index 000000000..25aaaec34 --- /dev/null +++ b/builtin/client/cheats/combat.lua @@ -0,0 +1,47 @@ +local placed_crystal +local switched_to_totem = 0 +local used_sneak = true + +core.register_globalstep(function(dtime) + if not minetest.settings:get_bool("crystal_pvp") then return end + local player = core.localplayer + if not player then return end + local control = player:get_control() + local pointed = core.get_pointed_thing() + local item = player:get_wielded_item():get_name() + if placed_crystal then + if core.switch_to_item("mobs_mc:totem") then + switched_to_totem = 5 + end + placed_crystal = false + elseif switched_to_totem > 0 then + if item ~= "mobs_mc:totem" then + switched_to_totem = 0 + elseif pointed and pointed.type == "object" then + pointed.ref:punch() + switched_to_totem = 0 + else + switched_to_totem = switched_to_totem + end + elseif control.RMB and item == "mcl_end:crystal" then + placed_crystal = true + elseif control.sneak then + if used_sneak then + core.switch_to_item("mobs_mc:totem") + return + end + core.switch_to_item("mcl_end:crystal") + if pointed and pointed.type == "node" then + local pos = core.get_pointed_thing_position(pointed) + local node = core.get_node_or_nil(pos) + if node and (node.name == "mcl_core:obsidian" or node.name == "mcl_core:bedrock") then + core.place_node(pos) + placed_crystal = true + end + end + used_sneak = true + else + used_sneak = false + end +end) + diff --git a/builtin/client/cheats/init.lua b/builtin/client/cheats/init.lua index 9eb2594a0..cdeae78c8 100644 --- a/builtin/client/cheats/init.lua +++ b/builtin/client/cheats/init.lua @@ -4,6 +4,7 @@ core.cheats = { ["AntiKnockback"] = "antiknockback", ["FastHit"] = "spamclick", ["AttachmentFloat"] = "float_above_parent", + ["CrystalPvP"] = "crystal_pvp", }, ["Movement"] = { ["Freecam"] = "freecam", @@ -70,6 +71,7 @@ end local cheatpath = core.get_builtin_path() .. "client" .. DIR_DELIM .. "cheats" .. DIR_DELIM dofile(cheatpath .. "chat.lua") +dofile(cheatpath .. "combat.lua") dofile(cheatpath .. "inventory.lua") dofile(cheatpath .. "movement.lua") dofile(cheatpath .. "player.lua") |