Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions ScriptExtender/LuaScripts/BuiltinLibraryClient.lua
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,27 @@ Ext.Events.SkillGetPropertyDescription:Subscribe(function (e)
end)

-- Debug helper to get current player character
_C = function ()
local statusConsole = Ext.UI.GetByType(117)
if statusConsole == nil then return end
local handle = statusConsole:GetPlayerHandle()
if handle == nil then return end
return Ext.Entity.GetCharacter(handle)
_C = function (playerIndex)
playerIndex = playerIndex or 1
local playerManager = Ext.Entity.GetPlayerManager()
local player = playerManager.ClientPlayerData[playerIndex]
local charNetID = player and player.CharacterNetId

return Ext.Entity.GetCharacter(charNetID)
end

-- Debug helper to get the current player character's weapon
_W = function ()
local char = _C()
local item

if char then
local itemGUID = char:GetItemBySlot("Weapon")

item = itemGUID and Ext.Entity.GetItem(itemGUID)
end

return item
end

-- Debug helper to get character being examined
Expand Down
27 changes: 27 additions & 0 deletions ScriptExtender/LuaScripts/Libs/HelpersGenerator/CustomEntries.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,33 @@ return {
Specific = {SubscribableEventType = SubscribableEventType},
Misc = {
[[
--#region Debug/dev functions

--- @deprecated For debugging usage only - do not use in mod releases.
--- Returns the active controlled character.
--- @param playerIndex integer? Defaults to 1.
--- @return EclCharacter|EsvCharacter
function _C(playerIndex) end

--- @deprecated For debugging usage only - do not use in mod releases.
--- Returns the character being examined in the examine UI.
--- Client-only.
--- @return EclCharacter
function _E() end

--- @deprecated For debugging usage only - do not use in mod releases.
--- Returns the item equipped in the Weapon slot of the active controlled character.
--- In the client context, this uses player 1's character.
--- @return EclItem|EsvItem
function _W() end

-- Aliases for logging functions.
_D = Ext.Dump
_DS = Ext.DumpShallow
_P = Ext.Utils.Print

--#endregion

--#region Deprecated Functions (moved to Ext modules)

--- @deprecated
Expand Down