Added HoloTracker compatibility

This commit is contained in:
Khalmee
2023-03-02 21:12:23 +01:00
parent 125296a37e
commit ab88a1edd7
4 changed files with 50 additions and 4 deletions
@@ -32,5 +32,9 @@ WeaponData
"ammo_stockpile_max" "300" "ammo_stockpile_max" "300"
"regen_ammo_refill_rate" "*1.5" "regen_ammo_refill_rate" "*1.5"
} }
mode_holoshift
{
"hud_icon" "rui/menu/boosts/boost_icon_holopilot"
}
} }
} }
+10 -3
View File
@@ -1,7 +1,7 @@
{ {
"Name": "Legonzaur.HoloShift", "Name": "Legonzaur.HoloShift",
"Description": "Swap positions with your beloved decoy", "Description": "Swap positions with your beloved decoy. Compatible with HoloTracker.",
"Version": "1.0.8", "Version": "1.0.9",
"LoadPriority": 2, "LoadPriority": 2,
"Scripts": [ "Scripts": [
{ {
@@ -9,7 +9,14 @@
"RunOn": "MP", "RunOn": "MP",
"ServerCallback": { "ServerCallback": {
"After": "HoloShift_Init" "After": "HoloShift_Init"
} },
},
{
"Path": "HolopilotIconChange.nut",
"RunOn": "MP",
"ServerCallback": {
"After": "HolopilotIconChangeInit"
},
} }
] ]
} }
@@ -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
@@ -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 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() decoy.Decoy_Dissolve()
CleanupFXAndSoundsForDecoy( decoy ) CleanupFXAndSoundsForDecoy( decoy )
} }
@@ -158,6 +162,11 @@ var function OnWeaponPrimaryAttack_holopilot( entity weapon, WeaponPrimaryAttack
}else{ }else{
entity decoy = CreateHoloPilotDecoys( weaponOwner, 1 ) entity decoy = CreateHoloPilotDecoys( weaponOwner, 1 )
playerDecoyList[ weaponOwner ] <- decoy playerDecoyList[ weaponOwner ] <- decoy
//COMMUNICATION WITH HOLOTRACKER
int eHandle = decoy.GetEncodedEHandle()
ServerToClientStringCommand( weaponOwner, "ActivateDecoyTracking " + eHandle.tostring())
//END OF COMMUNICATION
} }
#else #else
Rumble_Play( "rumble_holopilot_activate", {} ) Rumble_Play( "rumble_holopilot_activate", {} )