Only issue is that you can't scroll through the quickhacks to get to the one you want.
The mod mentioned in another comment, Interactive Cybercity, which is supposed to function similar to this one, currently does not work with the most recent version of the game, as of writing this.
The comment made by Cartterr is a messy solution to this issue though. Instead of scrolling normally, it just "steps" the quickhacks until you can get the one you want. Cycling through it, per se.
See a more compatible and working version for 2.2 here: Hackable and Grabbable Civilians. That version also doesn't require Redmod and no double quickhacks issue.
Is there any other better mod that can hack everyone like this but still can scroll down through the quickhack list? I am frustrated with this mod that i can't simply ping the dead enemy because i just can't scroll down the hack list -_-
Although the fact that it needs REDmod might be disappointing/irritating to some (including myself), Immersive Cyberpunk City 2.02 fulfills the role of this (able to hack civilians and police) and even Grapple Civilians (does exactly what the title indicates).
Immersive Cyberpunk City 2.02: https://www.nexusmods.com/cyberpunk2077/mods/7976
Thank you for posting this. I hadn't found what I wanted until you said that. Solution to the issue of a defunct mod if not to repair would be replace. Cheers.
Just follow the instructions in the comment by "Dragoon23" copied and pasted below
------------------------------------------------------------------ COMMENT: 1. Download and install CET and this mod. 2. Open the init.lua of the mod in notepad 3. Go to kinasch's post for the link to tesnitrojack's post in the forum. Do NOT get the code from here in the comments section. Get it from the forum post. 4. Copy/paste that into init.lua and replace all the original code. 5. Save. ------------------------------------------------------------------
I followed "Dragoon23" instructions and it is 100% working on the 2.1 update, i have yet to experience any bugs or crashing. Smooth sailing so far. enjoy the mod chooms
Sadly I couldn't resolve the scrolling issue. However, I implemented a quick and awful solution where the quickhack menu rotates when someone scrolls. It's not ideal, but it might help someone to explore further modifications to the init.lua file to prevent this issue in the future.
When an "active" quickhack (which is NOT Red because of inssuficient ram) is selected, the menu restarts. I don't have the time to debug it but maybe someone can take a crack at it. the logic itself is not hard to understand and I bet that it has to do with "puppetAction" and the abstract class ScriptableDeviceAction in "tools\redmod\scripts\cyberpunk\devices\core\baseDeviceActions.script". I'm gonna keep the debug prints just in case:
Just replace init.lua with this: ------------------------------------------------------------------- local IProps = { enableDebug = true, deltaTime = 0, commandOffset = 0, drawWindow = false, isUploadingQHCOmmands = false, modName = 'Hack Everyone', modVersion = '1.5.0', qhNameList = { { hash = 3116789880, name = "Ping" }, { hash = 612394680, name = "Reboot Optics" }, { hash = 523263573, name = "Contagion" }, { hash = 190881063, name = "Sonic Shock" }, { hash = 2537897906, name = "Suicide" }, { hash = 988968086, name = "Cyberpsychosis" }, { hash = 4273202386, name = "Weapon Glitch" }, { hash = 2534130900, name = "Detonate Grenade" }, { hash = 2795108209, name = "Short Circuit" }, { hash = 880772118, name = "Synapse Burnout" }, { hash = 520988073, name = "System Reset" }, { hash = 249499564, name = "Memory Wipe" }, { hash = 3396834708, name = "Cripple Movement" }, { hash = 3189733290, name = "Whistle" }, { hash = 2582207146, name = "Overheat" }, { hash = 1086744564, name = "Cyberware Malfunction" }, { hash = 3341984842, name = "Request Backup" }, } }
local Config = { disableOnCivilians = false, } local json = require('json') local Utils = require('utilities')
function RefreshHUD(npc, player) -- npc:RegisterToHUDManager(true)
local function areCommandsDifferent(newCommands, oldCommands) Utils.Log(IProps.enableDebug, IProps.modName, "Checking if commands are different...") -- Check if the number of commands differs if #newCommands ~= #oldCommands then Utils.Log(IProps.enableDebug, IProps.modName, "Command counts differ: " .. #newCommands .. " vs " .. #oldCommands) return true end -- Check each command for differences for i, command in ipairs(newCommands) do if command.title ~= oldCommands[i].title or command.description ~= oldCommands[i].description then --Utils.Log(IProps.enableDebug, IProps.modName, "Difference detected in command " .. i .. ": Title or Description changed") --Utils.Log(IProps.enableDebug, IProps.modName, "New Command - Title: " .. command.title .. ", Description: " .. command.description) --Utils.Log(IProps.enableDebug, IProps.modName, "Old Command - Title: " .. oldCommands[i].title .. ", Description: " .. oldCommands[i].description) return true end end -- No differences found Utils.Log(IProps.enableDebug, IProps.modName, "No differences found in commands") return false end
function RevealQuickHacks(npc, player) if IProps.isUploadingQHCOmmands then return end
IProps.isUploadingQHCOmmands = true
local playerQHacksList = gameRPGManager.GetPlayerQuickHackListWithQuality(player)
local commands = {} local addedHashes = {} -- Set to track which hashes have been added to commands local tempCommands = {} -- Temporary storage for commands before applying the offset
local context = npc:GetPS():GenerateContext("Remote", NewObject("handle:gamedeviceClearance"), Game.GetPlayerSystem():GetLocalPlayerControlledGameObject(), npc:GetEntityID()) local i = 0
for _, actionData in pairs(playerQHacksList) do
local action = npc:GetPS():GetAction(actionData.actionRecord) actionRecord = actionData.actionRecord
if actionRecord:ObjectActionType():Type().value == "PuppetQuickHack" then --We just print lines to differentiate the different QuickHacks we are finding, like we just print -------------------------------------- Utils.Log(IProps.enableDebug, IProps.modName, "---------------------------------------------------") --Utils.Log(IProps.enableDebug, IProps.modName, "QuickHack Found: " .. actionRecord:ObjectActionUI():Caption())
local newCommand = NewObject("handle:QuickhackData") newCommand.actionOwnerName = npc:GetTweakDBFullDisplayName(true)
-- QuickHack Names -- Handle Custom Titles newCommand.title = "QuickHack "..i newCommand.description = "QuickHack "..i for _, QHData in pairs(IProps.qhNameList) do if QHData.hash == newCommand.icon.hash then
--Utils.Log(IProps.enableDebug, IProps.modName, "QuickHack match hash: " .. QHData.name) newCommand.title = QHData.name newCommand.description = QHData.name --print("QuickHack match hash ", QHData.name, newCommand.icon.hash) --else --Utils.Log(IProps.enableDebug, IProps.modName, "QuickHack hash not found: " .. newCommand.icon.hash) end --print("QuickHack hash ", newCommand.title, newCommand.icon.hash) end
-- Work Cooldowns actionStartEffects = actionRecord:StartEffects() for _, effect in pairs(actionStartEffects) do if effect:StatusEffect() and effect:StatusEffect():StatusEffectType():Type().value == "PlayerCooldown" then --Utils.Log(IProps.enableDebug, IProps.modName, "Cooldown Found: " .. effect:StatusEffect():GetID()) Utils.Log(IProps.enableDebug, IProps.modName, "Cooldown Found") statModifiers = effect:StatusEffect():Duration():StatModifiers() newCommand.cooldown = 0.0 newCommand.cooldownTweak = effect:StatusEffect():GetID() end end
local puppetAction = npc:GetPS():GetAction(actionData.actionRecord) puppetAction:SetExecutor(context.processInitiatorObject) puppetAction:RegisterAsRequester(npc:GetPS():GetMyEntityID()) puppetAction:SetObjectActionID(actionData.actionRecord:GetID()) puppetAction:SetUp(npc:GetPS())
puppetAction:SetDurationValue(0.0) -- Reset duration -- Immediately after resetting, set the duration to a non-zero value if the action is considered active but not started if not puppetAction:IsStarted() and not puppetAction:IsCompleted() then puppetAction:SetDurationValue(10.0) -- Prepare the action as active but mark as not started end
if puppetAction:IsInactive() then Utils.Log(IProps.enableDebug, IProps.modName, "QuickHack is inactive: " .. puppetAction.GetInactiveReason()) newCommand.isLocked = true newCommand.inactiveReason = puppetAction.GetInactiveReason() elseif Game.GetStatPoolsSystem():IsStatPoolAdded(npc:GetEntityID(), "QuickHackUpload") then Utils.Log(IProps.enableDebug, IProps.modName, "QuickHack is uploading") newCommand.isLocked = true newCommand.inactiveReason = "LocKey#7020" elseif not puppetAction:CanPayCost() then Utils.Log(IProps.enableDebug, IProps.modName, "QuickHack cannot pay cost") newCommand.isLocked = true newCommand.actionState = "OutOfMemory" newCommand.inactiveReason = "LocKey#27398" else Utils.Log(IProps.enableDebug, IProps.modName, "QuickHack is active") -- we print puppetAction for debugging
if puppetAction then Utils.Log(IProps.enableDebug, IProps.modName, "Puppet Action is valid") else Utils.Log(IProps.enableDebug, IProps.modName, "Puppet Action is nil") end
if actionRecord:GetTargetActivePrereqsCount() > 0 then --Utils.Log(IProps.enableDebug, IProps.modName, "Checking Target Active Prereqs") targetActivePrereqs = actionRecord:TargetActivePrereqs() for _, activePrereqs in pairs(targetActivePrereqs) do
prereqsToCheck = activePrereqs:FailureConditionPrereq() if not gameRPGManager.CheckPrereqs(prereqsToCheck, npc) then --Utils.Log(IProps.enableDebug, IProps.modName, "Prereqs failed: " .. activePrereqs:FailureExplanation()) newCommand.isLocked = true; newCommand.inactiveReason = activePrereqs:FailureExplanation() end end end
-- if newCommand.cooldown and newCommand.cooldown ~= 0 then -- newCommand.isLocked = true; -- newCommand.inactiveReason = "LocKey#10943"; -- newCommand.actionState = "Locked"; -- else -- newCommand.action = puppetAction -- end
-- Only if newCommand.icon.hash is not in the list of hashes we add it:
local hashExists = addedHashes[newCommand.icon.hash] -- Check if hash has already been added local isHashInList = false for _, hash in ipairs(quickHackHashes) do if hash == newCommand.icon.hash then isHashInList = true break end end
-- we add a condition so that if the hash is not in the list we do not add it and if newCommand.inactiveReason is not nil we do not add it either if isHashInList and not hashExists --newCommand.inactiveReason ~= 'nil' and --newCommand.inactiveReason ~= 'LocKey#51710' --newCommand.actionMatchesTarget == true and --newCommand.isLocked == true then -- Only add newCommand if its hash is in the list and not already added Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack: " .. newCommand.title) Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack Hash: " .. newCommand.icon.hash) -- we print all the other possible data of newCommand Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack Description: " .. newCommand.description) --Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack Type: " .. newCommand.type) Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack ICELevel: " .. newCommand.ICELevel) Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack ICELevelVisible: " .. tostring(newCommand.ICELevelVisible)) Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack Quality: " .. newCommand.quality) Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack NetworkBreached: " .. tostring(newCommand.networkBreached)) --Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack Category: " .. newCommand.category) --Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack ActionCompletionEffects: " .. json.encode(newCommand.actionCompletionEffects)) Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack Cooldown: " .. newCommand.cooldown) --Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack CooldownTweak: " .. newCommand.cooldownTweak) Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack Duration: " .. newCommand.duration) Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack UploadTime: " .. newCommand.uploadTime) Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack CostRaw: " .. newCommand.costRaw) Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack Cost: " .. newCommand.cost) Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack ActionMatchesTarget: " .. tostring(newCommand.actionMatchesTarget)) Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack IsLocked: " .. tostring(newCommand.isLocked)) Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack InactiveReason: " .. newCommand.inactiveReason) --Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack ActionState: " .. newCommand.actionState) --Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack Action: " .. newCommand.action)
addedHashes[newCommand.icon.hash] = true -- Mark this hash as added --commands[i] = newCommand tempCommands[#tempCommands + 1] = newCommand i = i + 1 elseif not isHashInList then Utils.Log(IProps.enableDebug, IProps.modName, "Hash not in list: " .. newCommand.icon.hash) elseif hashExists then Utils.Log(IProps.enableDebug, IProps.modName, "Hash already added: " .. newCommand.icon.hash) end
end end
local offset = IProps.commandOffset for index, command in ipairs(tempCommands) do commands[(index + offset - 1) % #tempCommands + 1] = command end
--We prnt both of the following conditions to seee if they are false or true. --We print the condition npc and npc:ToString() == "NPCPuppet" Utils.Log(IProps.enableDebug, IProps.modName, "<runUpdates>: Checking if NPC is a Puppet: " .. tostring(npc and npc:ToString() == "NPCPuppet")) --We print the condition npc and npc:GetHudManager().uiScannerVisible Utils.Log(IProps.enableDebug, IProps.modName, "<runUpdates>: Checking if NPC HUD is visible: " .. tostring(npc and npc:GetHudManager().uiScannerVisible)) if npc and npc:ToString() == "NPCPuppet" and npc:GetHudManager().uiScannerVisible then --Utils.Log(IProps.enableDebug, IProps.modName, "<runUpdates>: Checking NPC registration and HUD visibility") --We also add a check to NOT call RevealQuickHacks if the global variable "commands" is not empty --We print all the variables we are checking in the next condition like npc:GetHudManager():IsRegistered(npc:GetEntityID()) and the others: --We first print if npc:GetHudManager():IsRegistered(npc:GetEntityID()) is true: --Utils.Log(IProps.enableDebug, IProps.modName, "<runUpdates>: Is NPC Registered: " .. tostring(npc:GetHudManager():IsRegistered(npc:GetEntityID()))) --We then print if npc:GetHudManager():GetCurrentTarget() is not nil: --Utils.Log(IProps.enableDebug, IProps.modName, "<runUpdates>: Is Current Target not nil: " .. tostring(npc:GetHudManager():GetCurrentTarget() ~= nil)) --We then print if npc:GetHudManager():IsQuickHackPanelOpened() is false: Utils.Log(IProps.enableDebug, IProps.modName, "<runUpdates>: Is QuickHack Panel not opened: " .. tostring(not npc:GetHudManager():IsQuickHackPanelOpened()))
if npc:GetHudManager():IsRegistered(npc:GetEntityID()) and npc:GetHudManager():GetCurrentTarget() ~= nil and (not npc:GetHudManager():IsQuickHackPanelOpened()) then Utils.Log(IProps.enableDebug, IProps.modName, "<runUpdates>: Calling RevealQuickHacks") RevealQuickHacks(npc, player) hasCalledRevealQuickHacks = true end
if not Config.disableOnCivilians and not npc:GetHudManager():IsRegistered(npc:GetEntityID()) then Utils.Log(IProps.enableDebug, IProps.modName, "<runUpdates>: Registering NPC to HUD Manager") Utils.Log(IProps.enableDebug, IProps.modName, "NPC QH Registered") npc:RegisterToHUDManager(true) end end
end
function loadSavedConfig() local config = Utils.LoadConfig(IProps.modName, 'config.json')
if config then Config = json.decode(config) end end
if IProps.deltaTime > 1 then -- Now checks if more than 10 seconds have passed runUpdates() IProps.deltaTime = 0 -- Reset the timer back to 0 to start counting another 10 seconds end end)
ImGui.SetNextWindowPos(100, 500, ImGuiCond.FirstUseEver) -- set window position x, y ImGui.SetNextWindowSize(250, 60, ImGuiCond.Appearing) -- set window size w, h
if ImGui.Begin("Hack Everyone Setup") then local disableOnCivilians = ImGui.Checkbox("Disable Hacks on Civilians", Config.disableOnCivilians) if disableOnCivilians ~= Config.disableOnCivilians then Config.disableOnCivilians = disableOnCivilians Utils.SaveConfig(IProps.modName, 'config.json', json.encode(Config)) end end ImGui.End()
function RevealQuickHacks(npc, player) if IProps.isUploadingQHCOmmands then return end
IProps.isUploadingQHCOmmands = true
local playerQHacksList = gameRPGManager.GetPlayerQuickHackListWithQuality(player)
local commands = {}
local context = npc:GetPS():GenerateContext("Remote", NewObject("handle:gamedeviceClearance"), Game.GetPlayerSystem():GetLocalPlayerControlledGameObject(), npc:GetEntityID()) local i = 0
for _, actionData in pairs(playerQHacksList) do
local action = npc:GetPS():GetAction(actionData.actionRecord) actionRecord = actionData.actionRecord
if actionRecord:ObjectActionType():Type().value == "PuppetQuickHack" then
local newCommand = NewObject("handle:QuickhackData")
-- QuickHack Names -- Handle Custom Titles newCommand.title = "QuickHack "..i newCommand.description = "QuickHack "..i for _, QHData in pairs(IProps.qhNameList) do
if QHData.hash == newCommand.icon.hash then newCommand.title = QHData.name newCommand.description = QHData.name --print("QuickHack match hash ", QHData.name, newCommand.icon.hash) end --print("QuickHack hash ", newCommand.title, newCommand.icon.hash)
end
-- Work Cooldowns actionStartEffects = actionRecord:StartEffects() for _, effect in pairs(actionStartEffects) do
if effect:StatusEffect() and effect:StatusEffect():StatusEffectType():Type().value == "PlayerCooldown" then statModifiers = effect:StatusEffect():Duration():StatModifiers() newCommand.cooldown = 0.0 newCommand.cooldownTweak = effect:StatusEffect():GetID() end
if puppetAction:IsInactive() then newCommand.isLocked = true newCommand.inactiveReason = puppetAction.GetInactiveReason() elseif Game.GetStatPoolsSystem():IsStatPoolAdded(npc:GetEntityID(), "QuickHackUpload") then newCommand.isLocked = true newCommand.inactiveReason = "LocKey#7020" elseif not puppetAction:CanPayCost() then newCommand.isLocked = true newCommand.actionState = "OutOfMemory" newCommand.inactiveReason = "LocKey#27398" else newCommand.action = puppetAction end
if actionRecord:GetTargetActivePrereqsCount() > 0 then targetActivePrereqs = actionRecord:TargetActivePrereqs() for _, activePrereqs in pairs(targetActivePrereqs) do
prereqsToCheck = activePrereqs:FailureConditionPrereq() if not gameRPGManager.CheckPrereqs(prereqsToCheck, npc) then newCommand.isLocked = true; newCommand.inactiveReason = activePrereqs:FailureExplanation() end end
end
-- if newCommand.cooldown and newCommand.cooldown ~= 0 then -- newCommand.isLocked = true; -- newCommand.inactiveReason = "LocKey#10943"; -- newCommand.actionState = "Locked"; -- else -- newCommand.action = puppetAction -- end
if npc and npc:ToString() == "NPCPuppet" and npc:GetHudManager().uiScannerVisible then
if npc:GetHudManager():IsRegistered(npc:GetEntityID()) and npc:GetHudManager():GetCurrentTarget() ~= nil and (not npc:GetHudManager():IsQuickHackPanelOpened()) then RevealQuickHacks(npc, player) end
if not Config.disableOnCivilians and not npc:GetHudManager():IsRegistered(npc:GetEntityID()) then npc:RegisterToHUDManager(true) Utils.Log(IProps.enableDebug, IProps.modName, "NPC QH Registered") end
end
end
function loadSavedConfig() local config = Utils.LoadConfig(IProps.modName, 'config.json')
if config then Config = json.decode(config) end end
ImGui.SetNextWindowPos(100, 500, ImGuiCond.FirstUseEver) -- set window position x, y ImGui.SetNextWindowSize(250, 60, ImGuiCond.Appearing) -- set window size w, h
if ImGui.Begin("Hack Everyone Setup") then local disableOnCivilians = ImGui.Checkbox("Disable Hacks on Civilians", Config.disableOnCivilians) if disableOnCivilians ~= Config.disableOnCivilians then Config.disableOnCivilians = disableOnCivilians Utils.SaveConfig(IProps.modName, 'config.json', json.encode(Config)) end end ImGui.End()
Mine still work with this code, even though the quickhack option is doubled, it is still fine for me. The problem for me is when i try it on civilian, I can't scroll down the hack option, force me to can only choose the top hack option. Can someone have solution on this?
198 comments
Only issue is that you can't scroll through the quickhacks to get to the one you want.
The mod mentioned in another comment, Interactive Cybercity, which is supposed to function similar to this one, currently does not work with the most recent version of the game, as of writing this.
The comment made by Cartterr is a messy solution to this issue though. Instead of scrolling normally, it just "steps" the quickhacks until you can get the one you want. Cycling through it, per se.
But it shows duplicate hacks. Also sometimes it can hack downed civilians.
https://www.nexusmods.com/cyberpunk2077/mods/7976?tab=description
Immersive Cyberpunk City 2.02: https://www.nexusmods.com/cyberpunk2077/mods/7976
Just follow the instructions in the comment by "Dragoon23" copied and pasted below
------------------------------------------------------------------
COMMENT:
1. Download and install CET and this mod.
2. Open the init.lua of the mod in notepad
3. Go to kinasch's post for the link to tesnitrojack's post in the forum. Do NOT get the code from here in the comments section. Get it from the forum post.
4. Copy/paste that into init.lua and replace all the original code.
5. Save.
------------------------------------------------------------------
I followed "Dragoon23" instructions and it is 100% working on the 2.1 update, i have yet to experience any bugs or crashing.
Smooth sailing so far. enjoy the mod chooms
When an "active" quickhack (which is NOT Red because of inssuficient ram) is selected, the menu restarts. I don't have the time to debug it but maybe someone can take a crack at it. the logic itself is not hard to understand and I bet that it has to do with "puppetAction" and the abstract class ScriptableDeviceAction in "tools\redmod\scripts\cyberpunk\devices\core\baseDeviceActions.script". I'm gonna keep the debug prints just in case:
Just replace init.lua with this:
-------------------------------------------------------------------
local IProps = { enableDebug = true,
deltaTime = 0,
commandOffset = 0,
drawWindow = false,
isUploadingQHCOmmands = false,
modName = 'Hack Everyone',
modVersion = '1.5.0',
qhNameList = {
{
hash = 3116789880,
name = "Ping"
},
{
hash = 612394680,
name = "Reboot Optics"
},
{
hash = 523263573,
name = "Contagion"
},
{
hash = 190881063,
name = "Sonic Shock"
},
{
hash = 2537897906,
name = "Suicide"
},
{
hash = 988968086,
name = "Cyberpsychosis"
},
{
hash = 4273202386,
name = "Weapon Glitch"
},
{
hash = 2534130900,
name = "Detonate Grenade"
},
{
hash = 2795108209,
name = "Short Circuit"
},
{
hash = 880772118,
name = "Synapse Burnout"
},
{
hash = 520988073,
name = "System Reset"
},
{
hash = 249499564,
name = "Memory Wipe"
},
{
hash = 3396834708,
name = "Cripple Movement"
},
{
hash = 3189733290,
name = "Whistle"
},
{
hash = 2582207146,
name = "Overheat"
},
{
hash = 1086744564,
name = "Cyberware Malfunction"
},
{
hash = 3341984842,
name = "Request Backup"
},
}
}
local Config = {
disableOnCivilians = false,
}
local json = require('json')
local Utils = require('utilities')
function RefreshHUD(npc, player)
-- npc:RegisterToHUDManager(true)
Utils.Log(IProps.enableDebug, IProps.modName, "<RefreshHUD>: Refreshing HUD")
updateData = NewObject("handle:HUDActorUpdateData")
updateData.updateVisibility = true
updateData.updateIsRevealed = true
updateData.isRevealedValue = true
updateData.updateIsTagged = true
updateData.isTaggedValue = true
updateData.updateClueData = true
updateData.updateIsRemotelyAccessed = true
updateData.isRemotelyAccessedValue = true
updateData.updateCanOpenScannerInfo = true
updateData.canOpenScannerInfoValue = true
updateData.updateIsInIconForcedVisibilityRange = true
updateData.isInIconForcedVisibilityRangeValue = true
updateData.updateIsIconForcedVisibleThroughWalls = true
updateData.isIconForcedVisibleThroughWallsValue = true
actor = NewObject("handle:gameHudActor")
actor:UpdateActorData(updateData)
actor.entityID = npc:GetEntityID()
actor.status = "REGISTERED"
actor.type = "PUPPET"
npc:GetHudManager():SetNewTarget(actor)
end
local function areCommandsDifferent(newCommands, oldCommands)
Utils.Log(IProps.enableDebug, IProps.modName, "Checking if commands are different...")
-- Check if the number of commands differs
if #newCommands ~= #oldCommands then
Utils.Log(IProps.enableDebug, IProps.modName, "Command counts differ: " .. #newCommands .. " vs " .. #oldCommands)
return true
end
-- Check each command for differences
for i, command in ipairs(newCommands) do
if command.title ~= oldCommands[i].title or command.description ~= oldCommands[i].description then
--Utils.Log(IProps.enableDebug, IProps.modName, "Difference detected in command " .. i .. ": Title or Description changed")
--Utils.Log(IProps.enableDebug, IProps.modName, "New Command - Title: " .. command.title .. ", Description: " .. command.description)
--Utils.Log(IProps.enableDebug, IProps.modName, "Old Command - Title: " .. oldCommands[i].title .. ", Description: " .. oldCommands[i].description)
return true
end
end
-- No differences found
Utils.Log(IProps.enableDebug, IProps.modName, "No differences found in commands")
return false
end
local quickHackHashes = {
3116789880, -- Ping
612394680, -- Reboot Optics
523263573, -- Contagion
190881063, -- Sonic Shock
2537897906, -- Suicide
988968086, -- Cyberpsychosis
4273202386, -- Weapon Glitch
-- 2534130900, -- Detonate Grenade (NC Residents don't have them)
-- 3341984842, -- Request Backup (NC Residents can't do this)
2795108209, -- Short Circuit
880772118, -- Synapse Burnout
520988073, -- System Reset
249499564, -- Memory Wipe
3396834708, -- Cripple Movement
3189733290, -- Whistle
2582207146, -- Overheat
1086744564 -- Cyberware Malfunction
}
function RevealQuickHacks(npc, player)
if IProps.isUploadingQHCOmmands then return end
IProps.isUploadingQHCOmmands = true
local playerQHacksList = gameRPGManager.GetPlayerQuickHackListWithQuality(player)
local commands = {}
local addedHashes = {} -- Set to track which hashes have been added to commands
local tempCommands = {} -- Temporary storage for commands before applying the offset
local context = npc:GetPS():GenerateContext("Remote",
NewObject("handle:gamedeviceClearance"),
Game.GetPlayerSystem():GetLocalPlayerControlledGameObject(),
npc:GetEntityID())
local i = 0
for _, actionData in pairs(playerQHacksList) do
local action = npc:GetPS():GetAction(actionData.actionRecord)
actionRecord = actionData.actionRecord
if actionRecord:ObjectActionType():Type().value == "PuppetQuickHack" then
--We just print lines to differentiate the different QuickHacks we are finding, like we just print --------------------------------------
Utils.Log(IProps.enableDebug, IProps.modName, "---------------------------------------------------")
--Utils.Log(IProps.enableDebug, IProps.modName, "QuickHack Found: " .. actionRecord:ObjectActionUI():Caption())
local newCommand = NewObject("handle:QuickhackData")
newCommand.actionOwnerName = npc:GetTweakDBFullDisplayName(true)
-- newCommand.title = actionRecord:ObjectActionUI():Caption()
-- newCommand.description = actionRecord:ObjectActionUI():Description()
newCommand.icon = actionRecord:ObjectActionUI():CaptionIcon():TexturePartID():GetID()
newCommand.type = actionRecord:ObjectActionType():Type()
newCommand.actionOwner = npc:GetEntityID()
newCommand.isInstant = false
newCommand.ICELevel = npc:GetICELevel()
newCommand.ICELevelVisible = true
newCommand.quality = actionData.quality
newCommand.networkBreached = npc:IsBreached()
newCommand.category = actionRecord:HackCategory()
newCommand.actionCompletionEffects = actionRecord:CompletionEffects()
-- Initialize additional properties as nil
newCommand.cooldown = 'nil'
newCommand.cooldownTweak = 'nil'
newCommand.duration = 'nil'
newCommand.uploadTime = 'nil'
newCommand.costRaw = 'nil'
newCommand.cost = 'nil'
newCommand.actionMatchesTarget = 'nil'
newCommand.isLocked = 'nil'
newCommand.inactiveReason = 'nil'
newCommand.actionState = 'nil'
newCommand.action = 'nil'
-- QuickHack Names
-- Handle Custom Titles
newCommand.title = "QuickHack "..i
newCommand.description = "QuickHack "..i
for _, QHData in pairs(IProps.qhNameList) do
if QHData.hash == newCommand.icon.hash then
--Utils.Log(IProps.enableDebug, IProps.modName, "QuickHack match hash: " .. QHData.name)
newCommand.title = QHData.name
newCommand.description = QHData.name
--print("QuickHack match hash ", QHData.name, newCommand.icon.hash)
--else
--Utils.Log(IProps.enableDebug, IProps.modName, "QuickHack hash not found: " .. newCommand.icon.hash)
end
--print("QuickHack hash ", newCommand.title, newCommand.icon.hash)
end
-- Work Cooldowns
actionStartEffects = actionRecord:StartEffects()
for _, effect in pairs(actionStartEffects) do
if effect:StatusEffect() and effect:StatusEffect():StatusEffectType():Type().value == "PlayerCooldown" then
--Utils.Log(IProps.enableDebug, IProps.modName, "Cooldown Found: " .. effect:StatusEffect():GetID())
Utils.Log(IProps.enableDebug, IProps.modName, "Cooldown Found")
statModifiers = effect:StatusEffect():Duration():StatModifiers()
newCommand.cooldown = 0.0
newCommand.cooldownTweak = effect:StatusEffect():GetID()
end
end
newCommand.duration =
npc:GetQuickHackDuration(actionData.actionRecord, npc,
npc:GetEntityID(), Game.GetPlayer():GetEntityID())
local puppetAction = npc:GetPS():GetAction(actionData.actionRecord)
puppetAction:SetExecutor(context.processInitiatorObject)
puppetAction:RegisterAsRequester(npc:GetPS():GetMyEntityID())
puppetAction:SetObjectActionID(actionData.actionRecord:GetID())
puppetAction:SetUp(npc:GetPS())
puppetAction:SetDurationValue(0.0) -- Reset duration
-- Immediately after resetting, set the duration to a non-zero value if the action is considered active but not started
if not puppetAction:IsStarted() and not puppetAction:IsCompleted() then
puppetAction:SetDurationValue(10.0) -- Prepare the action as active but mark as not started
end
newCommand.uploadTime = puppetAction:GetActivationTime()
newCommand.costRaw = puppetAction:GetBaseCost()
newCommand.cost = puppetAction:GetCost();
-- newCommand.title = puppetAction.actionName.value
-- newCommand.description = puppetAction.actionName.value
newCommand.actionMatchesTarget = true
if puppetAction:IsInactive() then
Utils.Log(IProps.enableDebug, IProps.modName, "QuickHack is inactive: " .. puppetAction.GetInactiveReason())
newCommand.isLocked = true
newCommand.inactiveReason = puppetAction.GetInactiveReason()
elseif Game.GetStatPoolsSystem():IsStatPoolAdded(npc:GetEntityID(), "QuickHackUpload") then
Utils.Log(IProps.enableDebug, IProps.modName, "QuickHack is uploading")
newCommand.isLocked = true
newCommand.inactiveReason = "LocKey#7020"
elseif not puppetAction:CanPayCost() then
Utils.Log(IProps.enableDebug, IProps.modName, "QuickHack cannot pay cost")
newCommand.isLocked = true
newCommand.actionState = "OutOfMemory"
newCommand.inactiveReason = "LocKey#27398"
else
Utils.Log(IProps.enableDebug, IProps.modName, "QuickHack is active")
-- we print puppetAction for debugging
if puppetAction then
Utils.Log(IProps.enableDebug, IProps.modName, "Puppet Action is valid")
else
Utils.Log(IProps.enableDebug, IProps.modName, "Puppet Action is nil")
end
Utils.Log(IProps.enableDebug, IProps.modName, "Puppet Action Name: " .. tostring(puppetAction:GetActionName()))
Utils.Log(IProps.enableDebug, IProps.modName, "Puppet Action Duration: " .. tostring(puppetAction:GetDurationValue()))
Utils.Log(IProps.enableDebug, IProps.modName, "Puppet Action Completed: " .. tostring(puppetAction:IsCompleted()))
Utils.Log(IProps.enableDebug, IProps.modName, "Puppet Action Started: " .. tostring(puppetAction:IsStarted()))
Utils.Log(IProps.enableDebug, IProps.modName, "Puppet Device Name: " .. puppetAction:GetDeviceName())
local iconRecord = puppetAction:GetInteractionIcon()
if iconRecord then
Utils.Log(IProps.enableDebug, IProps.modName, "Puppet Action Icon: " .. tostring(iconRecord:GetID()))
end
Utils.Log(IProps.enableDebug, IProps.modName, "Puppet Action Inactive Reason: " .. tostring(puppetAction:GetInactiveReason()))
--Utils.Log(IProps.enableDebug, IProps.modName, "Puppet Action Name: " .. puppetAction.GetName())
--Utils.Log(IProps.enableDebug, IProps.modName, "Puppet Action ID: " .. puppetAction.GetID())
newCommand.action = puppetAction
end
if actionRecord:GetTargetActivePrereqsCount() > 0 then
--Utils.Log(IProps.enableDebug, IProps.modName, "Checking Target Active Prereqs")
targetActivePrereqs = actionRecord:TargetActivePrereqs()
for _, activePrereqs in pairs(targetActivePrereqs) do
prereqsToCheck = activePrereqs:FailureConditionPrereq()
if not gameRPGManager.CheckPrereqs(prereqsToCheck, npc) then
--Utils.Log(IProps.enableDebug, IProps.modName, "Prereqs failed: " .. activePrereqs:FailureExplanation())
newCommand.isLocked = true;
newCommand.inactiveReason = activePrereqs:FailureExplanation()
end
end
end
-- if newCommand.cooldown and newCommand.cooldown ~= 0 then
-- newCommand.isLocked = true;
-- newCommand.inactiveReason = "LocKey#10943";
-- newCommand.actionState = "Locked";
-- else
-- newCommand.action = puppetAction
-- end
-- Only if newCommand.icon.hash is not in the list of hashes we add it:
local hashExists = addedHashes[newCommand.icon.hash] -- Check if hash has already been added
local isHashInList = false
for _, hash in ipairs(quickHackHashes) do
if hash == newCommand.icon.hash then
isHashInList = true
break
end
end
-- we add a condition so that if the hash is not in the list we do not add it and if newCommand.inactiveReason is not nil we do not add it either
if isHashInList
and
not hashExists
--newCommand.inactiveReason ~= 'nil' and
--newCommand.inactiveReason ~= 'LocKey#51710'
--newCommand.actionMatchesTarget == true and
--newCommand.isLocked == true
then
-- Only add newCommand if its hash is in the list and not already added
Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack: " .. newCommand.title)
Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack Hash: " .. newCommand.icon.hash)
-- we print all the other possible data of newCommand
Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack Description: " .. newCommand.description)
--Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack Type: " .. newCommand.type)
Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack ICELevel: " .. newCommand.ICELevel)
Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack ICELevelVisible: " .. tostring(newCommand.ICELevelVisible))
Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack Quality: " .. newCommand.quality)
Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack NetworkBreached: " .. tostring(newCommand.networkBreached))
--Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack Category: " .. newCommand.category)
--Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack ActionCompletionEffects: " .. json.encode(newCommand.actionCompletionEffects))
Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack Cooldown: " .. newCommand.cooldown)
--Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack CooldownTweak: " .. newCommand.cooldownTweak)
Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack Duration: " .. newCommand.duration)
Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack UploadTime: " .. newCommand.uploadTime)
Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack CostRaw: " .. newCommand.costRaw)
Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack Cost: " .. newCommand.cost)
Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack ActionMatchesTarget: " .. tostring(newCommand.actionMatchesTarget))
Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack IsLocked: " .. tostring(newCommand.isLocked))
Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack InactiveReason: " .. newCommand.inactiveReason)
--Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack ActionState: " .. newCommand.actionState)
--Utils.Log(IProps.enableDebug, IProps.modName, "Adding QuickHack Action: " .. newCommand.action)
addedHashes[newCommand.icon.hash] = true -- Mark this hash as added
--commands[i] = newCommand
tempCommands[#tempCommands + 1] = newCommand
i = i + 1
elseif not isHashInList then
Utils.Log(IProps.enableDebug, IProps.modName, "Hash not in list: " .. newCommand.icon.hash)
elseif hashExists then
Utils.Log(IProps.enableDebug, IProps.modName, "Hash already added: " .. newCommand.icon.hash)
end
end
end
local offset = IProps.commandOffset
for index, command in ipairs(tempCommands) do
commands[(index + offset - 1) % #tempCommands + 1] = command
end
quickSlotsManagerNotification = NewObject("handle:RevealInteractionWheel")
quickSlotsManagerNotification.lookAtObject = npc
quickSlotsManagerNotification.shouldReveal = true
quickSlotsManagerNotification.commands = commands
Game.GetUISystem():QueueEvent(quickSlotsManagerNotification)
IProps.isUploadingQHCOmmands = false
Utils.Log(IProps.enableDebug, IProps.modName, "QuickHacks Uploaded")
IProps.commandOffset = (IProps.commandOffset + 1) % #tempCommands
end
local hasCalledRevealQuickHacks = false
function runUpdates()
player = Game.GetPlayer()
if not player then return end
npc = Game.GetTargetingSystem():GetLookAtObject(player, false, false)
--We prnt both of the following conditions to seee if they are false or true.
--We print the condition npc and npc:ToString() == "NPCPuppet"
Utils.Log(IProps.enableDebug, IProps.modName, "<runUpdates>: Checking if NPC is a Puppet: " .. tostring(npc and npc:ToString() == "NPCPuppet"))
--We print the condition npc and npc:GetHudManager().uiScannerVisible
Utils.Log(IProps.enableDebug, IProps.modName, "<runUpdates>: Checking if NPC HUD is visible: " .. tostring(npc and npc:GetHudManager().uiScannerVisible))
if npc and npc:ToString() == "NPCPuppet" and npc:GetHudManager().uiScannerVisible then
--Utils.Log(IProps.enableDebug, IProps.modName, "<runUpdates>: Checking NPC registration and HUD visibility")
--We also add a check to NOT call RevealQuickHacks if the global variable "commands" is not empty
--We print all the variables we are checking in the next condition like npc:GetHudManager():IsRegistered(npc:GetEntityID()) and the others:
--We first print if npc:GetHudManager():IsRegistered(npc:GetEntityID()) is true:
--Utils.Log(IProps.enableDebug, IProps.modName, "<runUpdates>: Is NPC Registered: " .. tostring(npc:GetHudManager():IsRegistered(npc:GetEntityID())))
--We then print if npc:GetHudManager():GetCurrentTarget() is not nil:
--Utils.Log(IProps.enableDebug, IProps.modName, "<runUpdates>: Is Current Target not nil: " .. tostring(npc:GetHudManager():GetCurrentTarget() ~= nil))
--We then print if npc:GetHudManager():IsQuickHackPanelOpened() is false:
Utils.Log(IProps.enableDebug, IProps.modName, "<runUpdates>: Is QuickHack Panel not opened: " .. tostring(not npc:GetHudManager():IsQuickHackPanelOpened()))
if npc:GetHudManager():IsRegistered(npc:GetEntityID()) and
npc:GetHudManager():GetCurrentTarget() ~= nil and
(not npc:GetHudManager():IsQuickHackPanelOpened()) then
Utils.Log(IProps.enableDebug, IProps.modName, "<runUpdates>: Calling RevealQuickHacks")
RevealQuickHacks(npc, player)
hasCalledRevealQuickHacks = true
end
if not Config.disableOnCivilians and not npc:GetHudManager():IsRegistered(npc:GetEntityID()) then
Utils.Log(IProps.enableDebug, IProps.modName, "<runUpdates>: Registering NPC to HUD Manager")
Utils.Log(IProps.enableDebug, IProps.modName, "NPC QH Registered")
npc:RegisterToHUDManager(true)
end
end
end
function loadSavedConfig()
local config = Utils.LoadConfig(IProps.modName, 'config.json')
if config then
Config = json.decode(config)
end
end
registerForEvent("onInit", function()
loadSavedConfig()
print("["..IProps.modName.."] Initialized | Version: "..IProps.modVersion)
end)
registerForEvent("onUpdate", function(deltaTime)
IProps.deltaTime = IProps.deltaTime + deltaTime
if IProps.deltaTime > 1 then -- Now checks if more than 10 seconds have passed
runUpdates()
IProps.deltaTime = 0 -- Reset the timer back to 0 to start counting another 10 seconds
end
end)
registerForEvent("onOverlayOpen", function()
IProps.drawWindow = true
end)
registerForEvent("onOverlayClose", function()
IProps.drawWindow = false
end)
registerForEvent("onDraw", function()
if IProps.drawWindow then
ImGui.SetNextWindowPos(100, 500, ImGuiCond.FirstUseEver) -- set window position x, y
ImGui.SetNextWindowSize(250, 60, ImGuiCond.Appearing) -- set window size w, h
if ImGui.Begin("Hack Everyone Setup") then
local disableOnCivilians = ImGui.Checkbox("Disable Hacks on Civilians", Config.disableOnCivilians)
if disableOnCivilians ~= Config.disableOnCivilians then
Config.disableOnCivilians = disableOnCivilians
Utils.SaveConfig(IProps.modName, 'config.json', json.encode(Config))
end
end
ImGui.End()
end
end)
-------------------------------------------------------------------
When a "active" quickhack
copy this (replace) the code in init.lua of the mod :
\Cyberpunk 2077\bin\x64\plugins\cyber_engine_tweaks\mods\Hack Everyone\
(don't Blah !! just help others..)
->
if there are doubles u choose minimal RAM lol xD....
local IProps = { enableDebug = false,
deltaTime = 0,
drawWindow = false,
isUploadingQHCOmmands = false,
modName = 'Hack Everyone',
modVersion = '1.5.0',
qhNameList = {
{
hash = 3116789880,
name = "Ping"
},
{
hash = 612394680,
name = "Reboot Optics"
},
{
hash = 523263573,
name = "Contagion"
},
{
hash = 190881063,
name = "Sonic Shock"
},
{
hash = 2537897906,
name = "Suicide"
},
{
hash = 988968086,
name = "Cyberpsychosis"
},
{
hash = 4273202386,
name = "Weapon Glitch"
},
{
hash = 2534130900,
name = "Detonate Grenade"
},
{
hash = 2795108209,
name = "Short Circuit"
},
{
hash = 880772118,
name = "Synapse Burnout"
},
{
hash = 520988073,
name = "System Reset"
},
{
hash = 249499564,
name = "Memory Wipe"
},
{
hash = 3396834708,
name = "Cripple Movement"
},
{
hash = 3189733290,
name = "Whistle"
},
{
hash = 2582207146,
name = "Overheat"
},
{
hash = 1086744564,
name = "Cyberware Malfunction"
},
{
hash = 3341984842,
name = "Request Backup"
},
}
}
local Config = {
disableOnCivilians = false,
}
local json = require('json')
local Utils = require('utilities')
function RefreshHUD(npc, player)
-- npc:RegisterToHUDManager(true)
updateData = NewObject("handle:HUDActorUpdateData")
updateData.updateVisibility = true
updateData.updateIsRevealed = true
updateData.isRevealedValue = true
updateData.updateIsTagged = true
updateData.isTaggedValue = true
updateData.updateClueData = true
updateData.updateIsRemotelyAccessed = true
updateData.isRemotelyAccessedValue = true
updateData.updateCanOpenScannerInfo = true
updateData.canOpenScannerInfoValue = true
updateData.updateIsInIconForcedVisibilityRange = true
updateData.isInIconForcedVisibilityRangeValue = true
updateData.updateIsIconForcedVisibleThroughWalls = true
updateData.isIconForcedVisibleThroughWallsValue = true
actor = NewObject("handle:gameHudActor")
actor:UpdateActorData(updateData)
actor.entityID = npc:GetEntityID()
actor.status = "REGISTERED"
actor.type = "PUPPET"
npc:GetHudManager():SetNewTarget(actor)
end
function RevealQuickHacks(npc, player)
if IProps.isUploadingQHCOmmands then return end
IProps.isUploadingQHCOmmands = true
local playerQHacksList = gameRPGManager.GetPlayerQuickHackListWithQuality(player)
local commands = {}
local context = npc:GetPS():GenerateContext("Remote",
NewObject("handle:gamedeviceClearance"),
Game.GetPlayerSystem():GetLocalPlayerControlledGameObject(),
npc:GetEntityID())
local i = 0
for _, actionData in pairs(playerQHacksList) do
local action = npc:GetPS():GetAction(actionData.actionRecord)
actionRecord = actionData.actionRecord
if actionRecord:ObjectActionType():Type().value == "PuppetQuickHack" then
local newCommand = NewObject("handle:QuickhackData")
newCommand.actionOwnerName = npc:GetTweakDBFullDisplayName(true)
-- newCommand.title = actionRecord:ObjectActionUI():Caption()
-- newCommand.description = actionRecord:ObjectActionUI():Description()
newCommand.icon = actionRecord:ObjectActionUI():CaptionIcon():TexturePartID():GetID()
newCommand.type = actionRecord:ObjectActionType():Type()
newCommand.actionOwner = npc:GetEntityID()
newCommand.isInstant = false
newCommand.ICELevel = npc:GetICELevel()
newCommand.ICELevelVisible = true
newCommand.quality = actionData.quality
newCommand.networkBreached = npc:IsBreached()
newCommand.category = actionRecord:HackCategory()
newCommand.actionCompletionEffects = actionRecord:CompletionEffects()
-- QuickHack Names
-- Handle Custom Titles
newCommand.title = "QuickHack "..i
newCommand.description = "QuickHack "..i
for _, QHData in pairs(IProps.qhNameList) do
if QHData.hash == newCommand.icon.hash then
newCommand.title = QHData.name
newCommand.description = QHData.name
--print("QuickHack match hash ", QHData.name, newCommand.icon.hash)
end
--print("QuickHack hash ", newCommand.title, newCommand.icon.hash)
end
-- Work Cooldowns
actionStartEffects = actionRecord:StartEffects()
for _, effect in pairs(actionStartEffects) do
if effect:StatusEffect() and effect:StatusEffect():StatusEffectType():Type().value == "PlayerCooldown" then
statModifiers = effect:StatusEffect():Duration():StatModifiers()
newCommand.cooldown = 0.0
newCommand.cooldownTweak = effect:StatusEffect():GetID()
end
end
newCommand.duration =
npc:GetQuickHackDuration(actionData.actionRecord, npc,
npc:GetEntityID(), Game.GetPlayer():GetEntityID())
local puppetAction = npc:GetPS():GetAction(actionData.actionRecord)
puppetAction:SetExecutor(context.processInitiatorObject)
puppetAction:RegisterAsRequester(npc:GetPS():GetMyEntityID())
puppetAction:SetObjectActionID(actionData.actionRecord:GetID())
puppetAction:SetUp(npc:GetPS())
newCommand.uploadTime = puppetAction:GetActivationTime()
newCommand.costRaw = puppetAction:GetBaseCost()
newCommand.cost = puppetAction:GetCost();
-- newCommand.title = puppetAction.actionName.value
-- newCommand.description = puppetAction.actionName.value
newCommand.actionMatchesTarget = true
if puppetAction:IsInactive() then
newCommand.isLocked = true
newCommand.inactiveReason = puppetAction.GetInactiveReason()
elseif Game.GetStatPoolsSystem():IsStatPoolAdded(npc:GetEntityID(), "QuickHackUpload") then
newCommand.isLocked = true
newCommand.inactiveReason = "LocKey#7020"
elseif not puppetAction:CanPayCost() then
newCommand.isLocked = true
newCommand.actionState = "OutOfMemory"
newCommand.inactiveReason = "LocKey#27398"
else
newCommand.action = puppetAction
end
if actionRecord:GetTargetActivePrereqsCount() > 0 then
targetActivePrereqs = actionRecord:TargetActivePrereqs()
for _, activePrereqs in pairs(targetActivePrereqs) do
prereqsToCheck = activePrereqs:FailureConditionPrereq()
if not gameRPGManager.CheckPrereqs(prereqsToCheck, npc) then
newCommand.isLocked = true;
newCommand.inactiveReason = activePrereqs:FailureExplanation()
end
end
end
-- if newCommand.cooldown and newCommand.cooldown ~= 0 then
-- newCommand.isLocked = true;
-- newCommand.inactiveReason = "LocKey#10943";
-- newCommand.actionState = "Locked";
-- else
-- newCommand.action = puppetAction
-- end
commands[i] = newCommand
i = i + 1
end
end
quickSlotsManagerNotification = NewObject("handle:RevealInteractionWheel")
quickSlotsManagerNotification.lookAtObject = npc
quickSlotsManagerNotification.shouldReveal = true
quickSlotsManagerNotification.commands = commands
Game.GetUISystem():QueueEvent(quickSlotsManagerNotification)
IProps.isUploadingQHCOmmands = false
Utils.Log(IProps.enableDebug, IProps.modName, "QuickHacks Uploaded")
end
function runUpdates()
player = Game.GetPlayer()
if not player then return end
npc = Game.GetTargetingSystem():GetLookAtObject(player, false, false)
if npc and npc:ToString() == "NPCPuppet" and npc:GetHudManager().uiScannerVisible then
if npc:GetHudManager():IsRegistered(npc:GetEntityID()) and
npc:GetHudManager():GetCurrentTarget() ~= nil and (not
npc:GetHudManager():IsQuickHackPanelOpened()) then
RevealQuickHacks(npc, player)
end
if not Config.disableOnCivilians and not npc:GetHudManager():IsRegistered(npc:GetEntityID()) then
npc:RegisterToHUDManager(true)
Utils.Log(IProps.enableDebug, IProps.modName, "NPC QH Registered")
end
end
end
function loadSavedConfig()
local config = Utils.LoadConfig(IProps.modName, 'config.json')
if config then
Config = json.decode(config)
end
end
registerForEvent("onInit", function()
loadSavedConfig()
print("["..IProps.modName.."] Initialized | Version: "..IProps.modVersion)
end)
registerForEvent("onUpdate", function(deltaTime)
IProps.deltaTime = IProps.deltaTime + deltaTime
if IProps.deltaTime > 1 then
runUpdates()
IProps.deltaTime = IProps.deltaTime - 1
end
end)
registerForEvent("onOverlayOpen", function()
IProps.drawWindow = true
end)
registerForEvent("onOverlayClose", function()
IProps.drawWindow = false
end)
registerForEvent("onDraw", function()
if IProps.drawWindow then
ImGui.SetNextWindowPos(100, 500, ImGuiCond.FirstUseEver) -- set window position x, y
ImGui.SetNextWindowSize(250, 60, ImGuiCond.Appearing) -- set window size w, h
if ImGui.Begin("Hack Everyone Setup") then
local disableOnCivilians = ImGui.Checkbox("Disable Hacks on Civilians", Config.disableOnCivilians)
if disableOnCivilians ~= Config.disableOnCivilians then
Config.disableOnCivilians = disableOnCivilians
Utils.SaveConfig(IProps.modName, 'config.json', json.encode(Config))
end
end
ImGui.End()
end
end)