Skip to content

Instantly share code, notes, and snippets.

@psiberx
psiberx / init.lua
Created February 24, 2021 19:12
Cyberpunk 2077: Sample mod for reading player actions (inputs)
--[[
An example of reading player actions / inputs
]]
registerForEvent('onInit', function()
Observe('PlayerPuppet', 'OnAction', function(action)
local actionName = Game.NameToString(action:GetName(action))
local actionType = action:GetType(action).value -- gameinputActionType
local actionValue = action:GetValue(action)
@psiberx
psiberx / init.lua
Last active February 24, 2021 12:43
Cyberpunk 2077: Sample mod to display HUD with current player location
local GameUI = require('GameUI') -- https://github.com/psiberx/cp2077-cet-kit/blob/main/GameUI.lua
local WhereAmI = {
visible = false,
districtId = nil,
districtLabels = nil,
districtCaption = nil,
factionLabels = nil,
}
@psiberx
psiberx / init.lua
Last active February 22, 2021 09:51
Cyberpunk 2077: Sample mod to create custom map pins
--[[
Place a map pin at the player's current position: [shared credits with @b0kkr]
]]
registerHotkey('PlaceCustomMapPin', 'Place a map pin at player\'s position', function()
local mappinData = NewObject('gamemappinsMappinData')
mappinData.mappinType = TweakDBID.new('Mappins.DefaultStaticMappin')
mappinData.variant = Enum.new('gamedataMappinVariant', 'FastTravelVariant')
mappinData.visibleThroughWalls = true
@psiberx
psiberx / init.lua
Last active February 22, 2021 09:38
Cyberpunk 2077: Sample mod that fixes Dead-Eye clothing mod
--[[
After the fix is applied you need to reequip clothing item with Dead-Eye installed
]]
registerForEvent('onInit', function()
local deadEyeTweakDbId = TweakDBID.new('Items.PowerfulFabricEnhancer08')
local deadEyeOnAttach = TweakDB:GetFlat(TweakDBID.new(deadEyeTweakDbId, '.OnAttach'))
-- Check if Dead-Eye is broken
if #deadEyeOnAttach == 0 then
@psiberx
psiberx / init.lua
Last active January 14, 2024 19:55
Cyberpunk 2077: Sample mod for summoning any vehicle
-- With instant summon mode enabled you can control the position of the spawn (it spawns in front of the player)
-- Otherwise the game can spawn a vehicle right in the spot of another one (collision fun yee)
-- You cannot spawn the same vehicle twice (same TweakDBID) with Vehicle System
-- The list of the summonable vehicles
local targetVehicles = {
'Vehicle.v_standard2_archer_hella_police',
'Vehicle.v_standard2_villefort_cortes_police',
'Vehicle.v_standard3_chevalier_emperor_police',
'Vehicle.v_standard2_archer_hella_player',
@psiberx
psiberx / streets.lua
Last active February 22, 2021 09:36
Cyberpunk 2077: The list of all streets with respective districts and subdistricts
return [
{ streetName = "101 - New Pacific Highway", districtName = "Badlands", subDistrictName = "", streetPath = "Badlands.Street101NewPacificHighway", districtPath = "Districts.Badlands", subDistrictPath = "", },
{ streetName = "Armstrong Way", districtName = "Badlands", subDistrictName = "", streetPath = "Badlands.ArmstrongWay", districtPath = "Districts.Badlands", subDistrictPath = "", },
{ streetName = "Arroyo", districtName = "Badlands", subDistrictName = "", streetPath = "Badlands.Arroyo", districtPath = "Districts.Badlands", subDistrictPath = "", },
{ streetName = "Bridge", districtName = "Badlands", subDistrictName = "", streetPath = "Badlands.BridgeSt", districtPath = "Districts.Badlands", subDistrictPath = "", },
{ streetName = "Clements", districtName = "Badlands", subDistrictName = "", streetPath = "Badlands.ClementsSt", districtPath = "Districts.Badlands", subDistrictPath = "", },
{ streetName = "Coachwhip Lane", districtName = "Badlands", subDistrictName = "", streetPath = "Badlands.Coac