Skip to content

Commit

Permalink
Added logs for admin teleports
Browse files Browse the repository at this point in the history
  • Loading branch information
outdead committed Jun 9, 2022
1 parent 713aa4d commit 7c4b194
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ All notable changes to this project will be documented in this file.

## [Unreleased]
### Added
- Added logs for admin additem actions from ISItemsListTable panel.
- Added logs for remove and get items actions from ISPlayerStatsManageInvUI panel.
- Added logs for admin add item actions from ISItemsListTable panel.
- Added logs for admin remove item and get item actions from ISPlayerStatsManageInvUI panel.
- Added logs for admin teleports.

### Removed
- Removed v41.65 supporting.
Expand Down
42 changes: 42 additions & 0 deletions src/lua/client/LogExtenderClient.lua
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,44 @@ LogExtenderClient.OnChangeItemsFromManageInventory = function()
end
end

-- OnTeleport adds logs for teleport actions.
LogExtenderClient.OnTeleport = function()
local originalOnTeleportValid = DebugContextMenu.onTeleportValid;
local originalISSafehousesListOnClick = ISSafehousesList.onClick;
local originalISMiniMapInnerOnTeleport = ISMiniMapInner.onTeleport;
local originalISWorldMapOnTeleport = ISWorldMap.onTeleport;

DebugContextMenu.onTeleportValid = function(button, x, y, z)
originalOnTeleportValid(button, x, y, z);

local message = getPlayer():getUsername() .. " teleported to " .. x .. "," .. y .. "," .. z
LogExtenderClient.writeLog(LogExtenderClient.filemask.admin, message);
end

ISSafehousesList.onClick = function(self, button)
originalISSafehousesListOnClick(self, button);

if button.internal == "TELEPORT" then
local message = getPlayer():getUsername() .. " teleported to " .. self.selectedSafehouse:getX() .. "," .. self.selectedSafehouse:getY() .. "," .. 0
LogExtenderClient.writeLog(LogExtenderClient.filemask.admin, message);
end
end

ISMiniMapInner.onTeleport = function(self, worldX, worldY)
originalISMiniMapInnerOnTeleport(self, worldX, worldY)

local message = getPlayer():getUsername() .. " teleported to " .. math.floor(worldX) .. "," .. math.floor(worldY) .. "," .. 0
LogExtenderClient.writeLog(LogExtenderClient.filemask.admin, message);
end

ISWorldMap.onTeleport = function(self, worldX, worldY)
originalISWorldMapOnTeleport(self, worldX, worldY)

local message = getPlayer():getUsername() .. " teleported to " .. math.floor(worldX) .. "," .. math.floor(worldY) .. "," .. 0
LogExtenderClient.writeLog(LogExtenderClient.filemask.admin, message);
end
end

-- OnGameStart adds callback for OnGameStart global event.
LogExtenderClient.OnGameStart = function()
LogExtenderClient.player = getPlayer();
Expand Down Expand Up @@ -746,6 +784,10 @@ LogExtenderClient.OnGameStart = function()
LogExtenderClient.OnAddItemsFromTable()
LogExtenderClient.OnChangeItemsFromManageInventory()
end

if SandboxVars.LogExtender.AdminTeleport then
LogExtenderClient.OnTeleport()
end
end

if SandboxVars.LogExtender.PlayerConnected then
Expand Down
1 change: 1 addition & 0 deletions src/lua/shared/Translate/EN/Sandbox_EN.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ Sandbox_EN = {
Sandbox_RemovePlayerFromSafehouse = "RemovePlayerFromSafehouse",
Sandbox_JoinToSafehouse = "JoinToSafehouse",
Sandbox_AdminManageItem = "AdminManageItem",
Sandbox_AdminTeleport = "AdminTeleport",
}
1 change: 1 addition & 0 deletions src/lua/shared/Translate/RU/Sandbox_RU.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ Sandbox_RU = {
Sandbox_RemovePlayerFromSafehouse = "RemovePlayerFromSafehouse",
Sandbox_JoinToSafehouse = "JoinToSafehouse",
Sandbox_AdminManageItem = "AdminManageItem",
Sandbox_AdminTeleport = "AdminTeleport",
}
9 changes: 9 additions & 0 deletions src/sandbox-options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,12 @@ option LogExtender.AdminManageItem
page = LogExtender,
translation = LogExtender_AdminManageItem
}

option LogExtender.AdminTeleport
{
type = boolean,
default = true,

page = LogExtender,
translation = LogExtender_AdminTeleport
}

0 comments on commit 7c4b194

Please sign in to comment.