local totem_move_action = InventoryAction("move")
totem_move_action:to("current_player", "main", 9)
+core.register_list_command("friend", "Configure Friend List (friends dont get attacked by Killaura or Forcefield)", "friendlist")
+
core.register_globalstep(function(dtime)
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 core.settings:get_bool("crystal_pvp") then
+ if core.settings:get_bool("killaura") or core.settings:get_bool("forcefield") and control.LMB then
+ local friendlist = core.settings:get("friendlist"):split(",")
+ for _, obj in ipairs(core.get_objects_inside_radius(player:get_pos(), 5)) do
+ local do_attack = true
+ if obj:is_local_player() then
+ do_attack = false
+ else
+ for _, friend in ipairs(friendlist) do
+ if obj:get_name() == friend or obj:get_nametag() == friend then
+ do_attack = false
+ break
+ end
+ end
+ end
+ if do_attack then
+ obj:punch()
+ end
+ end
+ elseif core.settings:get_bool("crystal_pvp") then
if placed_crystal then
if core.switch_to_item("mobs_mc:totem") then
switched_to_totem = 5
core.cheats = {
["Combat"] = {
["Killaura"] = "killaura",
+ ["Forcefield"] = "forcefield",
["AntiKnockback"] = "antiknockback",
["FastHit"] = "spamclick",
["AttachmentFloat"] = "float_above_parent",
use_chat_color (ColoredChat) bool false
chat_reverse (ReversedChat) bool false
+
+forcefield (Forcefield) bool false
+
+friendlist (Killaura / Forcefield Friendlist) string
* change a value of a previously added HUD element
* element `stat` values: `position`, `name`, `scale`, `text`, `number`, `item`, `dir`
* Returns `true` on success, otherwise returns `nil`
+* `get_object()`
+ * Returns the ClientObjectRef for the player
### Settings
An interface to read config files in the format of `minetest.conf`.
* `get_acceleration()`: returns the acceleration, a vector
* `get_rotation()`: returns the rotation, a vector (radians)
* `is_player()`: returns true if the object is a player
+* `is_local_player()`: returns true if the object is the local player
* `get_attach()`: returns parent or nil if it isn't attached.
* `get_nametag()`: returns the nametag (string)
* `get_item_textures()`: returns the textures
ClientMap &map = env.getClientMap();
const NodeDefManager *nodedef = map.getNodeDefManager();
- if (g_settings->getBool("killaura"))
- handleKillaura(shootline.start, shootline.getLength());
-
runData.selected_object = NULL;
hud->pointing_at_object = false;
RaycastState s(shootline, look_for_object, liquids_pointable, ! g_settings->getBool("dont_point_nodes"));
return result;
}
-void Game::handleKillaura(v3f origin, f32 max_d)
-{
- ClientEnvironment &env = client->getEnv();
- std::vector<DistanceSortedActiveObject> allObjects;
- env.getActiveObjects(origin, max_d, allObjects);
- for (const auto &allObject : allObjects) {
- ClientActiveObject *obj = allObject.obj;
- s16 id = obj->getId();
- aabb3f selection_box;
- if (! obj->getSelectionBox(&selection_box))
- continue;
- PointedThing pointed(id, v3f(0,0,0), v3s16(0,0,0), 0);
- client->interact(INTERACT_START_DIGGING, pointed);
- }
-}
-
void Game::handlePointingAtNothing(const ItemStack &playerItem)
{
infostream << "Right Clicked in Air" << std::endl;
PointedThing updatePointedThing(
const core::line3d<f32> &shootline, bool liquids_pointable,
bool look_for_object, const v3s16 &camera_offset);
- void handleKillaura(v3f origin, f32 max_d);
void handlePointingAtNothing(const ItemStack &playerItem);
void handlePointingAtNode(const PointedThing &pointed,
const ItemStack &selected_item, const ItemStack &hand_item, f32 dtime);
settings->setDefault("chat_color", "rainbow");
settings->setDefault("use_chat_color", "false");
settings->setDefault("chat_reverse", "false");
+ settings->setDefault("forcefield", "false");
+ settings->setDefault("friendlist", "");
// Keymap
settings->setDefault("remote_port", "30000");
return 1;
}
+int ClientObjectRef::l_is_local_player(lua_State *L)
+{
+ ClientObjectRef *ref = checkobject(L, 1);
+ GenericCAO *gcao = get_generic_cao(ref, L);
+ lua_pushboolean(L, gcao->isLocalPlayer());
+ return 1;
+}
+
int ClientObjectRef::l_get_name(lua_State *L)
{
ClientObjectRef *ref = checkobject(L, 1);
luamethod(ClientObjectRef, get_acceleration),
luamethod(ClientObjectRef, get_rotation),
luamethod(ClientObjectRef, is_player),
+ luamethod(ClientObjectRef, is_local_player),
luamethod(ClientObjectRef, get_name),
luamethod(ClientObjectRef, get_attach),
luamethod(ClientObjectRef, get_nametag),
// is_player(self)
static int l_is_player(lua_State *L);
+
+ // is_local_player(self)
+ static int l_is_local_player(lua_State *L);
// get_name(self)
static int l_get_name(lua_State *L);