Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #8 from Khalmee/main
Browse files Browse the repository at this point in the history
Added HoloTracker compatibility
  • Loading branch information
Legonzaur authored Mar 3, 2023
2 parents 125296a + ab88a1e commit a3aa798
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 4 deletions.
4 changes: 4 additions & 0 deletions keyvalues/scripts/weapons/mp_ability_holopilot.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,9 @@ WeaponData
"ammo_stockpile_max" "300"
"regen_ammo_refill_rate" "*1.5"
}
mode_holoshift
{
"hud_icon" "rui/menu/boosts/boost_icon_holopilot"
}
}
}
15 changes: 11 additions & 4 deletions mod.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
{
"Name": "Legonzaur.HoloShift",
"Description": "Swap positions with your beloved decoy",
"Version": "1.0.8",
"Description": "Swap positions with your beloved decoy. Compatible with HoloTracker.",
"Version": "1.0.9",
"LoadPriority": 2,
"Scripts": [
{
"Path": "holoshift_recharge.gnut",
"RunOn": "MP",
"ServerCallback": {
"After": "HoloShift_Init"
}
}
},
},
{
"Path": "HolopilotIconChange.nut",
"RunOn": "MP",
"ServerCallback": {
"After": "HolopilotIconChangeInit"
},
}
]
}
26 changes: 26 additions & 0 deletions mod/scripts/vscripts/HolopilotIconChange.nut
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
untyped
global function HolopilotIconChangeInit


void function HolopilotIconChangeInit()
{
#if SERVER
AddCallback_OnPlayerRespawned( HolopilotIconChange )
//AddCallback_PlayerClassChanged( HolopilotIconChange )
//AddCallback_OnPlayerLifeStateChanged( HolopilotIconChange )
#endif
}

#if SERVER

void function HolopilotIconChange(entity player){
//void function HolopilotIconChange(entity player, int oldState, int newState){
Assert( IsAlive( player ) )
if(player.GetOffhandWeapons().len() > 1 && player.GetOffhandWeapons()[1].GetWeaponClassName() == "mp_ability_holopilot"){
array <string> offhandMods = player.GetOffhandWeapons()[1].GetMods()
offhandMods.append("mode_holoshift")
player.GetOffhandWeapons()[1].SetMods(offhandMods)
}

}
#endif
9 changes: 9 additions & 0 deletions mod/scripts/vscripts/weapons/mp_ability_holopilot.nut
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ void function CleanupExistingDecoy( entity decoy )
{
if ( IsValid( decoy ) ) //This cleanup function is called from multiple places, so check that decoy is still valid before we try to clean it up again
{
//COMMUNICATION WITH HOLOTRACKER
int eHandle = decoy.GetEncodedEHandle()
ServerToClientStringCommand( decoy.GetBossPlayer(), "StopDecoyTracking " + eHandle.tostring())
//END OF COMMUNICATION
decoy.Decoy_Dissolve()
CleanupFXAndSoundsForDecoy( decoy )
}
Expand Down Expand Up @@ -158,6 +162,11 @@ var function OnWeaponPrimaryAttack_holopilot( entity weapon, WeaponPrimaryAttack
}else{
entity decoy = CreateHoloPilotDecoys( weaponOwner, 1 )
playerDecoyList[ weaponOwner ] <- decoy

//COMMUNICATION WITH HOLOTRACKER
int eHandle = decoy.GetEncodedEHandle()
ServerToClientStringCommand( weaponOwner, "ActivateDecoyTracking " + eHandle.tostring())
//END OF COMMUNICATION
}
#else
Rumble_Play( "rumble_holopilot_activate", {} )
Expand Down

0 comments on commit a3aa798

Please sign in to comment.