From dae4a32f1c4b0f04a50fa462d00ce6ebee92b2ee Mon Sep 17 00:00:00 2001 From: JMM889901 <41163714+JMM889901@users.noreply.github.com> Date: Sat, 22 Oct 2022 03:43:16 +0100 Subject: Halfway decent fix to allow changing of minimap size and zoom midgame (#265) * Add files via upload * Added Getter functions * typo lol * Update cl_minimap.gnut * Mode select updated RegisterPlaylistBannerImage and GetPlaylistBannerImage had initially been in another file but that file is not present in r2northstar/client, not much point adding the entirety of menu_playlist here since for a few lines, this also wont modify mixtape but i don't think mixtape menu is used anywhere in northstar * Added rui since basic image cant handle callsigns added ``` NextModeImageCallsign //For calling card icons { ControlName RuiPanel // xpos -12 ypos -12 wide 480 tall 240 visible 1 scaleImage 1 zpos 2 pin_to_sibling NextModeImageFrame pin_corner_to_sibling BOTTOM pin_to_sibling_corner BOTTOM rui "ui/callsign_icon_button.rpak" //For callsign mode images } ``` * Revert "Added rui since basic image cant handle callsigns" This reverts commit b2623ec41ca944fc0ac3386ae0346464da07a8b3. * Revert "Mode select updated" This reverts commit 2c6f430775c84ef252402b6b447b01fd394459a9. --- .../mod/scripts/vscripts/client/cl_minimap.gnut | 942 +++++++++++++++++++++ 1 file changed, 942 insertions(+) create mode 100644 Northstar.Client/mod/scripts/vscripts/client/cl_minimap.gnut (limited to 'Northstar.Client') diff --git a/Northstar.Client/mod/scripts/vscripts/client/cl_minimap.gnut b/Northstar.Client/mod/scripts/vscripts/client/cl_minimap.gnut new file mode 100644 index 00000000..4237a0be --- /dev/null +++ b/Northstar.Client/mod/scripts/vscripts/client/cl_minimap.gnut @@ -0,0 +1,942 @@ +global function ClMinimap_Init + +global function ClientCodeCallback_MinimapEntitySpawned + +global function Minimap_AddLayer +global function Minimap_AddCustomLayer + +global function RegisterMinimapPackage + +global function Minimap_SetZoomScale +global function Minimap_SetSizeScale +global function Minimap_GetZoomScale +global function Minimap_GetSizeScale +global function Minimap_IsUsingLargeMinimap + +global function Minimap_Ping +global function ServerCallback_PingMinimap + +global function Minimap_EnableDraw +global function Minimap_DisableDraw + +#if DEV +global function DumpMinimapHandles +#endif + +struct { + var minimap_base + var minimap_wedges + + int activeMinimapObjectCount + + var minimap_you + var minimap_jammed_layer + + var minimap_indicator + + #if DEV + table< int, entity > minimapHandles + #endif + + array minimapOtherRuis + + float threatMaxDist + + float minimapZoomScale = 1 + float minimapSizeScale = 1 + + bool minimapEnabled = true +} file + + +struct MinmapPackage +{ + asset minimapAsset = $"" + void functionref( entity, var ) initFunction +} + +table< string, array > minimapAssetMap = {} + +const int OF_IS_VISIBLE = 1 << 0 +const int OF_TEAM_SAME = 1 << 1 +const int OF_TEAM_ENEMY = 1 << 2 +const int OF_IN_OUR_PARTY = 1 << 3 +const int OF_IS_OWNED_BY_US = 1 << 4 +const int OF_IS_PLAYER = 1 << 5 +const int OF_IS_NPC = 1 << 6 +const int OF_IS_TITAN = 1 << 7 +const int OF_ORIENT_UP = 1 << 8 +const int OF_NO_TEAM_COLOR = 1 << 9 + + +void function RegisterMinimapPackage( string entityClassname, int customStateIndex, asset minimapAsset, void functionref( entity, var ) initFunction ) +{ + Assert ( (entityClassname in minimapAssetMap), "minimap is not currently setup to handle this type of entity: " + entityClassname ) + + MinmapPackage minimapPackage + minimapPackage.minimapAsset = minimapAsset + minimapPackage.initFunction = initFunction + + switch ( entityClassname ) + { + case "npc_soldier": + case "npc_spectre": + case "npc_stalker": + case "npc_drone": + case "npc_frag_drone": + case "npc_super_spectre": + case "npc_turret_sentry": + Assert( customStateIndex > 0 && customStateIndex < eMinimapObject_npc.COUNT ) + minimapAssetMap[entityClassname].resize( eMinimapObject_npc.COUNT ) + minimapAssetMap[entityClassname][customStateIndex] = minimapPackage + break + case "npc_titan": + Assert( customStateIndex > 0 && customStateIndex < eMinimapObject_npc_titan.COUNT ) + minimapAssetMap[entityClassname].resize( eMinimapObject_npc_titan.COUNT ) + minimapAssetMap[entityClassname][customStateIndex] = minimapPackage + break + + case "prop_script": + Assert( customStateIndex > 0 && customStateIndex < eMinimapObject_prop_script.COUNT ) + minimapAssetMap[entityClassname].resize( eMinimapObject_prop_script.COUNT ) + minimapAssetMap[entityClassname][customStateIndex] = minimapPackage + break + + case "info_hardpoint": + Assert( customStateIndex > 0 && customStateIndex < eMinimapObject_info_hardpoint.COUNT ) + minimapAssetMap[entityClassname].resize( eMinimapObject_info_hardpoint.COUNT ) + minimapAssetMap[entityClassname][customStateIndex] = minimapPackage + break + + default: + Assert( false, "minimap is not currently setup to handle this type of entity: " + entityClassname ) + } +} + +void function RegisterDefaultMinimapPackage( string entityClassname, asset minimapAsset, void functionref( entity, var ) initFunction ) +{ + Assert ( !(entityClassname in minimapAssetMap) ) + + MinmapPackage minimapPackage + minimapPackage.minimapAsset = minimapAsset + minimapPackage.initFunction = initFunction + + minimapAssetMap[entityClassname] <- [minimapPackage] +} + +void function ClMinimap_Init() +{ + RegisterDefaultMinimapPackage( "player", $"ui/minimap_player.rpak", MinimapPackage_PlayerInit ) + RegisterDefaultMinimapPackage( "npc_titan", $"ui/minimap_object.rpak", MinimapPackage_NPCTitanInit ) + RegisterDefaultMinimapPackage( "npc_soldier", $"ui/minimap_object.rpak", MinimapPackage_NPCHumanSizedInit ) + RegisterDefaultMinimapPackage( "npc_spectre", $"ui/minimap_object.rpak", MinimapPackage_NPCHumanSizedInit ) + RegisterDefaultMinimapPackage( "npc_stalker", $"ui/minimap_object.rpak", MinimapPackage_NPCHumanSizedInit ) + RegisterDefaultMinimapPackage( "npc_super_spectre", $"ui/minimap_object.rpak", MinimapPackage_NPCHumanSizedInit ) + RegisterDefaultMinimapPackage( "npc_drone_rocket", $"ui/minimap_object.rpak", MinimapPackage_NPCHumanSizedInit ) + RegisterDefaultMinimapPackage( "npc_frag_drone", $"ui/minimap_object.rpak", MinimapPackage_NPCHumanSizedInit ) + RegisterDefaultMinimapPackage( "npc_drone", $"ui/minimap_object.rpak", MinimapPackage_NPCHumanSizedInit ) + RegisterDefaultMinimapPackage( "npc_dropship", $"ui/minimap_object.rpak", MinimapPackage_NPCDropShipInit ) + RegisterDefaultMinimapPackage( "npc_turret_sentry", $"ui/minimap_object.rpak", MinimapPackage_NPCSentryTurretInit ) + RegisterDefaultMinimapPackage( "prop_script", $"", MinimapPackage_DummyInit ) + RegisterDefaultMinimapPackage( "item_titan_battery", $"ui/minimap_fw_battery.rpak", MinimapPackage_BatteryInit ) + RegisterDefaultMinimapPackage( "item_flag", $"ui/minimap_object.rpak", MinimapPackage_FlagInit ) + RegisterDefaultMinimapPackage( "item_bomb", $"ui/minimap_object.rpak", MinimapPackage_LTSBomb ) + RegisterDefaultMinimapPackage( "info_hardpoint", $"", MinimapPackage_DummyInit ) + RegisterDefaultMinimapPackage( "item_powerup", $"ui/minimap_object.rpak", MinimapPackage_PowerUp ) + + RegisterMinimapPackage( "npc_titan", eMinimapObject_npc_titan.AT_BOUNTY_BOSS, $"ui/minimap_object.rpak", MinimapPackage_BossTitanInit ) + + RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.AT_DROPZONE_A, $"ui/minimap_obj_area.rpak", MinimapPackage_ATAreaInit ) + RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.AT_DROPZONE_B, $"ui/minimap_obj_area.rpak", MinimapPackage_ATAreaInit ) + RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.AT_DROPZONE_C, $"ui/minimap_obj_area.rpak", MinimapPackage_ATAreaInit ) + RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.AT_BANK, $"ui/minimap_object.rpak", MinimapPackage_ATBank ) + RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.FW_BUILDSITE, $"ui/minimap_fw_build_site.rpak", MinimapPackage_FWBuildSite ) + RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.FW_BUILDSITE_TURRET, $"ui/minimap_fw_build_site.rpak", MinimapPackage_FWBuildSite ) + RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.FW_BUILDSITE_SHIELDED, $"ui/minimap_fw_build_site.rpak", MinimapPackage_FWBuildSite ) + RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.FD_HARVESTER, $"ui/minimap_obj_area.rpak", MinimapPackage_FDHarvester ) + RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.FD_LOADOUT_CHEST, $"ui/minimap_obj_area.rpak", MinimapPackage_FDLoadoutChest ) + RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.FD_BATTERY_EXCHANGE, $"ui/minimap_obj_area.rpak", MinimapPackage_FDBatteryExchange ) + RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.BOOST_STORE, $"ui/minimap_obj_area.rpak", MinimapPackage_BoostStore ) + RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.FD_MORTAR_POSITION, $"ui/minimap_mortar_spectre.rpak", MinimapPackage_MortarPosition ) + RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.ARC_TRAP, $"ui/minimap_obj_area.rpak", MinimapPackage_ArcTrap ) + + //RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.FW_CAMP_A, $"ui/minimap_fw_camp.rpak", MinimapPackage_FWCampA ) + //RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.FW_CAMP_B, $"ui/minimap_fw_camp.rpak", MinimapPackage_FWCampB ) + //RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.FW_CAMP_C, $"ui/minimap_fw_camp.rpak", MinimapPackage_FWCampC ) + + RegisterMinimapPackage( "info_hardpoint", eMinimapObject_info_hardpoint.HARDPOINT_A, $"ui/minimap_obj_area.rpak", MinimapPackage_HardpointA ) + RegisterMinimapPackage( "info_hardpoint", eMinimapObject_info_hardpoint.HARDPOINT_B, $"ui/minimap_obj_area.rpak", MinimapPackage_HardpointB ) + RegisterMinimapPackage( "info_hardpoint", eMinimapObject_info_hardpoint.HARDPOINT_C, $"ui/minimap_obj_area.rpak", MinimapPackage_HardpointC ) + + //if ( IsPlayingDemo() ) + { + RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.SPAWNZONE_IMC, $"ui/minimap_obj_area.rpak", MinimapPackage_SpawnZoneAreaInit ) + RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.SPAWNZONE_MIL, $"ui/minimap_obj_area.rpak", MinimapPackage_SpawnZoneAreaInit ) + } + //else + //{ + // RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.SPAWNZONE_IMC, $"", MinimapPackage_SpawnZoneAreaInit ) + // RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.SPAWNZONE_MIL, $"", MinimapPackage_SpawnZoneAreaInit ) + //} + RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.LTS_SITE_A, $"ui/minimap_object.rpak", MinimapPackage_LTSBombSiteA ) + RegisterMinimapPackage( "prop_script", eMinimapObject_prop_script.LTS_SITE_B, $"ui/minimap_object.rpak", MinimapPackage_LTSBombSiteB ) + /* + { + MinmapPackage atAreaPacakage + atAreaPacakage.minimapAsset = $"ui/minimap_obj_area.rpak" + atAreaPacakage.initFunction = MinimapPackage_ATAreaInit + MinmapPackage spawnZonePacakage + spawnZonePacakage.minimapAsset = $"ui/minimap_obj_area.rpak" + spawnZonePacakage.initFunction = MinimapPackage_SpawnZoneAreaInit + MinmapPackage fwBuildSitePackage + fwBuildSitePackage.minimapAsset = $"ui/minimap_fw_build_site.rpak" + fwBuildSitePackage.initFunction = MinimapPackage_FWBuildSite + MinmapPackage fwCampAPackage + fwCampAPackage.minimapAsset = $"ui/minimap_fw_camp.rpak" + fwCampAPackage.initFunction = MinimapPackage_FWCampA + MinmapPackage fwCampBPackage + fwCampBPackage.minimapAsset = $"ui/minimap_fw_camp.rpak" + fwCampBPackage.initFunction = MinimapPackage_FWCampB + MinmapPackage fwCampCPackage + fwCampCPackage.minimapAsset = $"ui/minimap_fw_camp.rpak" + fwCampCPackage.initFunction = MinimapPackage_FWCampC + minimapAssetMap["prop_script"] <-[blankPackage, atAreaPacakage, atAreaPacakage, atAreaPacakage, spawnZonePacakage, spawnZonePacakage, + fwCampAPackage, fwCampBPackage, fwCampCPackage, + fwBuildSitePackage, fwBuildSitePackage, fwBuildSitePackage ] + } +*/ + + AddCreateCallback( "player", OnPlayerCreate ) + + float threatMaxDist = Minimap_GetFloatForKey( "threatMaxDist" ) + float threatDistNear = Minimap_GetFloatForKey( "threatNearDist" ) + float threatDistFar = Minimap_GetFloatForKey( "threatFarDist" ) + + if ( GameRules_GetGameMode() == FORT_WAR ) + file.threatMaxDist = max( threatMaxDist, 2200 ) + else + file.threatMaxDist = max( threatMaxDist, 1800 ) + + file.minimap_base = CreateCockpitRui( $"ui/minimap_base.rpak", MINIMAP_Z_BASE ) + + RuiSetFloat( file.minimap_base, "minimapZoomScale", file.minimapZoomScale ) + RuiSetFloat( file.minimap_base, "minimapSizeScale", file.minimapSizeScale ) + + file.minimap_wedges = CreateCockpitRui( $"ui/minimap_wedges.rpak", MINIMAP_Z_THREAT_WEDGES ) + + RuiSetFloat( file.minimap_wedges, "minimapZoomScale", file.minimapZoomScale ) + RuiSetFloat( file.minimap_wedges, "minimapSizeScale", file.minimapSizeScale ) + RuiSetBool( file.minimap_wedges, "isVisible", file.minimapZoomScale == 1.0 ) + + file.minimap_you = CreateCockpitRui( $"ui/minimap_you.rpak", MINIMAP_Z_YOU ) + + RuiSetFloat( file.minimap_you, "minimapZoomScale", file.minimapZoomScale ) + RuiSetFloat( file.minimap_you, "minimapSizeScale", file.minimapSizeScale ) + + file.minimap_jammed_layer = null + + file.minimap_indicator = CreateCockpitRui( $"ui/minimap_indicator.rpak", -1 ) + + RuiSetFloat( file.minimap_indicator, "minimapZoomScale", file.minimapZoomScale ) + RuiSetFloat( file.minimap_indicator, "minimapSizeScale", file.minimapSizeScale ) + + StatusEffect_RegisterEnabledCallback( eStatusEffect.minimap_jammed, MinimapJammed_Enabled ) + StatusEffect_RegisterDisabledCallback( eStatusEffect.minimap_jammed, MinimapJammed_Disabled ) + RegisterSignal( "LoopRadarJammerSounds" ) +} + +#if DEV +void function DumpMinimapHandles() +{ + int index = 0 + foreach ( handle, ent in file.minimapHandles ) + { + printt( index, handle, ent ) + ++index + } +} +#endif + + +void function Minimap_DisableDraw() +{ + file.minimapEnabled = false + + RuiSetDrawGroup( file.minimap_base, RUI_DRAW_NONE ) + RuiSetDrawGroup( file.minimap_wedges, RUI_DRAW_NONE ) + RuiSetDrawGroup( file.minimap_you, RUI_DRAW_NONE ) + RuiSetDrawGroup( file.minimap_indicator, RUI_DRAW_NONE ) + + foreach ( var rui in file.minimapOtherRuis ) + { + RuiSetDrawGroup( rui, RUI_DRAW_NONE ) + } +} + +void function Minimap_EnableDraw() +{ + file.minimapEnabled = true + + RuiSetDrawGroup( file.minimap_base, RUI_DRAW_COCKPIT ) + RuiSetDrawGroup( file.minimap_wedges, RUI_DRAW_COCKPIT ) + RuiSetDrawGroup( file.minimap_you, RUI_DRAW_COCKPIT ) + RuiSetDrawGroup( file.minimap_indicator, RUI_DRAW_COCKPIT ) + + foreach ( var rui in file.minimapOtherRuis ) + { + RuiSetDrawGroup( rui, RUI_DRAW_COCKPIT ) + } +} + + +void function ClientCodeCallback_MinimapEntitySpawned( entity ent ) +{ + foreach ( callbackFunc in clGlobal.onMinimapEntSpawnedCallbacks ) + { + callbackFunc( ent ) + } + + if ( ent == GetLocalViewPlayer() ) + return + + thread AddMinimapObject( ent ) +} + + +asset function GetMinimapAsset( string className, int customState ) +{ + if ( !(className in minimapAssetMap) ) + return $"" + + if ( customState > minimapAssetMap[className].len() - 1 ) + return $"" + + return minimapAssetMap[className][customState].minimapAsset +} + + +void function AddMinimapObject( entity ent ) //TODO: If we want radar jammer boost to hide friendly players we need to be able to get the rui handles back. +{ + Assert( IsValid( ent ) ) + + string className = expect string( ent.GetSignifierName() ) + int customState = ent.Minimap_GetCustomState() + + asset minimapAsset = GetMinimapAsset( className, customState ) + if ( minimapAsset == $"" ) + { + return + } + + int zOrder = ent.Minimap_GetZOrder() + entity viewPlayer = GetLocalViewPlayer() + + ent.SetDoDestroyCallback( true ) + + #if DEV + int eHandle = ent.Dev_GetEncodedEHandle() + + { + array< int > eHandlesToRemove + foreach ( eHandleIter, entIter in file.minimapHandles ) + { + if ( !IsValid( entIter ) ) + { + eHandlesToRemove.append( eHandleIter ) + } + } + + foreach ( eHandleIter in eHandlesToRemove ) + { + delete file.minimapHandles[eHandleIter] + } + } + + if ( eHandle in file.minimapHandles ) + { + // Should have been removed in above loop + Assert( IsValid( file.minimapHandles[eHandle] ) ) + + DumpMinimapHandles() + Assert( false, "Duplicate minimap entity added - " + ent ) + } + + file.minimapHandles[eHandle] <- ent + #endif + + var rui = CreateCockpitRui( minimapAsset, MINIMAP_Z_BASE + zOrder ) + + //RuiTrackGameTime( rui, "lastFireTime", ent, RUI_TRACK_LAST_FIRED_TIME ) + + RuiTrackFloat3( rui, "playerPos", viewPlayer, RUI_TRACK_ABSORIGIN_FOLLOW ) + RuiTrackFloat3( rui, "playerAngles", viewPlayer, RUI_TRACK_EYEANGLES_FOLLOW ) + + RuiTrackFloat3( rui, "objectPos", ent, RUI_TRACK_ABSORIGIN_FOLLOW ) + RuiTrackFloat3( rui, "objectAngles", ent, RUI_TRACK_EYEANGLES_FOLLOW ) + RuiTrackInt( rui, "objectFlags", ent, RUI_TRACK_MINIMAP_FLAGS ) + RuiTrackInt( rui, "customState", ent, RUI_TRACK_MINIMAP_CUSTOM_STATE ) + RuiSetFloat( rui, "displayDist", file.threatMaxDist ) + RuiSetFloat( rui, "minimapZoomScale", file.minimapZoomScale ) + RuiSetFloat( rui, "minimapSizeScale", file.minimapSizeScale ) + + minimapAssetMap[className][customState].initFunction( ent, rui ) + + file.minimapOtherRuis.append( rui ) + + RuiSetDrawGroup( rui, file.minimapEnabled ? RUI_DRAW_COCKPIT : RUI_DRAW_NONE ) + OnThreadEnd( + function() : ( rui ) + { + file.minimapOtherRuis.removebyvalue( rui ) + RuiDestroy( rui ) + } + ) + + ent.EndSignal( "OnDestroy" ) + + if ( ent.IsPlayer() ) + { + while ( IsValid( ent ) ) + { + WaitSignal( ent, "SettingsChanged", "OnDeath" ) + } + } + else + { + ent.WaitSignal( "OnDestroy" ) + } +} + + +void function Minimap_PingCount( vector origin, float radius, float duration, vector color, int count, bool reverse = false ) +{ + float delay = duration / count + + while ( count ) + { + count-- + + Minimap_Ping( origin, radius, delay + (delay * 0.25), color, reverse ) + wait delay + } +} + + +void function Minimap_Ping( vector origin, float radius, float duration, vector color, bool reverse = false ) +{ + entity viewPlayer = GetLocalViewPlayer() + int zOrder = viewPlayer.Minimap_GetZOrder() + + if ( !file.minimapEnabled ) + return + + var rui = CreateCockpitRui( $"ui/minimap_ping.rpak", MINIMAP_Z_BASE + zOrder ) + + RuiTrackFloat3( rui, "playerPos", viewPlayer, RUI_TRACK_ABSORIGIN_FOLLOW ) + RuiTrackFloat3( rui, "playerAngles", viewPlayer, RUI_TRACK_EYEANGLES_FOLLOW ) + + RuiSetFloat3( rui, "objColor", color ) + RuiSetFloat3( rui, "objectPos", origin ) + RuiSetFloat3( rui, "objectAngles", <0,0,0> ) + + RuiSetFloat( rui, "objectRadius", radius / ( file.threatMaxDist * file.minimapZoomScale ) ) + + RuiSetFloat( rui, "displayDist", file.threatMaxDist ) + RuiSetFloat( rui, "minimapZoomScale", file.minimapZoomScale ) + RuiSetFloat( rui, "minimapSizeScale", file.minimapSizeScale ) + + RuiSetGameTime( rui, "startTime", Time() ) + RuiSetGameTime( rui, "endTime", Time() + duration ) + + RuiSetBool( rui, "reverse", reverse ) +} + + + +var function Minimap_AddLayer( asset layerImage, bool isFriendly ) +{ + entity player = GetLocalViewPlayer() + + var rui = CreateCockpitRui( $"ui/minimap_layer.rpak", MINIMAP_Z_LAYER ) + + RuiTrackFloat3( rui, "playerPos", player, RUI_TRACK_ABSORIGIN_FOLLOW ) + RuiTrackFloat3( rui, "playerAngles", player, RUI_TRACK_EYEANGLES_FOLLOW ) + + asset mapImage = Minimap_GetAssetForKey( "minimap" ) + float mapCornerX = Minimap_GetFloatForKey( "pos_x" ) + float mapCornerY = Minimap_GetFloatForKey( "pos_y" ) + float displayDist = Minimap_GetFloatForKey( "displayDist" ) + float threatDistNear = Minimap_GetFloatForKey( "threatNearDist" ) + float threatDistFar = Minimap_GetFloatForKey( "threatFarDist" ) + + float mapScale = Minimap_GetFloatForKey( "scale" ) + + RuiSetImage( rui, "layerImage", layerImage ) + RuiSetFloat3( rui, "mapCorner", ) + RuiSetFloat( rui, "displayDist", file.threatMaxDist ) + RuiSetFloat( rui, "mapScale", mapScale ) + RuiSetFloat( rui, "minimapZoomScale", file.minimapZoomScale ) + RuiSetFloat( rui, "minimapSizeScale", file.minimapSizeScale ) + + RuiSetBool( rui, "isFriendly", isFriendly ) + + return rui +} + +var function Minimap_AddCustomLayer( asset ruiAsset, int sortKey = MINIMAP_Z_LAYER ) +{ + entity player = GetLocalViewPlayer() + + var rui = CreateCockpitRui( ruiAsset, sortKey ) + + RuiTrackFloat3( rui, "playerPos", player, RUI_TRACK_ABSORIGIN_FOLLOW ) + RuiTrackFloat3( rui, "playerAngles", player, RUI_TRACK_EYEANGLES_FOLLOW ) + + asset mapImage = Minimap_GetAssetForKey( "minimap" ) + float mapCornerX = Minimap_GetFloatForKey( "pos_x" ) + float mapCornerY = Minimap_GetFloatForKey( "pos_y" ) + float displayDist = Minimap_GetFloatForKey( "displayDist" ) + float threatDistNear = Minimap_GetFloatForKey( "threatNearDist" ) + float threatDistFar = Minimap_GetFloatForKey( "threatFarDist" ) + + float mapScale = Minimap_GetFloatForKey( "scale" ) + + RuiSetFloat3( rui, "mapCorner", ) + RuiSetFloat( rui, "displayDist", file.threatMaxDist ) + RuiSetFloat( rui, "mapScale", mapScale ) + RuiSetFloat( rui, "minimapZoomScale", file.minimapZoomScale ) + RuiSetFloat( rui, "minimapSizeScale", file.minimapSizeScale ) + + return rui +} + + +void function OnPlayerCreate( entity player ) +{ + if ( player != GetLocalViewPlayer() ) + return + + RuiTrackFloat3( file.minimap_base, "playerPos", player, RUI_TRACK_ABSORIGIN_FOLLOW ) + RuiTrackFloat3( file.minimap_base, "playerAngles", player, RUI_TRACK_EYEANGLES_FOLLOW ) + + RuiTrackInt( file.minimap_indicator, "indicatorId", player, RUI_TRACK_SCRIPT_NETWORK_VAR_INT, GetNetworkedVariableIndex( "indicatorId" ) ) + + asset mapImage = Minimap_GetAssetForKey( "minimap" ) + float mapCornerX = Minimap_GetFloatForKey( "pos_x" ) + float mapCornerY = Minimap_GetFloatForKey( "pos_y" ) + float displayDist = Minimap_GetFloatForKey( "displayDist" ) + float threatDistNear = Minimap_GetFloatForKey( "threatNearDist" ) + float threatDistFar = Minimap_GetFloatForKey( "threatFarDist" ) + + float mapScale = Minimap_GetFloatForKey( "scale" ) + + RuiSetImage( file.minimap_base, "mapImage", mapImage ) + RuiSetFloat3( file.minimap_base, "mapCorner", ) + RuiSetFloat( file.minimap_base, "displayDist", file.threatMaxDist ) + RuiSetFloat( file.minimap_base, "mapScale", mapScale ) + + RuiTrackFloat3( file.minimap_wedges, "playerPos", player, RUI_TRACK_ABSORIGIN_FOLLOW ) + RuiTrackFloat3( file.minimap_wedges, "playerAngles", player, RUI_TRACK_EYEANGLES_FOLLOW ) + RuiSetFloat3( file.minimap_wedges, "distances", ) + RuiSetBool( file.minimap_wedges, "isVisible", file.minimapZoomScale == 1.0 ) + + RuiTrackGameTime( file.minimap_wedges, "lastFireTimeCenter", player, RUI_TRACK_MINIMAP_THREAT_SECTOR, MOTS_CENTER ) + + RuiTrackGameTime( file.minimap_wedges, "lastFireTimeMid0", player, RUI_TRACK_MINIMAP_THREAT_SECTOR, MOTS_NEAR_N ) + RuiTrackGameTime( file.minimap_wedges, "lastFireTimeMid1", player, RUI_TRACK_MINIMAP_THREAT_SECTOR, MOTS_NEAR_NE ) + RuiTrackGameTime( file.minimap_wedges, "lastFireTimeMid2", player, RUI_TRACK_MINIMAP_THREAT_SECTOR, MOTS_NEAR_E ) + RuiTrackGameTime( file.minimap_wedges, "lastFireTimeMid3", player, RUI_TRACK_MINIMAP_THREAT_SECTOR, MOTS_NEAR_SE ) + RuiTrackGameTime( file.minimap_wedges, "lastFireTimeMid4", player, RUI_TRACK_MINIMAP_THREAT_SECTOR, MOTS_NEAR_S ) + RuiTrackGameTime( file.minimap_wedges, "lastFireTimeMid5", player, RUI_TRACK_MINIMAP_THREAT_SECTOR, MOTS_NEAR_SW ) + RuiTrackGameTime( file.minimap_wedges, "lastFireTimeMid6", player, RUI_TRACK_MINIMAP_THREAT_SECTOR, MOTS_NEAR_W ) + RuiTrackGameTime( file.minimap_wedges, "lastFireTimeMid7", player, RUI_TRACK_MINIMAP_THREAT_SECTOR, MOTS_NEAR_NW ) + + RuiTrackGameTime( file.minimap_wedges, "lastFireTimeOuter0", player, RUI_TRACK_MINIMAP_THREAT_SECTOR, MOTS_FAR_N ) + RuiTrackGameTime( file.minimap_wedges, "lastFireTimeOuter1", player, RUI_TRACK_MINIMAP_THREAT_SECTOR, MOTS_FAR_NE ) + RuiTrackGameTime( file.minimap_wedges, "lastFireTimeOuter2", player, RUI_TRACK_MINIMAP_THREAT_SECTOR, MOTS_FAR_E ) + RuiTrackGameTime( file.minimap_wedges, "lastFireTimeOuter3", player, RUI_TRACK_MINIMAP_THREAT_SECTOR, MOTS_FAR_SE ) + RuiTrackGameTime( file.minimap_wedges, "lastFireTimeOuter4", player, RUI_TRACK_MINIMAP_THREAT_SECTOR, MOTS_FAR_S ) + RuiTrackGameTime( file.minimap_wedges, "lastFireTimeOuter5", player, RUI_TRACK_MINIMAP_THREAT_SECTOR, MOTS_FAR_SW ) + RuiTrackGameTime( file.minimap_wedges, "lastFireTimeOuter6", player, RUI_TRACK_MINIMAP_THREAT_SECTOR, MOTS_FAR_W ) + RuiTrackGameTime( file.minimap_wedges, "lastFireTimeOuter7", player, RUI_TRACK_MINIMAP_THREAT_SECTOR, MOTS_FAR_NW ) + + + RuiSetFloat( file.minimap_wedges, "minimapZoomScale", file.minimapZoomScale ) + RuiSetFloat( file.minimap_wedges, "minimapSizeScale", file.minimapSizeScale ) + + RuiSetFloat( file.minimap_base, "minimapZoomScale", file.minimapZoomScale ) + RuiSetFloat( file.minimap_base, "minimapSizeScale", file.minimapSizeScale ) + + RuiTrackInt( file.minimap_you, "objectFlags", player, RUI_TRACK_MINIMAP_FLAGS ) + RuiTrackInt( file.minimap_you, "customState", player, RUI_TRACK_MINIMAP_CUSTOM_STATE ) + +} + + +void function MinimapPackage_DummyInit( entity ent, var rui ) +{ + +} + +void function MinimapPackage_PlayerInit( entity ent, var rui ) +{ + RuiTrackGameTime( rui, "lastFireTime", ent, RUI_TRACK_LAST_FIRED_TIME ) + if ( !IsFFAGame() ) //JFS: Too much work to get FFA to work correctly with Minimap logic, so disabling it for FFA + { + RuiTrackFloat( rui, "sonarDetectedFrac", ent, RUI_TRACK_STATUS_EFFECT_SEVERITY, eStatusEffect.sonar_detected ) + RuiTrackFloat( rui, "maphackDetectedFrac", ent, RUI_TRACK_STATUS_EFFECT_SEVERITY, eStatusEffect.maphack_detected ) + } +} + +void function MinimapPackage_NPCTitanInit( entity ent, var rui ) +{ + entity player = GetLocalClientPlayer() + + RuiSetBool( rui, "useTeamColor", false ) + + RuiTrackGameTime( rui, "lastFireTime", ent, RUI_TRACK_LAST_FIRED_TIME ) + if ( !IsFFAGame() ) //JFS: Too much work to get FFA to work correctly with Minimap logic, so disabling it for FFA + RuiTrackFloat( rui, "sonarDetectedFrac", ent, RUI_TRACK_STATUS_EFFECT_SEVERITY, eStatusEffect.sonar_detected ) +} + +void function MinimapPackage_NPCHumanSizedInit( entity ent, var rui ) +{ + entity player = GetLocalClientPlayer() + + RuiSetImage( rui, "defaultIcon", $"rui/hud/minimap/compass_icon_small_dot" ) + RuiSetImage( rui, "clampedDefaultIcon", $"" ) + + //if ( ent == GetLocalClientPlayer().GetPetTitan() ) + //{ + // RuiSetBool( rui, "useTeamColor", false ) + // RuiSetFloat3( rui, "iconColor", TEAM_COLOR_YOU / 255.0 ) + //} + RuiTrackGameTime( rui, "lastFireTime", ent, RUI_TRACK_LAST_FIRED_TIME ) + //if ( !IsFFAGame() ) //JFS: Too much work to get FFA to work correctly with Minimap logic, so disabling it for FFA + // RuiTrackFloat( rui, "sonarDetectedFrac", ent, RUI_TRACK_STATUS_EFFECT_SEVERITY, eStatusEffect.sonar_detected ) +} + +void function MinimapPackage_NPCDropShipInit( entity ent, var rui ) +{ + RuiSetImage( rui, "defaultIcon", $"rui/hud/scoreboard/status_evac" ) +} + +void function MinimapPackage_NPCSentryTurretInit( entity ent, var rui ) +{ + RuiSetImage( rui, "defaultIcon", $"" ) + RuiSetImage( rui, "clampedDefaultIcon", $"" ) +} + +void function MinimapPackage_BossTitanInit( entity ent, var rui ) +{ + RuiSetImage( rui, "defaultIcon", $"rui/hud/gametype_icons/bounty_hunt/bh_titan" ) + RuiSetImage( rui, "clampedDefaultIcon", $"rui/hud/gametype_icons/bounty_hunt/bh_titan" ) + RuiSetBool( rui, "useTeamColor", false ) +} + +void function MinimapPackage_BatteryInit( entity ent, var rui ) +{ + entity player = GetLocalViewPlayer() + RuiTrackInt( rui, "batteryCount", player, RUI_TRACK_SCRIPT_NETWORK_VAR_INT, GetNetworkedVariableIndex( "batteryCount" ) ) + RuiSetBool( rui, "useTeamColor", false ) + RuiTrackFloat( rui, "batteryCarried", ent, RUI_TRACK_STATUS_EFFECT_SEVERITY, eStatusEffect.battery_carried ) +} + +void function MinimapPackage_ATAreaInit( entity ent, var rui ) +{ + RuiTrackFloat( rui, "objectRadius", ent, RUI_TRACK_MINIMAP_SCALE ) +} + +void function MinimapPackage_ATBank( entity ent, var rui ) +{ + RuiSetImage( rui, "defaultIcon", $"rui/hud/gametype_icons/bounty_hunt/bh_bank_icon" ) + RuiSetImage( rui, "clampedDefaultIcon", $"rui/hud/gametype_icons/bounty_hunt/bh_bank_icon" ) + RuiSetBool( rui, "useTeamColor", false ) +} + +void function MinimapPackage_SpawnZoneAreaInit( entity ent, var rui ) +{ + RuiTrackFloat( rui, "objectRadius", ent, RUI_TRACK_MINIMAP_SCALE ) + if ( !IsPlayingDemo() ) + { + RuiSetImage( rui, "centerImage", $"" ) // hide diamond + RuiSetImage( rui, "clampedImage", $"rui/hud/gametype_icons/obj_foreground_diamond" ) + } +} + +void function MinimapPackage_FWBuildSite( entity ent, var rui ) +{ + entity player = GetLocalViewPlayer() + RuiTrackInt( rui, "batteryCount", player, RUI_TRACK_SCRIPT_NETWORK_VAR_INT, GetNetworkedVariableIndex( "batteryCount" ) ) + //RuiTrackFloat( rui, "objectRadius", ent, RUI_TRACK_MINIMAP_SCALE ) +} + +void function MinimapPackage_HardpointA( entity ent, var rui ) +{ + RuiSetFloat( rui, "objectRadius", 0.001 ) +} + +void function MinimapPackage_HardpointB( entity ent, var rui ) +{ + RuiSetFloat( rui, "objectRadius", 0.001 ) +} + +void function MinimapPackage_HardpointC( entity ent, var rui ) +{ + RuiSetFloat( rui, "objectRadius", 0.001 ) +} + +void function MinimapPackage_FDHarvester( entity ent, var rui ) +{ + RuiSetImage( rui, "centerImage", $"rui/hud/gametype_icons/fd/coop_harvester" ) + RuiSetImage( rui, "clampedImage", $"rui/hud/gametype_icons/fd/coop_harvester" ) + RuiSetFloat( rui, "objectRadius", 0.01 ) + RuiSetBool( rui, "useOverrideColor", true ) + RuiSetColorAlpha( rui, "overrideColor", <1.0,1.0,1.0>, 1.0 ) +} + +void function MinimapPackage_FDLoadoutChest( entity ent, var rui ) +{ + RuiSetImage( rui, "centerImage", $"rui/hud/gametype_icons/fd/coop_ammo_locker_icon" ) + RuiSetImage( rui, "clampedImage", $"rui/hud/gametype_icons/fd/coop_ammo_locker_icon" ) + RuiSetFloat( rui, "objectRadius", 0.01 ) + RuiSetBool( rui, "useOverrideColor", true ) + RuiSetColorAlpha( rui, "overrideColor", <1.0,1.0,1.0>, 1.0 ) +} + +void function MinimapPackage_FDBatteryExchange( entity ent, var rui ) +{ + RuiSetImage( rui, "centerImage", $"rui/hud/gametype_icons/bounty_hunt/bh_bank_icon" ) + RuiSetImage( rui, "clampedImage", $"rui/hud/gametype_icons/bounty_hunt/bh_bank_icon" ) + RuiSetFloat( rui, "objectRadius", 0.01 ) + RuiSetBool( rui, "useOverrideColor", true ) + RuiSetColorAlpha( rui, "overrideColor", <1.0,1.0,1.0>, 1.0 ) +} + +void function MinimapPackage_BoostStore( entity ent, var rui ) +{ + RuiSetImage( rui, "centerImage", $"rui/hud/gametype_icons/bounty_hunt/bh_bonus_icon" ) + RuiSetImage( rui, "clampedImage", $"rui/hud/gametype_icons/bounty_hunt/bh_bonus_icon" ) + RuiSetFloat( rui, "objectRadius", 0.01 ) + RuiSetBool( rui, "useOverrideColor", true ) + RuiSetColorAlpha( rui, "overrideColor", <1.0,1.0,1.0>, 1.0 ) +} + +void function MinimapPackage_MortarPosition( entity ent, var rui ) +{ + RuiSetImage( rui, "bgImage", $"rui/hud/gametype_icons/fd/fd_icon_spectre_mortar_bg" ) + RuiSetImage( rui, "centerImage", $"rui/hud/gametype_icons/fd/fd_icon_spectre_mortar" ) + RuiSetImage( rui, "clampedImage", $"rui/hud/gametype_icons/fd/fd_icon_spectre_mortar" ) + RuiTrackFloat( rui, "arcPercent", ent, RUI_TRACK_SHIELD_FRACTION ) +} + +void function MinimapPackage_ArcTrap( entity ent, var rui ) +{ + RuiSetImage( rui, "centerImage", $"rui/hud/minimap/compass_icon_arc_trap" ) + RuiSetImage( rui, "clampedImage", $"" ) + RuiTrackFloat( rui, "objectRadius", ent, RUI_TRACK_MINIMAP_SCALE ) +} + +void function MinimapPackage_FWCampA( entity ent, var rui ) +{ + RuiTrackInt( rui, "alertLevel", null, RUI_TRACK_SCRIPT_NETWORK_VAR_GLOBAL_INT, GetNetworkedVariableIndex( "fwCampAlertA" ) ) + RuiTrackFloat( rui, "objectRadius", ent, RUI_TRACK_MINIMAP_SCALE ) +} + +void function MinimapPackage_FWCampB( entity ent, var rui ) +{ + RuiTrackInt( rui, "alertLevel", null, RUI_TRACK_SCRIPT_NETWORK_VAR_GLOBAL_INT, GetNetworkedVariableIndex( "fwCampAlertB" ) ) + RuiTrackFloat( rui, "objectRadius", ent, RUI_TRACK_MINIMAP_SCALE ) +} + +void function MinimapPackage_FWCampC( entity ent, var rui ) +{ + RuiTrackInt( rui, "alertLevel", null, RUI_TRACK_SCRIPT_NETWORK_VAR_GLOBAL_INT, GetNetworkedVariableIndex( "fwCampAlertC" ) ) + RuiTrackFloat( rui, "objectRadius", ent, RUI_TRACK_MINIMAP_SCALE ) +} + +void function MinimapPackage_LTSBombSiteA( entity ent, var rui ) +{ + RuiSetImage( rui, "defaultIcon", $"rui/hud/gametype_icons/last_titan_standing/bomb_site_a_attacking" ) + RuiSetImage( rui, "clampedDefaultIcon", $"rui/hud/gametype_icons/last_titan_standing/bomb_site_a_attacking" ) +} + +void function MinimapPackage_LTSBombSiteB( entity ent, var rui ) +{ + RuiSetImage( rui, "defaultIcon", $"rui/hud/gametype_icons/last_titan_standing/bomb_site_b_attacking" ) + RuiSetImage( rui, "clampedDefaultIcon", $"rui/hud/gametype_icons/last_titan_standing/bomb_site_b_attacking" ) +} + +void function MinimapPackage_LTSBomb( entity ent, var rui ) +{ + RuiSetImage( rui, "defaultIcon", $"rui/hud/gametype_icons/last_titan_standing/bomb_neutral" ) + RuiSetImage( rui, "clampedDefaultIcon", $"rui/hud/gametype_icons/last_titan_standing/bomb_neutral" ) + RuiSetBool( rui, "useTeamColor", false ) +} + +void function MinimapPackage_FlagInit( entity ent, var rui ) +{ + RuiSetImage( rui, "defaultIcon", $"rui/hud/gametype_icons/ctf/ctf_flag_neutral" ) + RuiSetImage( rui, "clampedDefaultIcon", $"rui/hud/gametype_icons/ctf/ctf_flag_neutral" ) + RuiSetBool( rui, "useTeamColor", true ) +} + +void function MinimapPackage_PowerUp( entity ent, var rui ) +{ + //Battery spawners are the only power ups in use atm. This would need to be updated if we use them differently. + RuiSetImage( rui, "defaultIcon", $"rui/hud/battery/battery_capture_friendly" ) + RuiSetImage( rui, "clampedDefaultIcon", $"rui/hud/battery/battery_capture_friendly" ) + RuiSetBool( rui, "useTeamColor", false ) +} + + +void function MinimapJammed_Enabled( entity ent, int statusEffect, bool actuallyChanged ) +{ + if ( !actuallyChanged ) + return + + if ( ent != GetLocalClientPlayer() ) + return + + thread LoopRadarJammerSounds( ent ) + thread FadeOutStaticSoundAfterDelay( ent, BURN_METER_RADAR_JAMMER_PULSE_DURATION - BURN_METER_RADAR_JAMMER_EASE_OFF_TIME ) + + if ( file.minimap_jammed_layer != null ) + RuiDestroy( file.minimap_jammed_layer ) + + file.minimap_jammed_layer = Minimap_AddCustomLayer( $"ui/minimap_jammer_layer.rpak", MINIMAP_Z_YOU + 1 ) + if ( actuallyChanged ) + RuiSetGameTime( file.minimap_jammed_layer, "startTime", Time() ) + + RuiSetFloat( file.minimap_jammed_layer, "minimapZoomScale", file.minimapZoomScale ) + RuiSetFloat( file.minimap_jammed_layer, "minimapSizeScale", file.minimapSizeScale ) + RuiTrackFloat( file.minimap_jammed_layer, "scriptAlphaVar", ent, RUI_TRACK_STATUS_EFFECT_SEVERITY, statusEffect ) + + RuiTrackFloat( file.minimap_wedges, "scriptInverseAlphaVar", ent, RUI_TRACK_STATUS_EFFECT_SEVERITY, statusEffect ) + +} + +void function MinimapJammed_Disabled( entity ent, int statusEffect, bool actuallyChanged ) +{ + if ( !actuallyChanged ) + return + + if ( ent != GetLocalClientPlayer() ) + return + + clGlobal.levelEnt.Signal( "LoopRadarJammerSounds" ) + + if ( file.minimap_jammed_layer != null ) + { + RuiDestroy( file.minimap_jammed_layer ) + file.minimap_jammed_layer = null + } +} + +void function LoopRadarJammerSounds( entity ent ) +{ + clGlobal.levelEnt.Signal( "LoopRadarJammerSounds" ) + clGlobal.levelEnt.EndSignal( "LoopRadarJammerSounds" ) + ent.EndSignal( "OnDeath" ) + + OnThreadEnd( + function() : ( ent ) + { + StopSoundOnEntity( ent, "HUD_Boost_Card_Radar_Jammer_RedTextBeep_1P" ) + } + ) + + float currentTime = Time() + float fractionalComponent = currentTime - floor( currentTime ) + float timeToWait + if ( fractionalComponent <= 0.5 ) + timeToWait = 0.5 - fractionalComponent + else + timeToWait = 1.5 - fractionalComponent + + wait ( timeToWait ) //Red text flashes in with regards to game time, so we need to wait till the appropriate time (0.5) to play the next sound + + while( true ) + { + if ( IsValid( ent ) ) + EmitSoundOnEntity( ent, "HUD_Boost_Card_Radar_Jammer_RedTextBeep_1P" ) + + wait 1.0 //This is dependent on the rui logic, and will need to be changed if the rui logic changes + } +} + +void function FadeOutStaticSoundAfterDelay( entity ent, float delay ) +{ + EmitSoundOnEntity( ent, "HUD_Boost_Card_Radar_Jammer_Signal_Static_1P" ) + + ent.EndSignal( "OnDeath" ) + + OnThreadEnd( + function() : ( ent ) + { + clGlobal.levelEnt.Signal( "LoopRadarJammerSounds" ) //stop red text beeping sounds + if ( IsValid( ent ) ) + StopSoundOnEntity( ent, "HUD_Boost_Card_Radar_Jammer_Signal_Static_1P" ) + + } + ) + wait delay +} +void function Minimap_SetZoomScale( float scale ) +{ + file.minimapZoomScale = scale + if(file.minimap_you != null) + RuiSetFloat( file.minimap_you, "minimapZoomScale", file.minimapZoomScale ) + if(file.minimap_indicator != null) + RuiSetFloat( file.minimap_indicator, "minimapZoomScale", file.minimapZoomScale ) + if(file.minimap_base != null) + RuiSetFloat( file.minimap_base, "minimapZoomScale", file.minimapZoomScale ) + + if ( file.minimap_wedges != null ) + { + RuiSetBool( file.minimap_wedges, "isVisible", file.minimapZoomScale == 1.0 ) + RuiSetFloat( file.minimap_wedges, "minimapZoomScale", file.minimapZoomScale ) + } + foreach ( var rui in file.minimapOtherRuis ) + { + RuiSetFloat( rui, "minimapZoomScale", file.minimapZoomScale ) + } +} + +void function Minimap_SetSizeScale( float scale ) +{ + file.minimapSizeScale = scale + if(file.minimap_base != null) + RuiSetFloat( file.minimap_base, "minimapSizeScale", file.minimapSizeScale ) + if(file.minimap_indicator != null) + RuiSetFloat( file.minimap_indicator, "minimapSizeScale", file.minimapSizeScale ) + if(file.minimap_you != null) + RuiSetFloat( file.minimap_you, "minimapSizeScale", file.minimapSizeScale ) + if(file.minimap_wedges != null) + RuiSetFloat( file.minimap_wedges, "minimapSizeScale", file.minimapSizeScale ) + foreach ( var rui in file.minimapOtherRuis ) + { + RuiSetFloat( rui, "minimapSizeScale", file.minimapSizeScale ) + } + +} +float function Minimap_GetZoomScale() +{ + return file.minimapZoomScale +} +float function Minimap_GetSizeScale() +{ + return file.minimapSizeScale +} +bool function Minimap_IsUsingLargeMinimap() +{ + return file.minimapSizeScale > 1.0 +} + +void function ServerCallback_PingMinimap( float originX, float originY, float originZ, float radius, float duration, float colorR, float colorG, float colorB, int count, bool reverse ) +{ + if ( count > 1 ) + thread Minimap_PingCount( , radius, duration, , count, reverse ) + else + Minimap_Ping( , radius, duration, , reverse ) +} -- cgit v1.2.3 From ef8a419edea010f39c35b913626c35900f052e2b Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Mon, 31 Oct 2022 23:16:58 +0000 Subject: restore hud_takesshots functionality to automatically take screenshots of scoreboard (#522) * restore hud_takesshots functionality to take screenshots of scoreboard automatically * fixup some formatting --- Northstar.Client/mod/scripts/vscripts/client/cl_gamestate.gnut | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Northstar.Client') diff --git a/Northstar.Client/mod/scripts/vscripts/client/cl_gamestate.gnut b/Northstar.Client/mod/scripts/vscripts/client/cl_gamestate.gnut index 93be01ea..1baeae9f 100644 --- a/Northstar.Client/mod/scripts/vscripts/client/cl_gamestate.gnut +++ b/Northstar.Client/mod/scripts/vscripts/client/cl_gamestate.gnut @@ -1105,8 +1105,16 @@ void function DisplayPostMatchTop3() RuiSetBool( rui, "isFriendly" + i, localTeam == players[i].GetTeam() ) } } + + if ( GetConVarBool( "hud_takesshots" ) ) + thread TakeScoreboardScreenshot_Delayed() } +void function TakeScoreboardScreenshot_Delayed() +{ + wait 1.5 + GetLocalClientPlayer().ClientCommand( "jpeg" ) +} float function GetGameStartTime() { -- cgit v1.2.3 From 0a5c705f662773ecb97a9b06d2c92e023307b441 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Sun, 6 Nov 2022 02:17:53 +0100 Subject: Bump version number (#526) --- Northstar.Client/mod.json | 2 +- Northstar.Custom/mod.json | 2 +- Northstar.CustomServers/mod.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'Northstar.Client') diff --git a/Northstar.Client/mod.json b/Northstar.Client/mod.json index 7dcfcd21..7ca8dd5e 100644 --- a/Northstar.Client/mod.json +++ b/Northstar.Client/mod.json @@ -1,7 +1,7 @@ { "Name": "Northstar.Client", "Description": "Various ui and client changes to fix bugs and add better support for mods", - "Version": "1.9.0", + "Version": "1.10.0", "LoadPriority": 0, "ConVars": [ { diff --git a/Northstar.Custom/mod.json b/Northstar.Custom/mod.json index 28825a58..1a08f0d4 100644 --- a/Northstar.Custom/mod.json +++ b/Northstar.Custom/mod.json @@ -1,7 +1,7 @@ { "Name": "Northstar.Custom", "Description": "Custom content for Northstar: extra weapons, gamemodes, etc.", - "Version": "1.9.0", + "Version": "1.10.0", "LoadPriority": 1, "RequiredOnClient": true, "ConVars": [ diff --git a/Northstar.CustomServers/mod.json b/Northstar.CustomServers/mod.json index 79663feb..2ed89910 100644 --- a/Northstar.CustomServers/mod.json +++ b/Northstar.CustomServers/mod.json @@ -1,7 +1,7 @@ { "Name": "Northstar.CustomServers", "Description": "Attempts to recreate the behaviour of vanilla Titanfall 2 servers, as well as changing some scripts to allow better support for mods", - "Version": "1.9.0", + "Version": "1.10.0", "LoadPriority": 0, "ConVars": [ { -- cgit v1.2.3 From f5e4a7be5b6d48006e5f3b9ac218993aa4ee284e Mon Sep 17 00:00:00 2001 From: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Thu, 10 Nov 2022 00:05:18 +0000 Subject: Improve mouse capture handling in menus (#520) * rework mouse capture handling * small improvement to comment * move to new script file * refactor to use only the capturePanel * refactor part 2 * github please commit everything * remove non-implemented global function * cleanup * rename variable * formatting and a comment * run callbacks for menus * update comment accordingly * small formatting change * slight refactor to avoid duplicate code * improve comment * pass correct parameters * newline at end of file :) --- Northstar.Client/mod.json | 4 ++ .../mod/scripts/vscripts/sh_menu_models.gnut | 36 ------------- .../mod/scripts/vscripts/ui/menu_map_select.nut | 2 +- .../mod/scripts/vscripts/ui/menu_ns_modmenu.nut | 2 +- .../scripts/vscripts/ui/menu_ns_serverbrowser.nut | 2 +- .../mod/scripts/vscripts/ui/ui_mouse_capture.nut | 60 ++++++++++++++++++++++ 6 files changed, 67 insertions(+), 39 deletions(-) create mode 100644 Northstar.Client/mod/scripts/vscripts/ui/ui_mouse_capture.nut (limited to 'Northstar.Client') diff --git a/Northstar.Client/mod.json b/Northstar.Client/mod.json index 7ca8dd5e..15853be7 100644 --- a/Northstar.Client/mod.json +++ b/Northstar.Client/mod.json @@ -115,6 +115,10 @@ { "Path": "ui/controller_prompts.nut", "RunOn": "UI" + }, + { + "Path": "ui/ui_mouse_capture.nut", + "RunOn": "UI" } ], "Localisation": [ diff --git a/Northstar.Client/mod/scripts/vscripts/sh_menu_models.gnut b/Northstar.Client/mod/scripts/vscripts/sh_menu_models.gnut index 6d446654..0bcb7864 100644 --- a/Northstar.Client/mod/scripts/vscripts/sh_menu_models.gnut +++ b/Northstar.Client/mod/scripts/vscripts/sh_menu_models.gnut @@ -207,19 +207,9 @@ #endif // CLIENT && MP #if UI - struct - { - table MouseMovementCaptureFunctionsTable = {} - } file - - const MOUSE_ROTATE_MULTIPLIER = 25.0 - global function UpdateUIMapSupportsMenuModels global function RunMenuClientFunction global function UI_SetPresentationType - - global function AddMouseMovementCaptureHandler - global function UICodeCallback_MouseMovementCapture #endif // UI global const STORE_BG_DEFAULT = 0 @@ -2897,30 +2887,4 @@ RunClientScript( "UpdateMenuToHarvester" ) } } - - void function AddMouseMovementCaptureHandler( var menu, void functionref( int, int ) func ) - { - file.MouseMovementCaptureFunctionsTable.rawset( menu, func ) - } - - void function UpdateMouseMovementCaptureFunctions( int deltaX, int deltaY ) - { - var activeMenu = GetActiveMenu() - if ( file.MouseMovementCaptureFunctionsTable.rawin( activeMenu ) ) - file.MouseMovementCaptureFunctionsTable.rawget( activeMenu )(deltaX, deltaY) - } - - void function UICodeCallback_MouseMovementCapture( var capturePanel, int deltaX, int deltaY ) - { - float screenScaleXModifier = 1920.0 / GetScreenSize()[0] // 1920 is base screen width - float mouseXRotateDelta = deltaX * screenScaleXModifier * MOUSE_ROTATE_MULTIPLIER - //printt( "deltaX:", deltaX, "deltaY:", deltaY ) - - float screenScaleYModifier = 1080.0 / GetScreenSize()[1] // 1920 is base screen width - float mouseYRotationDelta = deltaY * screenScaleYModifier * MOUSE_ROTATE_MULTIPLIER - - UpdateMouseMovementCaptureFunctions( deltaX, deltaY ) - - RunMenuClientFunction( "UpdateMouseRotateDelta", mouseXRotateDelta, mouseYRotationDelta ) - } #endif // UI diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut index 930e472b..8e8071f5 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut @@ -43,7 +43,7 @@ void function InitMapsMenu() { file.menu = GetMenu( "MapsMenu" ) - AddMouseMovementCaptureHandler( file.menu, UpdateMouseDeltaBuffer ) + AddMouseMovementCaptureHandler( Hud_GetChild(file.menu, "MouseMovementCapture"), UpdateMouseDeltaBuffer ) AddMenuEventHandler( file.menu, eUIEvent.MENU_CLOSE, OnCloseMapsMenu ) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut index 329ea73f..3f643aa3 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut @@ -83,7 +83,7 @@ void function InitModMenu() RuiSetImage( rui, "basicImage", $"ui/menu/common/dialog_error" ) } - AddMouseMovementCaptureHandler( file.menu, UpdateMouseDeltaBuffer ) + AddMouseMovementCaptureHandler( Hud_GetChild(file.menu, "MouseMovementCapture"), UpdateMouseDeltaBuffer ) // UI Events AddMenuEventHandler( file.menu, eUIEvent.MENU_OPEN, OnModMenuOpened ) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut index eb068374..d9b11ccc 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut @@ -142,7 +142,7 @@ void function InitServerBrowserMenu() { file.menu = GetMenu( "ServerBrowserMenu" ) - AddMouseMovementCaptureHandler( file.menu, UpdateMouseDeltaBuffer ) + AddMouseMovementCaptureHandler( Hud_GetChild(file.menu, "MouseMovementCapture"), UpdateMouseDeltaBuffer ) // Get menu stuff file.serverButtons = GetElementsByClassname( file.menu, "ServerButton" ) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/ui_mouse_capture.nut b/Northstar.Client/mod/scripts/vscripts/ui/ui_mouse_capture.nut new file mode 100644 index 00000000..fa5c9217 --- /dev/null +++ b/Northstar.Client/mod/scripts/vscripts/ui/ui_mouse_capture.nut @@ -0,0 +1,60 @@ +untyped // untyped purely so I can index into a table with var + +global function AddMouseMovementCaptureHandler +global function UICodeCallback_MouseMovementCapture + +struct +{ + // a table of capturePanels and menus, each of which contains an array of callbacks + table< var, array< void functionref( int deltaX, int deltaY ) > > mouseMovementCaptureCallbacks = {} +} file + +// this function registers a callback (or "handler") function for a MouseMovementCapture menu panel +// use this for scrollbars, sliders, etc. +void function AddMouseMovementCaptureHandler( var capturePanelOrMenu, void functionref( int deltaX, int deltaY ) func ) +{ + // if the capturePanel or menu already has an array in the table, we append to the array + // if not, we should create the array, [func] just turns func into an array + if ( capturePanelOrMenu in file.mouseMovementCaptureCallbacks ) + file.mouseMovementCaptureCallbacks[capturePanelOrMenu].append( func ) + else + file.mouseMovementCaptureCallbacks[capturePanelOrMenu] <- [func] +} + +void function RunMouseMovementCallbacks( var capturePanelOrMenu, int deltaX, int deltaY ) +{ + // check that the capturePanelOrMenu is in the table before trying anything stupid + if ( capturePanelOrMenu in file.mouseMovementCaptureCallbacks ) + { + // iterate through the different callback functions + foreach ( void functionref( int deltaX, int deltaY ) callback in file.mouseMovementCaptureCallbacks[capturePanelOrMenu] ) + { + // run the callback function + callback( deltaX, deltaY ) + } + } +} + +void function UICodeCallback_MouseMovementCapture( var capturePanel, int deltaX, int deltaY ) +{ + // run callbacks for the capturePanel + RunMouseMovementCallbacks( capturePanel, deltaX, deltaY ) + + // get the current menu and run callbacks, this preserves backwards compatibility + RunMouseMovementCallbacks( GetActiveMenu(), deltaX, deltaY ) + + // everything below here originally existed in vanilla sh_menu_models.gnut and is meant to be used for like all of their rotation stuff + // its easier to move this here than to add a shared callback for all of the vanilla capture handlers (there are like >20) + + // this const was moved instead of made global because it was literally only used in the code below + const MOUSE_ROTATE_MULTIPLIER = 25.0 + + float screenScaleXModifier = 1920.0 / GetScreenSize()[0] // 1920 is base screen width + float mouseXRotateDelta = deltaX * screenScaleXModifier * MOUSE_ROTATE_MULTIPLIER + //printt( "deltaX:", deltaX, "screenScaleModifier:", screenScaleModifier, "mouseRotateDelta:", mouseRotateDelta ) + + float screenScaleYModifier = 1080.0 / GetScreenSize()[1] // 1080 is base screen height + float mouseYRotationDelta = deltaY * screenScaleYModifier * MOUSE_ROTATE_MULTIPLIER + + RunMenuClientFunction( "UpdateMouseRotateDelta", mouseXRotateDelta, mouseYRotationDelta ) +} -- cgit v1.2.3 From 3b02ecd43c2c1efd6e2d966b9659e4268dc1bbc5 Mon Sep 17 00:00:00 2001 From: Erlite Date: Sat, 12 Nov 2022 15:09:43 +0100 Subject: Add support for hiding the [SERVER] tag in server messages (#506) --- .../vscripts/_custom_codecallbacks_client.gnut | 29 ++++++++++++++++------ .../mod/scripts/vscripts/_chat.gnut | 8 +++--- 2 files changed, 26 insertions(+), 11 deletions(-) (limited to 'Northstar.Client') diff --git a/Northstar.Client/mod/scripts/vscripts/_custom_codecallbacks_client.gnut b/Northstar.Client/mod/scripts/vscripts/_custom_codecallbacks_client.gnut index 66a40cb0..3caf4336 100644 --- a/Northstar.Client/mod/scripts/vscripts/_custom_codecallbacks_client.gnut +++ b/Northstar.Client/mod/scripts/vscripts/_custom_codecallbacks_client.gnut @@ -11,6 +11,7 @@ global struct ClClient_MessageStruct { bool isDead bool isWhisper bool shouldBlock + bool noServerTag } struct { @@ -29,6 +30,7 @@ void function OnReceivedMessage(ClClient_MessageStruct localMessage) { localMessage.isDead = returnStruct.isDead localMessage.isWhisper = returnStruct.isWhisper localMessage.shouldBlock = localMessage.shouldBlock || returnStruct.shouldBlock + localMessage.noServerTag = returnStruct.noServerTag } } @@ -39,7 +41,13 @@ void function OnReceivedMessage(ClClient_MessageStruct localMessage) { NSChatWriteRaw(1, "\n") - if (localMessage.player == null) NSChatWrite(1, "\x1b[95m") + if (localMessage.player == null) + { + if (!localMessage.noServerTag || localMessage.isWhisper) + { + NSChatWrite(1, "\x1b[95m") + } + } else { bool isFriendly = localMessage.player.GetTeam() == GetLocalClientPlayer().GetTeam() @@ -54,15 +62,18 @@ void function OnReceivedMessage(ClClient_MessageStruct localMessage) { if (localMessage.player == null) { - NSChatWriteRaw(1, Localize("#HUD_CHAT_SERVER_PREFIX") + " ") + if (!localMessage.noServerTag) + { + NSChatWriteRaw(1, Localize("#HUD_CHAT_SERVER_PREFIX") + " ") + } } - else { + else + { NSChatWriteRaw(1, localMessage.playerName) NSChatWriteRaw(1, ": ") } - NSChatWrite(1, "\x1b[0m") - + if (localMessage.player != null || !localMessage.noServerTag || localMessage.isWhisper) NSChatWrite(1, "\x1b[0m") NSChatWrite(1, localMessage.message) } @@ -87,16 +98,19 @@ void function CHudChat_OnReceivedSayTextMessageCallback(int fromPlayerIndex, str fromPlayerName = fromPlayer.GetPlayerNameWithClanTag() } + // Null player + isTeam == true: Server with no tag. + if (messageType == 0 || messageType == 1) { ClClient_MessageStruct localMessage localMessage.message = message localMessage.player = fromPlayer localMessage.playerName = fromPlayerName - localMessage.isTeam = isTeam + localMessage.isTeam = fromPlayer != null && isTeam localMessage.isDead = isDead localMessage.isWhisper = false localMessage.shouldBlock = false + localMessage.noServerTag = fromPlayer == null && isTeam OnReceivedMessage(localMessage) return } @@ -107,10 +121,11 @@ void function CHudChat_OnReceivedSayTextMessageCallback(int fromPlayerIndex, str localMessage.message = message localMessage.player = fromPlayer localMessage.playerName = fromPlayerName - localMessage.isTeam = isTeam + localMessage.isTeam = fromPlayer != null && isTeam localMessage.isDead = isDead localMessage.isWhisper = true localMessage.shouldBlock = false + localMessage.noServerTag = fromPlayer == null && isTeam OnReceivedMessage(localMessage) return } diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_chat.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_chat.gnut index 97ed959c..44836bc9 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/_chat.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/_chat.gnut @@ -25,26 +25,26 @@ void function Chat_PrivateMessage(entity fromPlayer, entity toPlayer, string tex } // Broadcasts a message from the server to all players. -void function Chat_ServerBroadcast(string text) +void function Chat_ServerBroadcast(string text, bool withServerTag = true) { NSBroadcastMessage( -1, -1, text, - false, + !withServerTag, false, eChatMessageType.CHAT ) } // Sends a message from the server to one player. Will be shown as a whisper if whisper is set. -void function Chat_ServerPrivateMessage(entity toPlayer, string text, bool whisper) +void function Chat_ServerPrivateMessage(entity toPlayer, string text, bool whisper, bool withServerTag = true) { NSBroadcastMessage( -1, toPlayer.GetPlayerIndex(), text, - false, + !withServerTag, false, whisper ? eChatMessageType.WHISPER : eChatMessageType.CHAT ) -- cgit v1.2.3 From 7c30c44d2bfea9cf64a374f690a23a6e6eb1165b Mon Sep 17 00:00:00 2001 From: Respawn Date: Sat, 12 Nov 2022 23:08:24 +0100 Subject: Add cl_titan_cockpit.nut from englishclient_mp_common --- .../scripts/vscripts/client/cl_titan_cockpit.nut | 1652 ++++++++++++++++++++ 1 file changed, 1652 insertions(+) create mode 100644 Northstar.Client/mod/scripts/vscripts/client/cl_titan_cockpit.nut (limited to 'Northstar.Client') diff --git a/Northstar.Client/mod/scripts/vscripts/client/cl_titan_cockpit.nut b/Northstar.Client/mod/scripts/vscripts/client/cl_titan_cockpit.nut new file mode 100644 index 00000000..828f3056 --- /dev/null +++ b/Northstar.Client/mod/scripts/vscripts/client/cl_titan_cockpit.nut @@ -0,0 +1,1652 @@ +untyped + +global function ClTitanCockpit_Init + +global function ServerCallback_TitanEMP +global function ServerCallback_TitanCockpitBoot +global function TitanCockpit_DamageFeedback +global function TitanCockpit_AddPlayer +global function RegisterTitanBindings +global function GetTitanBindings +global function DeregisterTitanBindings +global function ServerCallback_TitanEmbark +global function ServerCallback_TitanDisembark +global function PlayerPressed_EjectEnable // so can be called directly for debugging +global function PlayerPressed_Eject // so can be called directly for debugging +global function TitanCockpit_IsBooting +global function ServerCallback_TitanCockpitEMP +global function TitanCockpit_EMPFadeScale +global function TitanCockpit_DoEMP +global function TitanEMP_Internal +global function ServerCallback_EjectConfirmed +global function LinkCoreHint + +global function AddTitanCockpitManagedRUI +global function UpdateTitanCockpitVisibility +global function TitanCockpitDestroyRui +global function TitanCockpitDoomedThink +global function PlayerEjects +global function IsDisplayingEjectInterface +global function FlashCockpitLight +global function PlayCockpitSparkFX + +global function FlashCockpitHealth + +global function UpdateEjectHud_SetButtonPressTime +global function UpdateEjectHud_SetButtonPressCount + +global function SetUnlimitedDash +#if MP +global function NetworkedVarChangedCallback_UpdateVanguardRUICoreStatus +global function DisplayFrontierRank +#endif +struct TitanCockpitManagedRUI +{ + bool exists = false + var functionref() create + void functionref() destroy + bool functionref() shouldCreate + int drawGroup = RUI_DRAW_COCKPIT +} + +const TITAN_ALARM_SOUND = "titan_alarm" +const TITAN_NUCLEAR_DEATH_ALARM = "titan_nuclear_death_alarm" +const TITAN_EJECT_BOOST = "titan_eject_boost" +const TITAN_EJECT_ASCENT = "player_eject_windrush" +const TITAN_EJECT_APEX = "player_eject_apex_wind" +const TITAN_EJECT_DESCENT = "player_fallingdescent_windrush" + +const EJECT_MIN_VELOCITY = 200.0 +const EJECT_MAX_VELOCITY = 1000.0 + +struct +{ + var coreHintRui + var cockpitRui + var cockpitLowerRui + var cockpitAdditionalRui + array titanCockpitManagedRUIs + + string lastPilotSettings + + bool isFirstBoot = true + var scorchHotstreakRui +} file + +function ClTitanCockpit_Init() +{ + if ( reloadingScripts ) + return + + RegisterSignal( "DisembarkCheck" ) + RegisterSignal( "Rumble_Forward_End" ) + RegisterSignal( "Rumble_Back_End" ) + RegisterSignal( "Rumble_Left_End" ) + RegisterSignal( "Rumble_Right_End" ) + RegisterSignal( "EMP" ) + RegisterSignal( "Ejecting" ) + RegisterSignal( "TitanEMP_Internal" ) + RegisterSignal( "TitanUnDoomed" ) + RegisterSignal( "MonitorPlayerEjectAnimBeingStuck" ) + RegisterSignal( "DisplayFrontierRank" ) + + PrecacheParticleSystem( $"xo_cockpit_spark_01" ) + + if ( !IsModelViewer() && !IsLobby() ) + { + AddCreateCallback( "titan_cockpit", TitanCockpitInit ) + } + + if ( !reloadingScripts ) + { + level.cockpitGeoRef <- null + } + + AddPlayerFunc( TitanCockpit_AddPlayer ) + + AddCinematicEventFlagChangedCallback( CE_FLAG_TITAN_3P_CAM, CinematicEventFlagChanged ) + AddCinematicEventFlagChangedCallback( CE_FLAG_INTRO, CinematicEventFlagChanged ) + + AddCallback_PlayerClassChanged( UpdateLastPlayerSettings ) + + AddTitanCockpitManagedRUI( Scorch_CreateHotstreakBar, Scorch_DestroyHotstreakBar, Scorch_ShouldCreateHotstreakBar, RUI_DRAW_COCKPIT ) //RUI_DRAW_HUD +} + +void function UpdateLastPlayerSettings( entity player ) +{ + if ( IsPilot( player ) ) + file.lastPilotSettings = player.GetPlayerSettings() +} + +TitanBindings function GetTitanBindings() +{ + TitanBindings Table + Table.PlayerPressed_Eject = PlayerPressed_Eject + Table.PlayerPressed_EjectEnable = PlayerPressed_EjectEnable + return Table +} + +bool function RegisterTitanBindings( entity player, TitanBindings bind ) +{ + if ( player != GetLocalViewPlayer() ) + return false + + if ( player != GetLocalClientPlayer() ) + return false + + RegisterConCommandTriggeredCallback( "+useAndReload", bind.PlayerPressed_Eject ) + RegisterConCommandTriggeredCallback( "+use", bind.PlayerPressed_Eject ) + + RegisterConCommandTriggeredCallback( "+scriptCommand1", bind.PlayerPressed_EjectEnable ) + + return true +} + +void function DeregisterTitanBindings( TitanBindings bind ) +{ + DeregisterConCommandTriggeredCallback( "+useAndReload", bind.PlayerPressed_Eject ) + DeregisterConCommandTriggeredCallback( "+use", bind.PlayerPressed_Eject ) + + if ( GetMapName() != "" ) + { + DeregisterConCommandTriggeredCallback( "+scriptCommand1", bind.PlayerPressed_EjectEnable ) + } +} + + +void function TitanCockpit_AddPlayer( entity player ) +{ + if ( IsModelViewer() ) + return + + player.s.lastCockpitDamageSoundTime <- 0 + player.s.inTitanCockpit <- false + player.s.lastDialogTime <- 0 + player.s.titanCockpitDialogActive <- false + player.s.titanCockpitDialogAliasList <- [] + + player.s.hitVectors <- [] +} + +void function TitanCockpitInit( entity cockpit ) +{ + entity player = GetLocalViewPlayer() + Assert( player.GetCockpit() == cockpit ) + + cockpit.s.ejectStartTime <- 0 // placed here to fix http://bugzilla.respawn.net/show_bug.cgi?id=156786 + + if ( !IsAlive( player ) ) + return + + if ( !IsTitanCockpitModelName( cockpit.GetModelName() ) || IsWatchingThirdPersonKillReplay() ) + { + player.s.inTitanCockpit = false + return + } + + if ( !player.s.inTitanCockpit ) + TitanEmbarkDSP( 0.5 ) + + player.s.inTitanCockpit = true + + // code aint callin this currently + CodeCallback_PlayerInTitanCockpit( GetLocalViewPlayer(), GetLocalViewPlayer() ) + + // move this + array targets = GetClientEntArrayBySignifier( "info_target" ) + foreach ( target in targets ) + { + if ( target.GetTargetName() != "cockpit_geo_ref" ) + continue + + level.cockpitGeoRef = target + } + + entity cockpitParent = expect entity( level.cockpitGeoRef ) + + if ( !IsValid( cockpitParent ) ) + cockpitParent = GetLocalViewPlayer() + + cockpit.s.empInfo <- {} + cockpit.s.empInfo["xOffset"] <- 0 + cockpit.s.empInfo["yOffset"] <- 0 + cockpit.s.empInfo["startTime"] <- 0 + cockpit.s.empInfo["duration"] <- 0 + cockpit.s.empInfo["sub_count"] <- 0 + cockpit.s.empInfo["sub_start"] <- 0 + cockpit.s.empInfo["sub_duration"] <- 0 + cockpit.s.empInfo["sub_pause"] <- 0 + cockpit.s.empInfo["sub_alpha"] <- 0 + + cockpit.s.cockpitType <- 1 + cockpit.s.FOV <- 70 + + cockpit.e.body = CreateCockpitBody( cockpit, player, cockpitParent ) + + thread TitanCockpitAnimThink( cockpit, cockpit.e.body ) + + if ( player.IsTitan() && IsAlive( player ) ) // pilot with titan cockpit gets thrown from titan + thread TitanCockpitDoomedThink( cockpit, player ) + + SetCockpitLightingEnabled( 0, true ) + ShowRUIHUD( cockpit ) +} + +//bind r "script_client ReloadScripts();script_client GetLocalViewPlayer().GetCockpit().Destroy()" +void function ShowRUIHUD( entity cockpit ) +{ + // update topo positions + int cameraAttachId = cockpit.LookupAttachment( "CAMERA" ) + vector cameraOrigin = cockpit.GetAttachmentOrigin( cameraAttachId ) + + int lowerScreenAttachId = cockpit.LookupAttachment( "COCKPIT_HUD_BOTTOM" ) + vector lowerScreenOrigin = cockpit.GetAttachmentOrigin( lowerScreenAttachId ) + vector lowerScreenAngles = cockpit.GetAttachmentAngles( lowerScreenAttachId ) + + int instrument1AttachId = cockpit.LookupAttachment( "COCKPIT_OBJ_1" ) + vector instrument1Origin = cockpit.GetAttachmentOrigin( instrument1AttachId ) + vector instrument1Angles = cockpit.GetAttachmentAngles( instrument1AttachId ) + + lowerScreenOrigin = lowerScreenOrigin - cameraOrigin + vector lowerScreenPosition = + + instrument1Origin = instrument1Origin - cameraOrigin + vector instrument1Position = + vector instrument1RightVector = AnglesToRight( instrument1Angles ) * -1 + vector instrument1DownVector = AnglesToUp( instrument1Angles ) * -1 + + RuiTopology_UpdatePos( clGlobal.topoTitanCockpitLowerHud, lowerScreenPosition, <0, -TITAN_COCKPIT_LOWER_RUI_SCREEN_SQUARE_SIZE, 0>, <0, 0, -(TITAN_COCKPIT_LOWER_RUI_SCREEN_SQUARE_SIZE * TITAN_COCKPIT_LOWER_RUI_SCREEN_HEIGHT_SCALE)> ) + RuiTopology_UpdatePos( clGlobal.topoTitanCockpitInstrument1, instrument1Position - (instrument1RightVector * TITAN_COCKPIT_INSTRUMENT1_RUI_SCREEN_SQUARE_SIZE * 0.5) - (instrument1DownVector * TITAN_COCKPIT_INSTRUMENT1_RUI_SCREEN_SQUARE_SIZE * 0.5), instrument1RightVector * TITAN_COCKPIT_INSTRUMENT1_RUI_SCREEN_SQUARE_SIZE, instrument1DownVector * TITAN_COCKPIT_INSTRUMENT1_RUI_SCREEN_SQUARE_SIZE ) + + // create ruis + entity player = GetLocalViewPlayer() + + #if SP + file.coreHintRui = CreateTitanCockpitRui( $"ui/core_hint.rpak" ) + #endif + + file.cockpitRui = CreateTitanCockpitRui( $"ui/ajax_cockpit_base.rpak" ) + RuiTrackFloat3( file.cockpitRui, "playerOrigin", player, RUI_TRACK_ABSORIGIN_FOLLOW ) + RuiTrackFloat3( file.cockpitRui, "playerEyeAngles", player, RUI_TRACK_EYEANGLES_FOLLOW ) + RuiTrackFloat( file.cockpitRui, "healthFrac", player, RUI_TRACK_HEALTH ) + RuiTrackFloat( file.cockpitRui, "shieldFrac", player, RUI_TRACK_SHIELD_FRACTION ) + RuiTrackFloat( file.cockpitRui, "dashFrac", player, RUI_TRACK_PLAYER_SUIT_POWER ) + RuiSetFloat( file.cockpitRui, "ejectManualTimeOut", EJECT_FADE_TIME ) + RuiSetFloat( file.cockpitRui, "ejectButtonTimeOut", TITAN_EJECT_MAX_PRESS_DELAY ) + RuiSetGameTime( file.cockpitRui, "ejectManualStartTime", -60.0 ) + RuiSetGameTime( file.cockpitRui, "ejectButtonPressTime", -60.0 ) + #if MP + string titanName = GetTitanCharacterName( player ) + if ( titanName == "vanguard" ) + { + RuiSetString( file.cockpitRui, "titanInfo1", GetVanguardCoreString( player, 1 ) ) + RuiSetString( file.cockpitRui, "titanInfo2", GetVanguardCoreString( player, 2 ) ) + RuiSetString( file.cockpitRui, "titanInfo3", GetVanguardCoreString( player, 3 ) ) + RuiSetString( file.cockpitRui, "titanInfo4", GetVanguardCoreString( player, 4 ) ) + } + + file.cockpitAdditionalRui = CreateTitanCockpitRui( $"ui/ajax_cockpit_fd.rpak" ) + RuiSetFloat( file.cockpitAdditionalRui, "ejectManualTimeOut", EJECT_FADE_TIME ) + RuiSetFloat( file.cockpitAdditionalRui, "ejectButtonTimeOut", TITAN_EJECT_MAX_PRESS_DELAY ) + RuiSetGameTime( file.cockpitAdditionalRui, "ejectManualStartTime", -60.0 ) + + RuiSetDrawGroup( file.cockpitAdditionalRui, RUI_DRAW_NONE ) + #endif + +#if SP + bool ejectIsAllowed = false +#else + bool ejectIsAllowed = !TitanEjectIsDisabled() +#endif + RuiSetBool( file.cockpitRui, "ejectIsAllowed", ejectIsAllowed ) + + string playerSettings = GetLocalViewPlayer().GetPlayerSettings() + float health = player.GetPlayerModHealth() + float healthPerSegment = GetPlayerSettingsFieldForClassName_HealthPerSegment( playerSettings ) + RuiSetInt( file.cockpitRui, "numHealthSegments", int( health / healthPerSegment ) ) + RuiTrackFloat( file.cockpitRui, "cockpitColor", player, RUI_TRACK_STATUS_EFFECT_SEVERITY, eStatusEffect.cockpitColor ) + + file.cockpitLowerRui = CreateTitanCockpitLowerRui( $"ui/ajax_cockpit_lower.rpak" ) + RuiTrackFloat( file.cockpitLowerRui, "dashFrac", player, RUI_TRACK_PLAYER_SUIT_POWER ) + RuiTrackFloat3( file.cockpitLowerRui, "playerEyeAngles", player, RUI_TRACK_EYEANGLES_FOLLOW ) + RuiTrackFloat( file.cockpitLowerRui, "cockpitColor", player, RUI_TRACK_STATUS_EFFECT_SEVERITY, eStatusEffect.cockpitColor ) + + var instrument1Rui = CreateTitanCockpitInstrument1Rui( $"ui/ajax_cockpit_insturment1.rpak" ) + RuiTrackFloat3( instrument1Rui, "playerEyeAngles", player, RUI_TRACK_EYEANGLES_FOLLOW ) + + int numDashPips = int( floor( 100 / GetSettingsForPlayer_DodgeTable( GetLocalViewPlayer() )["dodgePowerDrain"] ) ) + RuiSetInt( file.cockpitRui, "numDashSegments", numDashPips ) + RuiSetInt( file.cockpitLowerRui, "numDashSegments", numDashPips ) + + thread CockpitDoomedThink( cockpit ) + thread TitanCockpitDestroyRuisOnDeath( cockpit ) + thread TitanCockpitHealthChangedThink( cockpit, player ) + + #if MP + if ( GetCurrentPlaylistVarInt( "aegis_upgrades", 0 ) == 1 && !IsSpectating() && !IsWatchingKillReplay() ) + thread DisplayFrontierRank( file.isFirstBoot ) + #endif + file.isFirstBoot = false + + UpdateTitanCockpitVisibility() +} + +#if MP +void function DisplayFrontierRank( bool isFirstBoot = true ) +{ + GetLocalClientPlayer().Signal( "DisplayFrontierRank" ) + GetLocalClientPlayer().EndSignal( "DisplayFrontierRank" ) + + wait 2.0 + + TitanLoadoutDef titanLoadout = GetTitanLoadoutFromPersistentData( GetLocalClientPlayer(), GetPersistentSpawnLoadoutIndex( GetLocalClientPlayer(), "titan" ) ) + string titanClass = titanLoadout.titanClass + + array titanUpgrades = FD_GetUpgradesForTitanClass( titanClass ) + int maxActiveIndex + foreach ( index, item in titanUpgrades ) + { + RuiSetImage( file.cockpitAdditionalRui, "upgradeIcon" + (index + 1), item.image ) + RuiSetString( file.cockpitAdditionalRui, "upgradeName" + (index + 1), item.name ) + + if ( !IsSubItemLocked( GetLocalClientPlayer(), item.ref, item.parentRef ) ) + maxActiveIndex++ + } + + RuiSetDrawGroup( file.cockpitAdditionalRui, RUI_DRAW_COCKPIT ) + + bool firstBootDisplay + if ( GameRules_GetGameMode() == FD ) + firstBootDisplay = isFirstBoot || !GetGlobalNetBool( "FD_waveActive" ) + else + firstBootDisplay = isFirstBoot + + RuiSetBool( file.cockpitAdditionalRui, "isFirstBoot", firstBootDisplay ) + RuiSetImage( file.cockpitAdditionalRui, "titanIcon", GetIconForTitanClass( titanClass ) ) + RuiSetInt( file.cockpitAdditionalRui, "titanRank", FD_TitanGetLevel( GetLocalClientPlayer(), titanClass ) ) + RuiSetInt( file.cockpitAdditionalRui, "maxActiveIndex", maxActiveIndex ) + RuiSetGameTime( file.cockpitAdditionalRui, "updateTime", Time() ) + + EmitSoundOnEntity( GetLocalClientPlayer(), "UI_InGame_FD_MetaUpgradeAnnouncement" ) + + if ( firstBootDisplay ) + { + wait 2.0 + + for ( int index = 0; index < maxActiveIndex; index++ ) + { + EmitSoundOnEntity( GetLocalClientPlayer(), "UI_InGame_FD_MetaUpgradeTextAppear" ) + + wait 0.85 + + EmitSoundOnEntity( GetLocalClientPlayer(), "UI_InGame_FD_MetaUpgradeBarFill" ) + + wait 0.15 + } + } + else + { + wait 0.5 + + for ( int index = 0; index < maxActiveIndex; index++ ) + { + EmitSoundOnEntity( GetLocalClientPlayer(), "UI_InGame_FD_MetaUpgradeBarFill" ) + wait 0.05 + } + } +} + +string function GetVanguardCoreString( entity player, int index ) +{ + Assert( player.IsTitan() ) + + if ( !IsConnected() ) //Persistence isn't available when we disconnect + return "" + + if ( player != GetLocalClientPlayer() ) //Client Persistence doesn't know about other players. + return "" + + TitanLoadoutDef loadout = GetActiveTitanLoadout( player ) + + entity soul = player.GetTitanSoul() + if ( !IsValid( soul ) ) + return "" + + if ( index == 1 ) + { + if ( soul.GetTitanSoulNetInt( "upgradeCount" ) >= 1 ) + { + return Localize( "#TITAN_UPGRADE_STATUS_N_N", Localize( "#TITAN_UPGRADE1_TITLE" ), Localize( GetItemName( loadout.passive4 ) ) ) + } + else + { + return Localize( "#TITAN_UPGRADE_STATUS_N_N", Localize( "#TITAN_UPGRADE1_TITLE" ), Localize( "#UPGRADE_IN_PROGRESS" ) ) + } + } + if ( index == 2 ) + { + if ( soul.GetTitanSoulNetInt( "upgradeCount" ) >= 2 ) + { + return Localize( "#TITAN_UPGRADE_STATUS_N_N", Localize( "#TITAN_UPGRADE2_TITLE" ), Localize( GetItemName( loadout.passive5 ) ) ) + } + else + { + if ( soul.GetTitanSoulNetInt( "upgradeCount" ) >= 1 ) + return Localize( "#TITAN_UPGRADE_STATUS_N_N", Localize( "#TITAN_UPGRADE2_TITLE" ), Localize( "#UPGRADE_IN_PROGRESS" ) ) + else + return Localize( "#TITAN_UPGRADE_STATUS_N_N", Localize( "#TITAN_UPGRADE2_TITLE" ), Localize( "#UPGRADE_NOT_INSTALLED" ) ) + } + } + if ( index == 3 ) + { + if ( soul.GetTitanSoulNetInt( "upgradeCount" ) >= 3 ) + { + return Localize( "#TITAN_UPGRADE_STATUS_N_N", Localize( "#TITAN_UPGRADE3_TITLE" ), Localize( GetItemName( loadout.passive6 ) ) ) + } + else + { + if ( soul.GetTitanSoulNetInt( "upgradeCount" ) >= 2 ) + return Localize( "#TITAN_UPGRADE_STATUS_N_N", Localize( "#TITAN_UPGRADE3_TITLE" ), Localize( "#UPGRADE_IN_PROGRESS" ) ) + else + return Localize( "#TITAN_UPGRADE_STATUS_N_N", Localize( "#TITAN_UPGRADE3_TITLE" ), Localize( "#UPGRADE_NOT_INSTALLED" ) ) + } + } + if ( index == 4 ) + { + printt( loadout.passive4 ) + if ( loadout.passive4 == "pas_vanguard_core1" ) // Arc Rounds + { + entity offhandWeapon = player.GetOffhandWeapon( OFFHAND_RIGHT ) + if ( IsValid( offhandWeapon ) && ( offhandWeapon.HasMod( "missile_racks" ) || offhandWeapon.HasMod( "upgradeCore_MissileRack_Vanguard" ) ) ) + return Localize( "#TITAN_UPGRADE_STATUS_N_N", Localize( "#TITAN_UPGRADE4_TITLE" ), Localize( "#GEAR_VANGUARD_CORE2" ) ) + offhandWeapon = player.GetOffhandWeapon( OFFHAND_LEFT ) + if ( IsValid( offhandWeapon ) && ( offhandWeapon.HasMod( "energy_transfer" ) || offhandWeapon.HasMod( "energy_field_energy_transfer" ) ) ) + return Localize( "#TITAN_UPGRADE_STATUS_N_N", Localize( "#TITAN_UPGRADE4_TITLE" ), Localize( "#GEAR_VANGUARD_CORE3" ) ) + } + else if ( loadout.passive4 == "pas_vanguard_core2" ) // Missile Racks + { + entity weapon = player.GetMainWeapons()[0] + if ( IsValid( weapon ) && ( weapon.HasMod( "arc_rounds" ) || weapon.HasMod( "arc_rounds_with_battle_rifle" ) ) ) + return Localize( "#TITAN_UPGRADE_STATUS_N_N", Localize( "#TITAN_UPGRADE4_TITLE" ), Localize( "#GEAR_VANGUARD_CORE1" ) ) + entity offhandWeapon = player.GetOffhandWeapon( OFFHAND_LEFT ) + if ( IsValid( offhandWeapon ) && ( offhandWeapon.HasMod( "energy_transfer" ) || offhandWeapon.HasMod( "energy_field_energy_transfer" ) ) ) + return Localize( "#TITAN_UPGRADE_STATUS_N_N", Localize( "#TITAN_UPGRADE4_TITLE" ), Localize( "#GEAR_VANGUARD_CORE3" ) ) + } + else if ( loadout.passive4 == "pas_vanguard_core3" ) // Energy Transfer + { + entity weapon = player.GetMainWeapons()[0] + if ( IsValid( weapon ) && ( weapon.HasMod( "arc_rounds" ) || weapon.HasMod( "arc_rounds_with_battle_rifle" ) ) ) + return Localize( "#TITAN_UPGRADE_STATUS_N_N", Localize( "#TITAN_UPGRADE4_TITLE" ), Localize( "#GEAR_VANGUARD_CORE1" ) ) + entity offhandWeapon = player.GetOffhandWeapon( OFFHAND_RIGHT ) + if ( IsValid( offhandWeapon ) && ( offhandWeapon.HasMod( "missile_racks" ) || offhandWeapon.HasMod( "upgradeCore_MissileRack_Vanguard" ) ) ) + return Localize( "#TITAN_UPGRADE_STATUS_N_N", Localize( "#TITAN_UPGRADE4_TITLE" ), Localize( "#GEAR_VANGUARD_CORE2" ) ) + } + return "" + } + + unreachable +} +#endif + +void function SetUnlimitedDash( bool active ) +{ + if ( file.cockpitLowerRui == null ) + return + + RuiSetBool( file.cockpitLowerRui, "hasUnlimitedDash", active ) +} + +void function UpdateEjectHud_SetManualEjectStartTime( entity player ) +{ + float timeNow = Time() + player.p.ejectEnableTime = timeNow + + if ( file.cockpitRui != null ) + RuiSetGameTime( file.cockpitRui, "ejectManualStartTime", timeNow ) + + if ( file.cockpitAdditionalRui != null ) + RuiSetGameTime( file.cockpitAdditionalRui, "ejectManualStartTime", timeNow ) +} + +void function UpdateEjectHud_SetButtonPressTime( entity player ) +{ + float timeNow = Time() + player.p.ejectPressTime = timeNow + + if ( file.cockpitRui != null ) + RuiSetGameTime( file.cockpitRui, "ejectButtonPressTime", timeNow ) + + //if ( file.cockpitAdditionalRui != null ) + // RuiSetGameTime( file.cockpitAdditionalRui, "ejectButtonPressTime", timeNow ) +} + +void function UpdateEjectHud_SetButtonPressCount( entity player, int buttonCount ) +{ + player.p.ejectPressCount = buttonCount + + if ( file.cockpitRui != null ) + RuiSetInt( file.cockpitRui, "ejectButtonCount", buttonCount ) + + //if ( file.cockpitAdditionalRui != null ) + // RuiSetInt( file.cockpitAdditionalRui, "ejectButtonCount", buttonCount ) +} + +void function UpdateTitanCockpitVisibility() +{ + entity player = GetLocalViewPlayer() + if ( !IsValid( player ) ) + return + + if ( Tone_ShouldCreateTrackerHud( player ) ) + thread Tone_HudThink( player ) + else + player.Signal( "StopToneHud" ) + + foreach ( managedRUI in file.titanCockpitManagedRUIs ) + { + bool shouldCreate = managedRUI.shouldCreate() + if ( !managedRUI.exists && shouldCreate ) + { + var rui = managedRUI.create() + + bool found = false + foreach ( cockpitRui in player.p.titanCockpitRUIs ) + { + if ( cockpitRui.rui == rui ) + found = true + } + if ( !found ) + { + TitanCockpitRUI tcRUI + tcRUI.rui = rui + tcRUI.drawGroup = managedRUI.drawGroup + player.p.titanCockpitRUIs.append( tcRUI ) + } + + managedRUI.exists = true + } + else if ( managedRUI.exists && !shouldCreate ) + { + managedRUI.destroy() + managedRUI.exists = false + } + } + + bool isVisible = true + + int ceFlags = player.GetCinematicEventFlags() + if ( (ceFlags & CE_FLAG_INTRO) || (ceFlags & CE_FLAG_TITAN_3P_CAM) ) + isVisible = false + if ( clGlobal.isSoloDialogMenuOpen ) + isVisible = false + + for ( int i = player.p.titanCockpitRUIs.len() - 1; i >= 0; i-- ) + { + TitanCockpitRUI tcRUI = player.p.titanCockpitRUIs[ i ] + RuiSetDrawGroup( tcRUI.rui, isVisible ? tcRUI.drawGroup : RUI_DRAW_NONE ) + } +} + +void function AddTitanCockpitManagedRUI( var functionref() createFunc, void functionref() destroyFunc, bool functionref() shouldCreateFunc, int drawGroup ) +{ + TitanCockpitManagedRUI managedRUI + managedRUI.create = createFunc + managedRUI.destroy = destroyFunc + managedRUI.shouldCreate = shouldCreateFunc + managedRUI.drawGroup = drawGroup + + file.titanCockpitManagedRUIs.append( managedRUI ) +} + +void function CinematicEventFlagChanged( entity player ) +{ + UpdateTitanCockpitVisibility() +} + +void function CockpitDoomedThink( entity cockpit ) +{ + entity player = GetLocalViewPlayer() + cockpit.EndSignal( "OnDestroy" ) + + while ( IsAlive( player ) ) + { + entity soul = player.GetTitanSoul() + if ( !IsValid( soul ) ) //Defensive fix for bug 227087. Assumption is that the cockpit is likely to be destroyed soon if the soul is invalid. + return + if ( !soul.IsDoomed() ) + player.WaitSignal( "Doomed" ) + + SetCockpitUIDoomedState( true ) + + if ( !IsValid( soul ) ) //Defensive fix for bug 227087. Assumption is that the cockpit is likely to be destroyed soon if the soul is invalid. + return + if ( soul.IsDoomed() ) + player.WaitSignal( "TitanUnDoomed" ) + + SetCockpitUIDoomedState( false ) + } +} + +void function SetCockpitUIEjectingState( bool state ) +{ + if ( file.cockpitRui != null ) + RuiSetBool( file.cockpitRui, "isEjecting", state ) + + if ( file.cockpitAdditionalRui != null ) + RuiSetBool( file.cockpitAdditionalRui, "isEjecting", state ) + + if ( file.cockpitLowerRui != null ) + { + RuiSetBool( file.cockpitLowerRui, "isEjecting", state ) + if ( state ) + RuiSetString( file.cockpitLowerRui, "ejectPrompt", Localize( RollRandomEjectString() ) ) + else + RuiSetString( file.cockpitLowerRui, "ejectPrompt", "" ) + } +} + +void function SetCockpitUIDoomedState( bool state ) +{ + if ( file.cockpitRui != null ) + RuiSetBool( file.cockpitRui, "isDoomed", state ) + + if ( file.cockpitAdditionalRui != null ) + RuiSetBool( file.cockpitAdditionalRui, "isDoomed", state ) +} + +void function TitanCockpitDestroyRui( var ruiToDestroy ) +{ + if ( ruiToDestroy == null ) + return + + entity player = GetLocalViewPlayer() + + for ( int i = player.p.titanCockpitRUIs.len() - 1; i >= 0; i-- ) + { + TitanCockpitRUI tcRUI = player.p.titanCockpitRUIs[ i ] + if ( tcRUI.rui == ruiToDestroy ) + { + RuiDestroy( tcRUI.rui ) + player.p.titanCockpitRUIs.remove( i ) + } + } +} + +void function TitanCockpitDestroyRuisOnDeath( entity cockpit ) +{ + entity player = GetLocalViewPlayer() + + OnThreadEnd( + function() : ( cockpit ) + { + foreach ( managedRUI in file.titanCockpitManagedRUIs ) + { + if ( managedRUI.exists ) + { + managedRUI.destroy() + managedRUI.exists = false + } + } + + entity player = GetLocalViewPlayer() + for ( int i = player.p.titanCockpitRUIs.len() - 1; i >= 0; i-- ) + { + RuiDestroy( player.p.titanCockpitRUIs[ i ].rui ) + player.p.titanCockpitRUIs.remove( i ) + } + + player = GetLocalClientPlayer() + if ( IsValid( player ) ) + player.Signal( "DisplayFrontierRank" ) + file.cockpitAdditionalRui = null + file.cockpitRui = null + file.cockpitLowerRui = null + file.coreHintRui = null + } + ) + + player.EndSignal( "OnDeath" ) + cockpit.EndSignal( "OnDestroy" ) + WaitForever() +} + +function CockpitBodyThink( cockpit, cockpitBody ) +{ + cockpitBody.EndSignal( "OnDestroy" ) + + cockpit.WaitSignal( "OnDestroy" ) + + cockpitBody.Destroy() +} + + +entity function CreateCockpitBody( entity cockpit, entity player, entity cockpitParent ) +{ + #if SP + string bodySettings = DEFAULT_PILOT_SETTINGS + #else + string bodySettings = file.lastPilotSettings + if ( bodySettings == "" || bodySettings == "spectator" ) + bodySettings = Loadouts_GetSetFileForRequestedClass( player ) + if ( bodySettings == "" ) + bodySettings = "pilot_base" + #endif + + asset bodyModelName = GetPlayerSettingsAssetForClassName( bodySettings, "armsmodel" ) + #if DEV + if ( bodySettings == "" ) + { + CodeWarning( "Couldn't find armsmodel for set file: " + bodySettings ) + } + #endif + + entity cockpitBody = CreateClientSidePropDynamic( cockpitParent.GetOrigin(), Vector( 0, 0, 0 ), bodyModelName ) + cockpitBody.EnableRenderWithCockpit() + cockpitBody.SetOrigin( cockpit.GetOrigin() ) + cockpitBody.SetParent( cockpit ) + + thread CockpitBodyThink( cockpit, cockpitBody ) + + return cockpitBody +} + +function TitanEmbarkDSP( transitionTime ) +{ +} + +function TitanDisembarkDSP( transitionTime ) +{ +} + +function TitanCockpit_EMPFadeScale( entity cockpit, elapsedMod = 0 ) +{ + local fadeInTime = 0.0 + local fadeOutTime = 1.5 + local elapsedTime = Time() - cockpit.s.empInfo.startTime + elapsedTime += elapsedMod + + // ToDo: + // Fade in/out from last frames amount so it doesnt pop + // Make strength var to control max fade ( less strength returns max of like 0.5 ) + + //------------------------ + // EMP effect is finished + //------------------------ + + //printt( "elapsedTime:" + elapsedTime + " cockpit.s.empInfo.duration:" + cockpit.s.empInfo.duration + " fadeOutTime:" + fadeOutTime ) + if ( elapsedTime < cockpit.s.empInfo.duration - fadeOutTime ) + { + return 1.0 + } + + + if ( elapsedTime >= fadeInTime + cockpit.s.empInfo.duration + fadeOutTime ) + { + cockpit.s.empInfo.startTime = 0 + return 0.0 + } + + //------------------------ + // EMP effect is starting + //------------------------ + + if ( elapsedTime < fadeInTime ) + { + return GraphCapped( elapsedTime, 0.0, fadeInTime, 0.0, 1.0 ) + } + + //---------------------- + // EMP effect is ending + //---------------------- + + if ( elapsedTime > fadeInTime + cockpit.s.empInfo.duration ) + { + cockpit.s.empInfo["sub_count"] = 0 + return GraphCapped( elapsedTime, fadeInTime + cockpit.s.empInfo.duration, fadeInTime + cockpit.s.empInfo.duration + fadeOutTime, 1.0, 0.0 ) + } + + //--------------------- + // EMP flicker effect + //--------------------- + + // Time to start a new flicker + if ( cockpit.s.empInfo["sub_start"] == 0 ) + { + cockpit.s.empInfo["sub_start"] <- Time() + if ( cockpit.s.empInfo["sub_count"] == 0 ) + cockpit.s.empInfo["sub_pause"] <- RandomFloatRange( 0.5, 1.5 ) + else + cockpit.s.empInfo["sub_pause"] <- RandomFloat( 0.5 ) + cockpit.s.empInfo["sub_duration"] <- RandomFloatRange( 0.1, 0.4 ) + cockpit.s.empInfo["sub_alpha"] <- RandomFloatRange( 0.4, 0.9 ) + cockpit.s.empInfo["sub_count"]++; + } + local flickerElapsedTime = Time() - cockpit.s.empInfo["sub_start"] + + // Start a new flicker if the current one is finished + if ( flickerElapsedTime > cockpit.s.empInfo["sub_pause"] + cockpit.s.empInfo["sub_duration"] ) + cockpit.s.empInfo["sub_start"] = 0 + + if ( flickerElapsedTime < cockpit.s.empInfo["sub_pause"] ) + { + // Pause before the flicker + return 1.0 + } + else if ( flickerElapsedTime < cockpit.s.empInfo["sub_pause"] + ( cockpit.s.empInfo["sub_duration"] / 2.0 ) ) + { + // First half of the flicker + return GraphCapped( flickerElapsedTime, 0.0, cockpit.s.empInfo["sub_duration"] / 2.0, 1.0, cockpit.s.empInfo["sub_alpha"] ) + } + else + { + // Second half of the flicker + return GraphCapped( flickerElapsedTime, cockpit.s.empInfo["sub_duration"] / 2.0, cockpit.s.empInfo["sub_duration"], cockpit.s.empInfo["sub_alpha"], 1.0 ) + } +} + +function ServerCallback_TitanCockpitEMP( duration ) +{ + thread TitanCockpit_DoEMP( duration / 4 ) +} + +function TitanCockpit_DoEMP( duration ) +{ + entity player = GetLocalViewPlayer() + entity cockpit = player.GetCockpit() + + if ( !IsValid( cockpit ) ) + return + + if ( !player.IsTitan() ) + return + + if ( !player.s.inTitanCockpit ) + return + + Signal( player, "EMP" ) + EndSignal( player, "EMP" ) + player.EndSignal( "OnDestroy" ) + + // this needs tweaking... looks a bit artificial + ClientCockpitShake( 0.25, 3, 1.0, Vector( 0, 0, 1 ) ) // amplitude, frequency, duration, direction + + thread PlayCockpitEMPLights( cockpit, duration ) + + // Start the screens and vdu power outages + cockpit.s.empInfo.xOffset = RandomFloatRange( 0.5, 0.75 ) + cockpit.s.empInfo.yOffset = RandomFloatRange( 0.5, 0.75 ) + if ( CoinFlip() ) + cockpit.s.empInfo.xOffset *= -1 + if ( CoinFlip() ) + cockpit.s.empInfo.yOffset *= -1 + + cockpit.s.empInfo.startTime = Time() + cockpit.s.empInfo.duration = duration + + EmitSoundOnEntity( player, EMP_IMPARED_SOUND ) + wait duration + FadeOutSoundOnEntity( player, EMP_IMPARED_SOUND, 1.5 ) +} + +function PlayCockpitEMPLights( cockpit, duration ) +{ + duration += 1.5 // blend out + local attachID + local origin + local angles + local fxLights = [] + + string tagName = "COCKPIT" // SCR_CL_BL" + attachID = cockpit.LookupAttachment( tagName ) + origin = cockpit.GetAttachmentOrigin( attachID ) + origin.z -= 25 + angles = Vector( 0, 0, 0 ) + local lightTable = {} + lightTable.light <- CreateClientSideDynamicLight( origin, angles, Vector( 0.0, 0.0, 0.0 ), 80.0 ) + lightTable.modulate <- true + fxLights.append( lightTable ) + + wait 0.5 + + foreach ( fxLight in fxLights ) + { + fxLight.light.SetCockpitLight( true ) + } + + local startTime = Time() + local rate = 1.2 + + local endTime = Time() + duration + + while ( IsValid( cockpit ) ) + { + if ( Time() > endTime ) + break + + float subtractColor = GraphCapped( Time(), endTime - 0.25, endTime, 1.0, 0.0 ) + local pulseFrac = GetPulseFrac( rate, startTime ) + pulseFrac *= subtractColor + //pulseFrac -= fadeInColor + + foreach ( index, fxLight in fxLights ) + { + Assert( fxLight.modulate ) + fxLight.light.SetLightColor( Vector( pulseFrac, 0, 0 ) ) + + // the case where fxLight.modulate == false used to be handled by this script, which used undefined variable fadeInColor: + // fxLight.light.SetLightColor( Vector( fadeInColor, fadeInColor, fadeInColor ) ) + } + + WaitFrame() + } + + foreach ( fxLight in fxLights ) + { + fxLight.light.Destroy() + } +} + + +function TitanCockpit_IsBooting( cockpit ) +{ + return cockpit.GetTimeInCockpit() < 1.3 +} + +function TitanCockpitAnimThink( cockpit, body ) +{ + cockpit.SetOpenViewmodelOffset( 20.0, 0.0, 10.0 ) + cockpit.Anim_NonScriptedPlay( "atpov_cockpit_hatch_close_idle" ) + + if ( body ) + body.Anim_NonScriptedPlay( "atpov_cockpit_hatch_close_idle" ) +} + + +bool function IsDisplayingEjectInterface( entity player ) +{ + if ( !player.IsTitan() ) + return false + + if ( player.ContextAction_IsMeleeExecution() ) //Could just check for ContextAction_IsActive() if we need to be more general + return false + + if ( !GetDoomedState( player ) && Time() - player.p.ejectEnableTime > EJECT_FADE_TIME ) + return false + + if ( Riff_TitanExitEnabled() == eTitanExitEnabled.Never || Riff_TitanExitEnabled() == eTitanExitEnabled.DisembarkOnly ) + return false + + //if ( !CanDisembark( player ) ) + // return false + + return true +} + +void function PlayerPressed_Eject( entity player ) +{ + if ( !IsDisplayingEjectInterface( player ) ) + return + + if ( Time() - player.p.ejectPressTime > TITAN_EJECT_MAX_PRESS_DELAY ) + UpdateEjectHud_SetButtonPressCount( player, 0 ) + + if ( !IsAlive( player ) ) + return + + EmitSoundOnEntity( player, "titan_eject_xbutton" ) + EmitSoundOnEntity( player, "hud_boost_card_radar_jammer_redtextbeep_1p" ) + UpdateEjectHud_SetButtonPressTime( player ) + UpdateEjectHud_SetButtonPressCount( player, (player.p.ejectPressCount + 1) ) + + player.ClientCommand( "TitanEject " + player.p.ejectPressCount ) + + entity cockpit = player.GetCockpit() + if ( player.p.ejectPressCount < 3 || cockpit.s.ejectStartTime ) + return + + PlayerEjects( player, cockpit ) +} + +string function RollRandomEjectString() +{ + const int COCKPIT_EJECT_COMMON_COUNT = 6 + const int COCKPIT_EJECT_RARE_COUNT = 36 + const float CHANCE_FOR_RARE = 0.15 + + float randForType = RandomFloat( 1.0 ) + if ( randForType < CHANCE_FOR_RARE ) + { + int index = RandomInt( COCKPIT_EJECT_RARE_COUNT ) + string result = "#COCKPIT_EJECT_RARE_" + index + return result + } + + int index = RandomInt( COCKPIT_EJECT_COMMON_COUNT ) + string result = "#COCKPIT_EJECT_COMMON_" + index + return result +} + +void function PlayerEjects( entity player, entity cockpit ) //Note that this can be run multiple times in a frame, e.g. get damaged by 4 pellets of a shotgun that brings the Titan into a doomed state with auto eject. Not ideal +{ + // prevent animation from playing if player is in the middle of execution + if ( player.ContextAction_IsActive() && !player.ContextAction_IsBusy() ) + return + + player.Signal( "Ejecting" ) + + SetCockpitUIEjectingState( true ) + + local ejectAlarmSound + cockpit.s.ejectStartTime = Time() + string animationName + if ( GetNuclearPayload( player ) > 0 ) + { + animationName = "atpov_cockpit_eject_nuclear" + cockpit.Anim_NonScriptedPlay( animationName ) + if ( IsValid( cockpit.e.body ) ) + cockpit.e.body.Anim_NonScriptedPlay( "atpov_cockpit_eject_nuclear" ) + ejectAlarmSound = TITAN_NUCLEAR_DEATH_ALARM + } + else + { + animationName = "atpov_cockpit_eject" + cockpit.Anim_NonScriptedPlay( animationName ) + if ( IsValid( cockpit.e.body ) ) + cockpit.e.body.Anim_NonScriptedPlay( "atpov_cockpit_eject" ) + + ejectAlarmSound = TITAN_ALARM_SOUND + } + + thread LightingUpdateAfterOpeningCockpit() + thread EjectAudioThink( player, ejectAlarmSound ) + + float animDuration = cockpit.GetSequenceDuration( animationName ) + + thread MonitorPlayerEjectAnimBeingStuck( player, animDuration ) +} + +void function MonitorPlayerEjectAnimBeingStuck( entity player, float duration ) +{ + player.Signal( "MonitorPlayerEjectAnimBeingStuck" ) + player.EndSignal( "MonitorPlayerEjectAnimBeingStuck" ) + player.EndSignal( "OnDeath" ) + player.EndSignal( "OnDestroy" ) + player.EndSignal( "SettingsChanged" ) + + + wait duration + 2.0 // 1s as a buffer + + if ( player.IsTitan() ) + { + entity cockpit = player.GetCockpit() + cockpit.Anim_NonScriptedPlay( "atpov_cockpit_hatch_close_idle" ) + if ( IsValid( cockpit.e.body ) ) + cockpit.e.body.Anim_NonScriptedPlay( "atpov_cockpit_hatch_close_idle" ) + + SetCockpitUIEjectingState( false ) + } +} + +function ServerCallback_EjectConfirmed() +{ + if ( !IsWatchingReplay() ) + return + + entity player = GetLocalViewPlayer() + entity cockpit = player.GetCockpit() + + if ( !cockpit || !IsTitanCockpitModelName( cockpit.GetModelName() ) ) + return + + PlayerEjects( player, cockpit ) +} + +function EjectAudioThink( entity player, ejectAlarmSound = TITAN_ALARM_SOUND ) +{ + EmitSoundOnEntity( player, ejectAlarmSound ) + TitanCockpit_PlayDialog( player, "manualEjectNotice" ) + + player.EndSignal( "OnDeath" ) + + player.WaitSignal( "SettingsChanged" ) + + if ( player.GetPlayerClass() != "pilot" ) + return + + OnThreadEnd( + function() : ( player ) + { + if ( !IsAlive( player ) ) + { + StopSoundOnEntity( player, TITAN_EJECT_ASCENT ) + StopSoundOnEntity( player, TITAN_EJECT_DESCENT ) + } + else + { + FadeOutSoundOnEntity( player, TITAN_EJECT_ASCENT, 0.25 ) + FadeOutSoundOnEntity( player, TITAN_EJECT_DESCENT, 0.25 ) + } + + StopSoundOnEntity( player, TITAN_EJECT_APEX ) + } + ) + + EmitSoundOnEntity( player, TITAN_EJECT_BOOST ) + + float startTime = Time() + float duration = GetSoundDuration( TITAN_EJECT_ASCENT ) + EmitSoundOnEntity( player, TITAN_EJECT_ASCENT ) + float timeOut = duration - 0.25 + vector velocity + float diff = 0.0 + + const int STAGE_ASCENT = 1 + const int STAGE_APEX = 2 + const int STAGE_DESCENT = 3 + + int ejectStage = STAGE_ASCENT + + string currentSound = TITAN_EJECT_ASCENT + + while ( diff < timeOut ) + { + PerfStart( 127 ) + + diff = (Time() - startTime) + + velocity = player.GetVelocity() + float length = Length( velocity ) + + if ( diff > 0.5 ) + { + if ( player.IsOnGround() ) + { + PerfEnd( 127 ) + break + } + } + + if ( ejectStage != STAGE_DESCENT && velocity.z < 0 ) + { + FadeOutSoundOnEntity( player, TITAN_EJECT_ASCENT, 0.25 ) + timeOut = GetSoundDuration( TITAN_EJECT_DESCENT ) + EmitSoundOnEntity( player, TITAN_EJECT_DESCENT ) + currentSound = TITAN_EJECT_DESCENT + ejectStage = STAGE_DESCENT + } + else if ( ejectStage == STAGE_ASCENT && length < 400 ) + { + EmitSoundOnEntity( player, TITAN_EJECT_APEX ) + ejectStage = STAGE_APEX + } + + PerfEnd( 127 ) + + WaitFrame() + } +} + +function LightingUpdateAfterOpeningCockpit() +{ + while ( true ) + { + if ( !GetLocalViewPlayer().s.inTitanCockpit ) + break + WaitFrame() + } + + SetCockpitLightingEnabled( 0, false ) +} + + +function TonemappingUpdateAfterOpeningCockpit() //Deprecated, no longer used +{ + local duration = 3 + local tonemapMin = 2 + local tonemapMax = 5 + + while ( true ) + { + if ( !GetLocalViewPlayer().s.inTitanCockpit ) + break + WaitFrame() + } + + SetCockpitLightingEnabled( 0, false ) + + AutoExposureSetExposureCompensationBias( tonemapMax ) + AutoExposureSnap() + wait( 0.1 ) + + TitanDisembarkDSP( 0.5 ) + + local startTime = Time() + while ( true ) + { + local time = Time() - startTime + float factor = GraphCapped( time, 0, duration, 1, 0 ) + factor = factor * factor * factor + local toneMapScale = tonemapMin + (tonemapMax - tonemapMin) * factor + AutoExposureSetExposureCompensationBias( toneMapScale ) + AutoExposureSnap() + wait 0 + if ( factor == 0 ) + break + } + + AutoExposureSetExposureCompensationBias( 0 ) +} + +function ServerCallback_TitanEmbark() +{ + TitanCockpit_PlayDialog( GetLocalViewPlayer(), "embark" ) +} + +function ServerCallback_TitanDisembark() +{ + entity player = GetLocalViewPlayer() + + thread LightingUpdateAfterOpeningCockpit() + + //HideFriendlyIndicatorAndCrosshairNames() + + //PlayMusic( "Music_FR_Militia_PilotAction2" ) +} + + +function PlayerPressed_QuickDisembark( player ) +{ + player.ClientCommand( "TitanDisembark" ) +} + +void function PlayerPressed_EjectEnable( entity player ) +{ + if ( !player.IsTitan() ) + return + + if ( !IsAlive( player ) ) + return + + if ( IsValid( player.GetParent() ) ) + return + + if ( TitanEjectIsDisabled() ) + { + EmitSoundOnEntity( player, "CoOp_SentryGun_DeploymentDeniedBeep" ) + SetTimedEventNotification( 1.5, "" ) + SetTimedEventNotification( 1.5, "#NOTIFY_EJECT_DISABLED" ) + return + } + + if ( Riff_TitanExitEnabled() == eTitanExitEnabled.Never || Riff_TitanExitEnabled() == eTitanExitEnabled.DisembarkOnly ) + return + + //if ( !CanDisembark( player ) ) + // return + + if ( player.ContextAction_IsMeleeExecution() ) //Could just check for ContextAction_IsActive() if we need to be more general + return + + if ( player.GetHealth() == 1 ) + { + #if MP + if ( !FD_ReadyUpEnabled() ) + #endif + { + player.ClientCommand( "TitanEject " + 3 ) + return + } + } + + EmitSoundOnEntity( player, "titan_eject_dpad" ) + UpdateEjectHud_SetManualEjectStartTime( player ) + player.Signal( "UpdateRodeoAlert" ) // need this to hide titan stomp hint +} + +float function CalcJoltMagnitude( player, cockpit, joltDir, float damageAmount, damageType, int damageSourceID ) +{ + const float COCKPIT_MAX_JOLT_DAMAGE = 2000.0 + + float resultRaw = damageAmount / COCKPIT_MAX_JOLT_DAMAGE + return clamp( resultRaw, 0.0, 1.0 ) +} + +function JoltCockpit( cockpit, player, joltDir, float damageAmount, damageType, damageSourceId ) +{ + float severity = CalcJoltMagnitude( player, cockpit, joltDir, damageAmount, damageType, expect int( damageSourceId ) ) + player.CockpitJolt( joltDir, severity ) +} + +function RandomizeDir( dir, randPitch = 0, randYaw = 0, basePitch = 0, baseYaw = 0 ) +{ + local pitch = RandomFloatRange( -randPitch, randPitch ) + local yaw = RandomFloatRange( -randYaw, randYaw ) + local angles = VectorToAngles( dir ) + angles = AnglesCompose( angles, Vector( pitch, yaw, 0 ) ) + angles = AnglesCompose( angles, Vector( basePitch, baseYaw, 0 ) ) + return AnglesToForward( angles ) +} + +function TitanCockpitDoomedThink( cockpit, player ) +{ + cockpit.EndSignal( "OnDestroy" ) + + local titanSoul = player.GetTitanSoul() + + if ( titanSoul == null || !titanSoul.IsDoomed() ) + WaitSignal( player, "Doomed", "Ejecting" ) + + local color = Vector( 0.6, 0.06, 0 ) + local radius = 70.0 + + FlashCockpitLight( cockpit, color, radius, -1 ) +} + +void function TitanCockpitHealthChangedThink( cockpit, entity player ) +{ + cockpit.EndSignal( "OnDestroy" ) + + while ( true ) + { + table results = WaitSignal( player, "HealthChanged" ) + + if ( !IsAlive( player ) ) + continue + + float oldHealthFrac = float( results.oldHealth ) / float( player.GetMaxHealth() ) + float newHealthFrac = float( results.newHealth ) / float( player.GetMaxHealth() ) + + if ( oldHealthFrac > newHealthFrac ) + { + var rui = RuiCreate( $"ui/ajax_cockpit_lost_health_segment.rpak", clGlobal.topoTitanCockpitHud, RUI_DRAW_COCKPIT, 10 ) + RuiSetGameTime( rui, "startTime", Time() ) + RuiSetFloat( rui, "oldHealthFrac", oldHealthFrac ) + RuiSetFloat( rui, "newHealthFrac", newHealthFrac ) + + string playerSettings = GetLocalViewPlayer().GetPlayerSettings() + float health = player.GetPlayerModHealth() + float healthPerSegment = GetPlayerSettingsFieldForClassName_HealthPerSegment( playerSettings ) + RuiSetInt( rui, "numHealthSegments", int( health / healthPerSegment ) ) + } + } +} + + +function FlashCockpitLight( cockpit, color, radius, duration, tag = "SCR_CL_BL" ) +{ + cockpit.EndSignal( "TitanUnDoomed" ) + cockpit.EndSignal( "OnDestroy" ) + + local attachID = cockpit.LookupAttachment( tag ) + local origin = cockpit.GetAttachmentOrigin( attachID ) + local angles = Vector( 0, 0, 0 ) + + local fxLight = CreateClientSideDynamicLight( origin, angles, color, radius ) + fxLight.SetCockpitLight( true ) + fxLight.SetParent( cockpit ) + + OnThreadEnd( + function() : ( fxLight ) + { + fxLight.Destroy() + } + ) + + local startTime = Time() + local rate = 3.0 + + while ( IsValid( cockpit ) && (Time() < startTime + duration || duration == -1 ) ) + { + local pulseFrac = GetPulseFrac( rate, startTime ) + pulseFrac += 0.5 + fxLight.SetLightColor( Vector( color.x * pulseFrac, color.y * pulseFrac, color.z * pulseFrac ) ) + + WaitFrame() + } +} + +function PlayCockpitSparkFX_Internal( cockpit, string tagName ) +{ + expect entity( cockpit ) + + // this is called from a delaythread so needs valid check + if ( !IsValid( cockpit ) ) + return + + int attachID = cockpit.LookupAttachment( tagName ) + if ( attachID == 0 ) + { + tagName = CoinFlip() ? "FX_TL_PANEL" : "FX_TR_PANEL" + attachID = cockpit.LookupAttachment( tagName ) + Assert( attachID, "Could not find fallback attachment index " + attachID + " for '" + tagName + "'' in model " + GetLocalViewPlayer().GetCockpit().GetModelName() ) + } + + int fxID = GetParticleSystemIndex( $"xo_cockpit_spark_01" ) + int fxInstID = PlayFXOnTag( cockpit, fxID, attachID ) + + EffectSetIsWithCockpit( fxInstID, true ) +} + +function PlayCockpitSparkFX( cockpit, int sparkCount ) +{ + const int TAG_COUNT = 6 + const string[TAG_COUNT] cockpitFXEmitTags = [ "FX_TL_PANEL", "FX_TR_PANEL", "FX_TC_PANELA", "FX_TC_PANELB", "FX_BL_PANEL", "FX_BR_PANEL" ] + array playlist = [0,1,2,3,4,5] + playlist.randomize() + + for ( int idx = 0; idx < sparkCount; idx++ ) + { + int lookup = (idx % TAG_COUNT) + int tagIndex = playlist[lookup] + string tagName = cockpitFXEmitTags[tagIndex] + PlayCockpitSparkFX_Internal( cockpit, tagName ) + } +} + +const int DAMAGE_PER_SPARK = 1000 +const int SPARK_MULTIPLIER = 3 + +int function CalSparkCountForHit( entity player, float damageAmount, bool becameDoomed ) +{ + if ( becameDoomed ) + return 20 + if ( damageAmount <= 0 ) + return 0 + + int healthNow = player.GetHealth() + int healthPrev = healthNow + int( damageAmount ) + int healthMax = player.GetMaxHealth() + + bool isDoomed = GetDoomedState( player ) + int sparksNow = (healthNow / DAMAGE_PER_SPARK) + int sparksPrev = (healthPrev / DAMAGE_PER_SPARK) + if ( (healthPrev == healthMax) && !isDoomed ) + --sparksPrev // no spark on first damage + + int delta = (sparksPrev - sparksNow) + if ( delta < 0 ) + return 0 + + return (delta * SPARK_MULTIPLIER) +} + +function TitanCockpit_DamageFeedback( entity player, cockpit, float damageAmount, damageType, damageOrigin, damageSourceId, bool doomedNow, int doomedDamage ) +{ + RumbleForTitanDamage( damageAmount ) + + vector joltDir = Normalize( player.CameraPosition() - damageOrigin ) + float joltDamage = doomedNow ? float( doomedDamage ) : damageAmount + JoltCockpit( cockpit, player, joltDir, joltDamage, damageType, damageSourceId ) + + bool isShieldHit = (damageType & DF_SHIELD_DAMAGE) ? true : false + if ( isShieldHit ) + return + + int sparkCount = CalSparkCountForHit( player, damageAmount, doomedNow ); + //printt( "sparks: " + sparkCount + " dmg: " + damageAmount + " - " + player.GetHealth() + " / " + player.GetMaxHealth() ) + PlayCockpitSparkFX( cockpit, sparkCount ) +} + +function ServerCallback_TitanCockpitBoot() +{ + thread ServerCallback_TitanCockpitBoot_Internal() +} + +function ServerCallback_TitanCockpitBoot_Internal() +{ + AutoExposureSetExposureCompensationBias( -6 ) + AutoExposureSnap() + wait 0.1 + AutoExposureSetExposureCompensationBias( 0 ) +} + +function ServerCallback_TitanEMP( maxValue, duration, fadeTime, doFlash = true, doSound = true ) +{ + thread TitanEMP_Internal( maxValue, duration, fadeTime, doFlash, doSound ) +} + +function TitanEMP_Internal( maxValue, duration, fadeTime, doFlash = true, doSound = true ) +{ + entity player = GetLocalViewPlayer() + + player.Signal( "TitanEMP_Internal" ) + player.EndSignal( "TitanEMP_Internal" ) + + player.EndSignal( "OnDeath" ) + player.EndSignal( "SettingsChanged" ) + + local angles = Vector( 0, -90, 90 ) + + local wide = 16 + local tall = 9 + + float fovOffset = Graph( player.GetFOV(), 75, 120, 4, 2.5 ) + + local empVgui = CreateClientsideVGuiScreen( "vgui_titan_emp", VGUI_SCREEN_PASS_VIEWMODEL, Vector(0,0,0), Vector(0,0,0), wide, tall ); + + //empVgui.SetParent( player.GetViewModelEntity(), "CAMERA_BASE" ) + empVgui.SetRefract( true ) // Force refract resolve before drawing vgui. (This can cost GPU!) + empVgui.SetParent( player ) + empVgui.SetAttachOffsetOrigin( < fovOffset, wide / 2, -tall / 2 > ) + empVgui.SetAttachOffsetAngles( angles ) + + empVgui.GetPanel().WarpEnable() + + local EMPScreenFX = HudElement( "EMPScreenFX", empVgui.GetPanel() ) + local EMPScreenFlash = HudElement( "EMPScreenFlash", empVgui.GetPanel() ) + + OnThreadEnd( + function() : ( player, empVgui ) + { + empVgui.Destroy() + } + ) + + EMPScreenFX.Show() + EMPScreenFX.SetAlpha( maxValue * 255 ) + EMPScreenFX.FadeOverTimeDelayed( 0, fadeTime, duration ) + + if ( doFlash ) + { + EMPScreenFlash.Show() + EMPScreenFlash.SetAlpha( 255 ) + EMPScreenFlash.FadeOverTimeDelayed( 0, fadeTime + duration, 0 ) + } + + if ( doSound ) + { + EmitSoundOnEntity( player, EMP_IMPARED_SOUND ) + wait duration + FadeOutSoundOnEntity( player, EMP_IMPARED_SOUND, fadeTime ) + } + + wait fadeTime +} + + +void function LinkCoreHint( entity soul ) +{ + if ( file.coreHintRui == null ) + return + + RuiTrackFloat( file.coreHintRui, "coreFrac", soul, RUI_TRACK_SCRIPT_NETWORK_VAR, GetNetworkedVariableIndex( "coreAvailableFrac" ) ) +} + + +void function FlashCockpitHealth( vector color ) +{ + if ( file.cockpitRui == null ) + return + + RuiSetGameTime( file.cockpitRui, "startFlashTime", Time() ) + RuiSetFloat3( file.cockpitRui, "flashColor", color ) +} + +void function UpdateHealthSegmentCount() +{ + if ( file.cockpitRui == null ) + return + + entity player = GetLocalViewPlayer() + string playerSettings = player.GetPlayerSettings() + float health = player.GetPlayerModHealth() + float healthPerSegment = GetPlayerSettingsFieldForClassName_HealthPerSegment( playerSettings ) + RuiSetInt( file.cockpitRui, "numHealthSegments", int( health / healthPerSegment ) ) +} +#if MP +void function NetworkedVarChangedCallback_UpdateVanguardRUICoreStatus( entity soul, int oldValue, int newValue, bool actuallyChanged ) +{ + if ( file.cockpitRui == null ) + return + + if ( actuallyChanged == false ) + return + + entity player = GetLocalViewPlayer() + if ( !IsValid( player ) || !player.IsTitan() ) + return + + UpdateHealthSegmentCount() + + string titanName = GetTitanCharacterName( player ) + if ( titanName == "vanguard" ) + { + RuiSetString( file.cockpitRui, "titanInfo1", GetVanguardCoreString( player, 1 ) ) + RuiSetString( file.cockpitRui, "titanInfo2", GetVanguardCoreString( player, 2 ) ) + RuiSetString( file.cockpitRui, "titanInfo3", GetVanguardCoreString( player, 3 ) ) + RuiSetString( file.cockpitRui, "titanInfo4", GetVanguardCoreString( player, 4 ) ) + } +} +#endif + +var function Scorch_CreateHotstreakBar() +{ + Assert( file.scorchHotstreakRui == null ) + + file.scorchHotstreakRui = CreateFixedTitanCockpitRui( $"ui/scorch_hotstreak_bar.rpak" ) + + RuiTrackFloat( file.scorchHotstreakRui, "coreMeterMultiplier", GetLocalViewPlayer(), RUI_TRACK_SCRIPT_NETWORK_VAR, GetNetworkedVariableIndex( "coreMeterModifier" ) ) + + return file.scorchHotstreakRui +} + +void function Scorch_DestroyHotstreakBar() +{ + TitanCockpitDestroyRui( file.scorchHotstreakRui ) + file.scorchHotstreakRui = null +} + +bool function Scorch_ShouldCreateHotstreakBar() +{ + entity player = GetLocalViewPlayer() + + if ( !IsAlive( player ) ) + return false + + array mainWeapons = player.GetMainWeapons() + if ( mainWeapons.len() == 0 ) + return false + + entity primaryWeapon = mainWeapons[0] + return primaryWeapon.HasMod( "fd_hot_streak" ) +} -- cgit v1.2.3 From 74f0ee8b5807e2c46541cdbc3460165200051b07 Mon Sep 17 00:00:00 2001 From: JMM889901 <41163714+JMM889901@users.noreply.github.com> Date: Sat, 12 Nov 2022 14:15:03 +0000 Subject: Add eject quotes (#527) * Upload cl_titan_cockpit.nut * Add eject string in script * Moved to client * index issue + removed else so always returns * Apply suggestions from code review Co-authored-by: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> * Rest of the suggestions because github makes me want to cry * Commit suggestions from review GitHub really hates batching suggestions Co-authored-by: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> --- .../scripts/vscripts/client/cl_titan_cockpit.nut | 35 ++++++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'Northstar.Client') diff --git a/Northstar.Client/mod/scripts/vscripts/client/cl_titan_cockpit.nut b/Northstar.Client/mod/scripts/vscripts/client/cl_titan_cockpit.nut index 828f3056..4df1af42 100644 --- a/Northstar.Client/mod/scripts/vscripts/client/cl_titan_cockpit.nut +++ b/Northstar.Client/mod/scripts/vscripts/client/cl_titan_cockpit.nut @@ -36,6 +36,11 @@ global function UpdateEjectHud_SetButtonPressTime global function UpdateEjectHud_SetButtonPressCount global function SetUnlimitedDash + +// Added by northstar +global function AddCommonEjectMessage +global function AddRareEjectMessage + #if MP global function NetworkedVarChangedCallback_UpdateVanguardRUICoreStatus global function DisplayFrontierRank @@ -71,6 +76,9 @@ struct bool isFirstBoot = true var scorchHotstreakRui + // Added by northstar + array moddedRareEjectMessages + array moddedCommonEjectMessages } file function ClTitanCockpit_Init() @@ -1007,6 +1015,16 @@ void function PlayerPressed_Eject( entity player ) PlayerEjects( player, cockpit ) } +void function AddCommonEjectMessage( string message ) +{ + file.moddedCommonEjectMessages.append( message ) +} + +void function AddRareEjectMessage( string message ) +{ + file.moddedRareEjectMessages.append( message ) +} + string function RollRandomEjectString() { const int COCKPIT_EJECT_COMMON_COUNT = 6 @@ -1016,14 +1034,19 @@ string function RollRandomEjectString() float randForType = RandomFloat( 1.0 ) if ( randForType < CHANCE_FOR_RARE ) { - int index = RandomInt( COCKPIT_EJECT_RARE_COUNT ) - string result = "#COCKPIT_EJECT_RARE_" + index - return result + int index = RandomInt( COCKPIT_EJECT_RARE_COUNT + file.moddedRareEjectMessages.len() ) + if ( index < COCKPIT_EJECT_RARE_COUNT ) + return "#COCKPIT_EJECT_RARE_" + index + else + return file.moddedRareEjectMessages[index - COCKPIT_EJECT_RARE_COUNT] } - int index = RandomInt( COCKPIT_EJECT_COMMON_COUNT ) - string result = "#COCKPIT_EJECT_COMMON_" + index - return result + int index = RandomInt( COCKPIT_EJECT_COMMON_COUNT + file.moddedCommonEjectMessages.len() ) + if ( index < COCKPIT_EJECT_COMMON_COUNT ) + return "#COCKPIT_EJECT_COMMON_" + index + else + return file.moddedCommonEjectMessages[index - COCKPIT_EJECT_COMMON_COUNT] + } void function PlayerEjects( entity player, entity cockpit ) //Note that this can be run multiple times in a frame, e.g. get damaged by 4 pellets of a shotgun that brings the Titan into a doomed state with auto eject. Not ideal -- cgit v1.2.3 From 17d8f97607f51e75497ed413d0d80f8416a2b3e6 Mon Sep 17 00:00:00 2001 From: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Mon, 14 Nov 2022 22:22:52 +0000 Subject: Add missing `unreachable` to stop compile error (#528) --- Northstar.Client/mod/scripts/vscripts/client/cl_titan_cockpit.nut | 1 + 1 file changed, 1 insertion(+) (limited to 'Northstar.Client') diff --git a/Northstar.Client/mod/scripts/vscripts/client/cl_titan_cockpit.nut b/Northstar.Client/mod/scripts/vscripts/client/cl_titan_cockpit.nut index 4df1af42..8261b3fd 100644 --- a/Northstar.Client/mod/scripts/vscripts/client/cl_titan_cockpit.nut +++ b/Northstar.Client/mod/scripts/vscripts/client/cl_titan_cockpit.nut @@ -1047,6 +1047,7 @@ string function RollRandomEjectString() else return file.moddedCommonEjectMessages[index - COCKPIT_EJECT_COMMON_COUNT] + unreachable } void function PlayerEjects( entity player, entity cockpit ) //Note that this can be run multiple times in a frame, e.g. get damaged by 4 pellets of a shotgun that brings the Titan into a doomed state with auto eject. Not ideal -- cgit v1.2.3 From 3f80f07ac14dc210261601e7c59968b5d2c38e2c Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Wed, 16 Nov 2022 00:58:23 +0000 Subject: Use new system for adding keybinds to `kb_act.lst` (#529) --- Northstar.Client/kb_act.lst | 13 +++++++ Northstar.Client/mod/scripts/kb_act.lst | 63 --------------------------------- 2 files changed, 13 insertions(+), 63 deletions(-) create mode 100644 Northstar.Client/kb_act.lst delete mode 100644 Northstar.Client/mod/scripts/kb_act.lst (limited to 'Northstar.Client') diff --git a/Northstar.Client/kb_act.lst b/Northstar.Client/kb_act.lst new file mode 100644 index 00000000..1a4f7129 --- /dev/null +++ b/Northstar.Client/kb_act.lst @@ -0,0 +1,13 @@ +"blank" "==========================" +"blank" "NORTHSTAR" +"blank" "==========================" +"toggleconsole" "Toggle Developer Console" +"vote 1" "Vote 1" +"vote 2" "Vote 2" +"vote 3" "Vote 3" +"vote 4" "Vote 4" +"vote 5" "Vote 5" +"vote 6" "Vote 6" +"vote 7" "Vote 7" +"vote 8" "Vote 8" +"vote 9" "Vote 9" diff --git a/Northstar.Client/mod/scripts/kb_act.lst b/Northstar.Client/mod/scripts/kb_act.lst deleted file mode 100644 index 238d7eef..00000000 --- a/Northstar.Client/mod/scripts/kb_act.lst +++ /dev/null @@ -1,63 +0,0 @@ -"blank" "==========================" -"blank" "NORTHSTAR" -"blank" "==========================" -"toggleconsole" "Toggle Developer Console" -"vote 1" "Vote 1" -"vote 2" "Vote 2" -"vote 3" "Vote 3" -"vote 4" "Vote 4" -"vote 5" "Vote 5" -"vote 6" "Vote 6" -"vote 7" "Vote 7" -"vote 8" "Vote 8" -"vote 9" "Vote 9" -"blank" "==========================" -"blank" "#KEY_BINDINGS_HEADER_ACTIONS" -"blank" "==========================" -"+attack" "#FIRE" -"+zoom" "#AIM_MODIFIER" -"+toggle_zoom" "#TOGGLE_AIM_MODIFIER" -"+reload" "#RELOAD" -"+weaponCycle" "#SWITCH_WEAPONS_PILOT" -"weaponSelectPrimary0" "#SWITCH_TO_WEAPON1" -"weaponSelectPrimary1" "#SWITCH_TO_WEAPON2" -"weaponSelectPrimary2" "#SWITCH_TO_WEAPON3" -"+melee" "#MELEE" -"+offhand0" "#ORDNANCE_GRENADE" -"+offhand1" "#TACTICAL_ABILITY" -"+offhand2" "#TITAN_UTILITY_BIND" -"+use" "#USE_DISEMBARK" -"+scriptCommand1" "#DISABLE_EJECT_SAFETY_TITAN" -"+ability 1" "#SWITCH_TITAN_AI_MODE_PILOT" -"+ability 6" "#KEYBINDING_MENU_BURN_CARD" -"titan_loadout_select" "#TITAN_LOADOUT_SELECT" -"blank" "==========================" -"blank" "#KEY_BINDINGS_HEADER_MOVEMENT" -"blank" "==========================" -"+forward" "#MOVE_FORWARD" -"+back" "#MOVE_BACK" -"+moveleft" "#MOVE_LEFT" -"+moveright" "#MOVE_RIGHT" -"+speed" "#SPRINT" -"+ability 3" "#JUMP_PILOT_DASH_TITAN" -"+duck" "#CROUCH" -"+toggle_duck" "#TOGGLE_CROUCH" -"blank" "==========================" -"blank" "#KEY_BINDINGS_HEADER_COMMUNICATION" -"blank" "==========================" -"+pushtotalk" "#PUSH_TO_TALK_KEY" -"say" "#CHAT_MESSAGE" -"say_team" "#TEAM_CHAT_MESSAGE" -"blank" "==========================" -"blank" "#KEY_BINDINGS_HEADER_SCOREBOARD" -"blank" "==========================" -"+showscores" "#TOGGLE_SCOREBOARD" -"scoreboard_toggle_focus" "#SCOREBOARD_FOCUS" -"scoreboard_up" "#SCOREBOARD_SCROLL_UP" -"scoreboard_down" "#SCOREBOARD_SCROLL_DOWN" -"scoreboard_profile" "#SCOREBOARD_VIEW_PROFILE" -"scoreboard_mute" "#SCOREBOARD_MUTE" -"blank" "==========================" -"blank" "#KEY_BINDINGS_HEADER_MISCELLANEOUS" -"blank" "==========================" -"jpeg" "#SCREENSHOT" -- cgit v1.2.3 From 891c2afe222930d9bd5a0edb6471c9f7d8da2d42 Mon Sep 17 00:00:00 2001 From: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Thu, 1 Dec 2022 20:25:12 +0000 Subject: Remove unnecessary root table setting and make functions global (#534) * fix for CHudChat_ProcessMessageStartThread not working in native * remove unneeded NSSetupChathooksClient callback * fix for CServerGameDLL_ProcessMessageStartThread not working in native * remove unneeded NSSetupChathooksServer callback * remove root table setting for ServerToClientStringCommands_Init * remove unneeded ServerToClientStringCommands_Init callback * remove global function --- Northstar.Client/mod.json | 5 +---- .../mod/scripts/vscripts/_custom_codecallbacks_client.gnut | 9 ++++----- Northstar.CustomServers/mod.json | 10 ++-------- .../mod/scripts/vscripts/_custom_codecallbacks.gnut | 9 ++++----- .../scripts/vscripts/sh_server_to_client_stringcommands.gnut | 7 ------- 5 files changed, 11 insertions(+), 29 deletions(-) (limited to 'Northstar.Client') diff --git a/Northstar.Client/mod.json b/Northstar.Client/mod.json index 15853be7..3b236980 100644 --- a/Northstar.Client/mod.json +++ b/Northstar.Client/mod.json @@ -46,10 +46,7 @@ "Scripts": [ { "Path": "_custom_codecallbacks_client.gnut", - "RunOn": "CLIENT", - "ClientCallback": { - "Before": "NSSetupChathooksClient" - } + "RunOn": "CLIENT" }, { "Path": "client/cl_chat.gnut", diff --git a/Northstar.Client/mod/scripts/vscripts/_custom_codecallbacks_client.gnut b/Northstar.Client/mod/scripts/vscripts/_custom_codecallbacks_client.gnut index 3caf4336..811874c5 100644 --- a/Northstar.Client/mod/scripts/vscripts/_custom_codecallbacks_client.gnut +++ b/Northstar.Client/mod/scripts/vscripts/_custom_codecallbacks_client.gnut @@ -1,7 +1,10 @@ untyped global function AddCallback_OnReceivedSayTextMessage -global function NSSetupChathooksClient + +// this is global due to squirrel bridge v3 making native not be able to find non-global funcs properly +// temp fix (surely it will get replaced), do not use this function please (although there isnt rly a downside to it?) +global function CHudChat_ProcessMessageStartThread global struct ClClient_MessageStruct { string message @@ -135,7 +138,3 @@ void function AddCallback_OnReceivedSayTextMessage( ClClient_MessageStruct funct { NsCustomCallbacksClient.OnReceivedSayTextMessageCallbacks.append(callbackFunc) } - -void function NSSetupChathooksClient() { - getroottable().rawset("CHudChat_ProcessMessageStartThread", CHudChat_ProcessMessageStartThread) -} diff --git a/Northstar.CustomServers/mod.json b/Northstar.CustomServers/mod.json index 2ed89910..f67aeb19 100644 --- a/Northstar.CustomServers/mod.json +++ b/Northstar.CustomServers/mod.json @@ -58,10 +58,7 @@ "Scripts": [ { "Path": "_custom_codecallbacks.gnut", - "RunOn": "SERVER", - "ServerCallback": { - "Before": "NSSetupChathooksServer" - } + "RunOn": "SERVER" }, { "Path": "_northstar_cheatcommands.nut", @@ -104,10 +101,7 @@ }, { "Path": "sh_server_to_client_stringcommands.gnut", - "RunOn": "CLIENT || SERVER", - "ClientCallback": { - "After": "ServerToClientStringCommands_Init" - } + "RunOn": "CLIENT || SERVER" }, { "Path": "gamemodes/_gamemode_fra.nut", diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_custom_codecallbacks.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_custom_codecallbacks.gnut index 4a7f8189..ee21116d 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/_custom_codecallbacks.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/_custom_codecallbacks.gnut @@ -1,7 +1,10 @@ untyped global function AddCallback_OnReceivedSayTextMessage -global function NSSetupChathooksServer + +// this is global due to squirrel bridge v3 making native not be able to find non-global funcs properly +// temp fix (surely it will get replaced), do not use this function please +global function CServerGameDLL_ProcessMessageStartThread global struct ClServer_MessageStruct { string message @@ -53,7 +56,3 @@ void function AddCallback_OnReceivedSayTextMessage( ClServer_MessageStruct funct { NsCustomCallbacks.OnReceivedSayTextMessageCallbacks.append(callbackFunc) } - -void function NSSetupChathooksServer() { - getroottable().rawset("CServerGameDLL_ProcessMessageStartThread", CServerGameDLL_ProcessMessageStartThread) -} diff --git a/Northstar.CustomServers/mod/scripts/vscripts/sh_server_to_client_stringcommands.gnut b/Northstar.CustomServers/mod/scripts/vscripts/sh_server_to_client_stringcommands.gnut index a51e528f..18df6a6f 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/sh_server_to_client_stringcommands.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/sh_server_to_client_stringcommands.gnut @@ -1,6 +1,4 @@ #if CLIENT -global function ServerToClientStringCommands_Init - global function AddServerToClientStringCommandCallback global function NSClientCodeCallback_RecievedServerToClientStringCommand #endif @@ -14,11 +12,6 @@ struct { table< string, array< void functionref( array args ) > > callbacks } file -void function ServerToClientStringCommands_Init() -{ - getroottable().rawset( "NSClientCodeCallback_RecievedServerToClientStringCommand", NSClientCodeCallback_RecievedServerToClientStringCommand ) -} - void function AddServerToClientStringCommandCallback( string command, void functionref( array args ) callback ) { if ( !( command in file.callbacks ) ) -- cgit v1.2.3 From a4606ba8c3c6d816499ab73b6633dd1f33728adb Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Sun, 4 Dec 2022 23:04:45 +0100 Subject: Display server region in serverbrowser (#479) * Replace latency column with region in serverbrowser * Add English and German localisation * Mark remaining localisations as TODOs * Enable filtering by region using search field * Update tchinese translation for display server region in serverbrowser (#484) * Add French translation * Add Japanese translation * Add Portuguese translation * Add Russian translation * Add Spanish translation * Add Italian translation * Add Mexican Spanish translation --- .../northstar_client_localisation_english.txt | 2 +- .../northstar_client_localisation_french.txt | 2 +- .../northstar_client_localisation_german.txt | 2 +- .../northstar_client_localisation_italian.txt | 2 +- .../northstar_client_localisation_japanese.txt | 2 +- .../northstar_client_localisation_mspanish.txt | 2 +- .../northstar_client_localisation_portuguese.txt | 2 +- .../northstar_client_localisation_russian.txt | 2 +- .../northstar_client_localisation_spanish.txt | 2 +- .../northstar_client_localisation_tchinese.txt | 2 +- .../mod/resource/ui/menus/server_browser.menu | 70 +++++++++++----------- .../scripts/vscripts/ui/menu_ns_serverbrowser.nut | 43 ++++++------- 12 files changed, 67 insertions(+), 66 deletions(-) (limited to 'Northstar.Client') diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt index 3382e5b1..c25708a6 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt @@ -276,7 +276,7 @@ Press Yes if you agree to this. This choice can be changed in the mods menu at a "PLAYERS_COLUMN" "Players" "MAP_COLUMN" "Map" "GAMEMODE_COLUMN" "Gamemode" - "LATENCY_COLUMN" "Latency" + "REGION_COLUMN" "Region" "SEARCHBAR_LABEL" "Search:" "MAP_FILTER" "Map" "GAMEMODE_FILTER" "Gamemode" diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_french.txt b/Northstar.Client/mod/resource/northstar_client_localisation_french.txt index 276698a0..2a199186 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_french.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_french.txt @@ -276,7 +276,7 @@ Choisissez Oui si vous êtes d'accord. Ce choix peut être modifié à tout inst "PLAYERS_COLUMN" "Joueurs" "MAP_COLUMN" "Carte" "GAMEMODE_COLUMN" "Mode de jeu" - "LATENCY_COLUMN" "Latence" + "REGION_COLUMN" "Région" "SEARCHBAR_LABEL" "Recherche :" "MAP_FILTER" "Carte" "GAMEMODE_FILTER" "Mode de jeu" diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_german.txt b/Northstar.Client/mod/resource/northstar_client_localisation_german.txt index 9077fac0..0316bbcf 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_german.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_german.txt @@ -267,7 +267,7 @@ Drücke Ja, um zuzustimmen. Du kannst diese Entscheidung jederzeit im Modmenü "PLAYERS_COLUMN" "Spieler" "MAP_COLUMN" "Karte" "GAMEMODE_COLUMN" "Modus" - "LATENCY_COLUMN" "Ping" + "REGION_COLUMN" "Region" "SEARCHBAR_LABEL" "Suche:" "MAP_FILTER" "Karte" "GAMEMODE_FILTER" "Modus" diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_italian.txt b/Northstar.Client/mod/resource/northstar_client_localisation_italian.txt index b0bc348f..72bf7030 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_italian.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_italian.txt @@ -275,7 +275,7 @@ Premi Sì se sei d'accordo. Questa scelta può essere modificata in qualsiasi mo "PLAYERS_COLUMN" "Players" "MAP_COLUMN" "Mappa" "GAMEMODE_COLUMN" "Modalità" - "LATENCY_COLUMN" "Latenza" + "REGION_COLUMN" "Regione" "SEARCHBAR_LABEL" "Cerca:" "MAP_FILTER" "Mappa" "GAMEMODE_FILTER" "Modalità" diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_japanese.txt b/Northstar.Client/mod/resource/northstar_client_localisation_japanese.txt index b35c9fb8..b7fadeaf 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_japanese.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_japanese.txt @@ -303,7 +303,7 @@ "PLAYERS_COLUMN" "プレイヤー" "MAP_COLUMN" "マップ" "GAMEMODE_COLUMN" "ゲームモード" - "LATENCY_COLUMN" "レイテンシー" + "REGION_COLUMN" "領域" "SEARCHBAR_LABEL" "検索:" "MAP_FILTER" "マップ" "GAMEMODE_FILTER" "ゲームモード" diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_mspanish.txt b/Northstar.Client/mod/resource/northstar_client_localisation_mspanish.txt index 208747f9..18634668 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_mspanish.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_mspanish.txt @@ -276,7 +276,7 @@ Si estas de acuerdo con esto, presiona SI. Esta decision puede ser cambiada en e "PLAYERS_COLUMN" "Jugadores" "MAP_COLUMN" "Mapa" "GAMEMODE_COLUMN" "Modo de juego" - "LATENCY_COLUMN" "Latencia" + "REGION_COLUMN" "Región" "SEARCHBAR_LABEL" "Buscar:" "MAP_FILTER" "Mapa" "GAMEMODE_FILTER" "Modo de juego" diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_portuguese.txt b/Northstar.Client/mod/resource/northstar_client_localisation_portuguese.txt index d398e557..51854726 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_portuguese.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_portuguese.txt @@ -274,7 +274,7 @@ Clique em Sim se você concorda. Esta escolha pode ser alterada a qualquer momen "PLAYERS_COLUMN" "Jogadores" "MAP_COLUMN" "Mapa" "GAMEMODE_COLUMN" "Modo" - "LATENCY_COLUMN" "Latência" + "REGION_COLUMN" "Região" "SEARCHBAR_LABEL" "Buscar:" "MAP_FILTER" "Mapa" "GAMEMODE_FILTER" "Modo" diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_russian.txt b/Northstar.Client/mod/resource/northstar_client_localisation_russian.txt index af9eb0ff..9ce0c2e3 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_russian.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_russian.txt @@ -219,7 +219,7 @@ "PLAYERS_COLUMN" "Игроки" "MAP_COLUMN" "Карта" "GAMEMODE_COLUMN" "Режим игры" - "LATENCY_COLUMN" "Задержка" + "REGION_COLUMN" "Регион" "SEARCHBAR_LABEL" "Поиск:" "MAP_FILTER" "Карта" "GAMEMODE_FILTER" "Режим игры" diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_spanish.txt b/Northstar.Client/mod/resource/northstar_client_localisation_spanish.txt index fa732b63..0dc82570 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_spanish.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_spanish.txt @@ -276,7 +276,7 @@ Presiona Sí al estar de acuerdo. Esta opcion se puede cambiar en el menú de mo "PLAYERS_COLUMN" "Jugadores" "MAP_COLUMN" "Mapa" "GAMEMODE_COLUMN" "Modo de juego" - "LATENCY_COLUMN" "Latencia" + "REGION_COLUMN" "Región" "SEARCHBAR_LABEL" "Buscar:" "MAP_FILTER" "Mapa" "GAMEMODE_FILTER" "Modo de juego" diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_tchinese.txt b/Northstar.Client/mod/resource/northstar_client_localisation_tchinese.txt index 276a192d..12b6cad1 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_tchinese.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_tchinese.txt @@ -276,7 +276,7 @@ "PLAYERS_COLUMN" "玩家" "MAP_COLUMN" "地圖" "GAMEMODE_COLUMN" "遊戲模式" - "LATENCY_COLUMN" "延遲" + "REGION_COLUMN" "地區" "SEARCHBAR_LABEL" "搜尋:" "MAP_FILTER" "地圖" "GAMEMODE_FILTER" "遊戲模式" diff --git a/Northstar.Client/mod/resource/ui/menus/server_browser.menu b/Northstar.Client/mod/resource/ui/menus/server_browser.menu index d25d1219..b66fb8a6 100644 --- a/Northstar.Client/mod/resource/ui/menus/server_browser.menu +++ b/Northstar.Client/mod/resource/ui/menus/server_browser.menu @@ -1178,7 +1178,7 @@ resource/ui/menus/mods_browse.menu pin_to_sibling_corner TOP_RIGHT navDown BtnServer1 navLeft BtnServerMapTab - navRight BtnServerLatencyTab + navRight BtnServerRegionTab navUp BtnFiltersClear } @@ -1408,12 +1408,12 @@ resource/ui/menus/mods_browse.menu pin_to_sibling_corner BOTTOM_LEFT } - // Latency - BtnServerLatencyTab + // Region + BtnServerRegionTab { ControlName RuiButton InheritProperties RuiSmallButton - labelText "#LATENCY_COLUMN" + labelText "#REGION_COLUMN" wide 110 xpos 4 @@ -1428,11 +1428,11 @@ resource/ui/menus/mods_browse.menu navUp BtnFiltersClear } - BtnServerLatency1 + BtnServerRegion1 { ControlName Label labelText "" - classname Serverlatency + classname Serverregion textAlignment center wide 110 tall 44 @@ -1443,11 +1443,11 @@ resource/ui/menus/mods_browse.menu pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner BOTTOM_LEFT } - BtnServerLatency2 + BtnServerRegion2 { ControlName Label labelText "" - classname Serverlatency + classname Serverregion textAlignment center wide 110 tall 44 @@ -1458,11 +1458,11 @@ resource/ui/menus/mods_browse.menu pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner BOTTOM_LEFT } - BtnServerLatency3 + BtnServerRegion3 { ControlName Label labelText "" - classname Serverlatency + classname Serverregion textAlignment center wide 110 tall 44 @@ -1473,11 +1473,11 @@ resource/ui/menus/mods_browse.menu pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner BOTTOM_LEFT } - BtnServerLatency4 + BtnServerRegion4 { ControlName Label labelText "" - classname Serverlatency + classname Serverregion textAlignment center wide 110 tall 44 @@ -1488,11 +1488,11 @@ resource/ui/menus/mods_browse.menu pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner BOTTOM_LEFT } - BtnServerLatency5 + BtnServerRegion5 { ControlName Label labelText "" - classname Serverlatency + classname Serverregion textAlignment center wide 110 tall 44 @@ -1503,11 +1503,11 @@ resource/ui/menus/mods_browse.menu pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner BOTTOM_LEFT } - BtnServerLatency6 + BtnServerRegion6 { ControlName Label labelText "" - classname Serverlatency + classname Serverregion textAlignment center wide 110 tall 44 @@ -1518,11 +1518,11 @@ resource/ui/menus/mods_browse.menu pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner BOTTOM_LEFT } - BtnServerLatency7 + BtnServerRegion7 { ControlName Label labelText "" - classname Serverlatency + classname Serverregion textAlignment center wide 110 tall 44 @@ -1533,11 +1533,11 @@ resource/ui/menus/mods_browse.menu pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner BOTTOM_LEFT } - BtnServerLatency8 + BtnServerRegion8 { ControlName Label labelText "" - classname Serverlatency + classname Serverregion textAlignment center wide 110 tall 44 @@ -1548,11 +1548,11 @@ resource/ui/menus/mods_browse.menu pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner BOTTOM_LEFT } - BtnServerLatency9 + BtnServerRegion9 { ControlName Label labelText "" - classname Serverlatency + classname Serverregion textAlignment center wide 110 tall 44 @@ -1563,11 +1563,11 @@ resource/ui/menus/mods_browse.menu pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner BOTTOM_LEFT } - BtnServerLatency10 + BtnServerRegion10 { ControlName Label labelText "" - classname Serverlatency + classname Serverregion textAlignment center wide 110 tall 44 @@ -1578,11 +1578,11 @@ resource/ui/menus/mods_browse.menu pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner BOTTOM_LEFT } - BtnServerLatency11 + BtnServerRegion11 { ControlName Label labelText "" - classname Serverlatency + classname Serverregion textAlignment center wide 110 tall 44 @@ -1593,11 +1593,11 @@ resource/ui/menus/mods_browse.menu pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner BOTTOM_LEFT } - BtnServerLatency12 + BtnServerRegion12 { ControlName Label labelText "" - classname Serverlatency + classname Serverregion textAlignment center wide 110 tall 44 @@ -1608,11 +1608,11 @@ resource/ui/menus/mods_browse.menu pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner BOTTOM_LEFT } - BtnServerLatency13 + BtnServerRegion13 { ControlName Label labelText "" - classname Serverlatency + classname Serverregion textAlignment center wide 110 tall 44 @@ -1623,11 +1623,11 @@ resource/ui/menus/mods_browse.menu pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner BOTTOM_LEFT } - BtnServerLatency14 + BtnServerRegion14 { ControlName Label labelText "" - classname Serverlatency + classname Serverregion textAlignment center wide 110 tall 44 @@ -1638,11 +1638,11 @@ resource/ui/menus/mods_browse.menu pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner BOTTOM_LEFT } - BtnServerLatency15 + BtnServerRegion15 { ControlName Label labelText "" - classname Serverlatency + classname Serverregion textAlignment center wide 110 tall 44 @@ -1737,7 +1737,7 @@ resource/ui/menus/mods_browse.menu xpos 3 ypos -1 - pin_to_sibling BtnServerLatencyTab + pin_to_sibling BtnServerRegionTab pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner TOP_LEFT } diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut index d9b11ccc..03028255 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut @@ -38,7 +38,7 @@ enum sortingBy PLAYERS, MAP, GAMEMODE, - LATENCY + REGION } // Column sort direction, only one of these can be aplied at once @@ -48,8 +48,8 @@ struct { bool serverPlayers = true bool serverMap = true bool serverGamemode = true - bool serverLatency = true - // 0 = none; 1 = default; 2 = name; 3 = players; 4 = map; 5 = gamemode; 6 = latency + bool serverRegion = true + // 0 = none; 1 = default; 2 = name; 3 = players; 4 = map; 5 = gamemode; 6 = region int sortingBy = 1 } filterDirection @@ -61,7 +61,7 @@ struct serverStruct { int serverPlayersMax string serverMap string serverGamemode - int serverLatency + string serverRegion } struct { @@ -87,7 +87,7 @@ struct { array serversProtected array serversMap array serversGamemode - array serversLatency + array serversRegion } file @@ -151,7 +151,7 @@ void function InitServerBrowserMenu() file.serversProtected = GetElementsByClassname( file.menu, "ServerLock" ) file.serversMap = GetElementsByClassname( file.menu, "ServerMap" ) file.serversGamemode = GetElementsByClassname( file.menu, "ServerGamemode" ) - file.serversLatency = GetElementsByClassname( file.menu, "ServerLatency" ) + file.serversRegion = GetElementsByClassname( file.menu, "Serverregion" ) filterArguments.filterMaps = [ "SWITCH_ANY" ] Hud_DialogList_AddListItem( Hud_GetChild( file.menu, "SwtBtnSelectMap" ), "SWITCH_ANY", "0" ) @@ -194,7 +194,7 @@ void function InitServerBrowserMenu() AddButtonEventHandler( Hud_GetChild( file.menu, "BtnServerPlayersTab"), UIE_CLICK, SortServerListByPlayers_Activate ) AddButtonEventHandler( Hud_GetChild( file.menu, "BtnServerMapTab"), UIE_CLICK, SortServerListByMap_Activate ) AddButtonEventHandler( Hud_GetChild( file.menu, "BtnServerGamemodeTab"), UIE_CLICK, SortServerListByGamemode_Activate ) - AddButtonEventHandler( Hud_GetChild( file.menu, "BtnServerLatencyTab"), UIE_CLICK, SortServerListByLatency_Activate ) + AddButtonEventHandler( Hud_GetChild( file.menu, "BtnServerRegionTab"), UIE_CLICK, SortServerListByRegion_Activate ) AddButtonEventHandler( Hud_GetChild( file.menu, "SwtBtnSelectMap"), UIE_CHANGE, FilterAndUpdateList ) @@ -218,8 +218,6 @@ void function InitServerBrowserMenu() Hud_SetText( Hud_GetChild( file.menu, "BtnServerDescription"), "" ) Hud_SetText( Hud_GetChild( file.menu, "BtnServerMods"), "" ) - // Unfinished features - Hud_SetLocked( Hud_GetChild( file.menu, "BtnServerLatencyTab" ), true ) // Rui is a pain RuiSetString( Hud_GetRui( Hud_GetChild( file.menu, "SwtBtnHideFull") ), "buttonText", "" ) @@ -675,9 +673,9 @@ void function FilterAndUpdateList( var n ) filterDirection.serverGamemode = !filterDirection.serverGamemode SortServerListByGamemode_Activate(0) break - case sortingBy.LATENCY: - filterDirection.serverLatency = !filterDirection.serverLatency - SortServerListByLatency_Activate(0) + case sortingBy.REGION: + filterDirection.serverRegion = !filterDirection.serverRegion + SortServerListByRegion_Activate(0) break default: printt( "How the f did you get here" ) @@ -715,7 +713,7 @@ void function WaitForServerListRequest() Hud_SetText( file.playerCountLabels[ i ], "" ) Hud_SetText( file.serversMap[ i ], "" ) Hud_SetText( file.serversGamemode[ i ], "" ) - Hud_SetText( file.serversLatency[ i ], "" ) + Hud_SetText( file.serversRegion[ i ], "" ) } HideServerInfo() @@ -756,6 +754,7 @@ void function FilterServerList() tempServer.serverPlayersMax = NSGetServerMaxPlayerCount( i ) tempServer.serverMap = NSGetServerMap( i ) tempServer.serverGamemode = GetGameModeDisplayName( NSGetServerPlaylist ( i ) ) + tempServer.serverRegion = NSGetServerRegion( i ) totalPlayers += tempServer.serverPlayers @@ -786,6 +785,7 @@ void function FilterServerList() sName.append( tempServer.serverGamemode.tolower() ) sName.append( Localize( tempServer.serverGamemode ).tolower() ) sName.append( NSGetServerDescription( i ).tolower() ) + sName.append( NSGetServerRegion( i ).tolower() ) string sTerm = filterArguments.searchTerm.tolower() @@ -821,7 +821,7 @@ void function UpdateShownPage() Hud_SetText( file.playerCountLabels[ i ], "" ) Hud_SetText( file.serversMap[ i ], "" ) Hud_SetText( file.serversGamemode[ i ], "" ) - Hud_SetText( file.serversLatency[ i ], "" ) + Hud_SetText( file.serversRegion[ i ], "" ) } int j = file.serversArrayFiltered.len() > BUTTONS_PER_PAGE ? BUTTONS_PER_PAGE : file.serversArrayFiltered.len() @@ -840,6 +840,7 @@ void function UpdateShownPage() Hud_SetText( file.playerCountLabels[ i ], format( "%i/%i", file.serversArrayFiltered[ buttonIndex ].serverPlayers, file.serversArrayFiltered[ buttonIndex ].serverPlayersMax ) ) Hud_SetText( file.serversMap[ i ], GetMapDisplayName( file.serversArrayFiltered[ buttonIndex ].serverMap ) ) Hud_SetText( file.serversGamemode[ i ], file.serversArrayFiltered[ buttonIndex ].serverGamemode ) + Hud_SetText( file.serversRegion[ i ], file.serversArrayFiltered[ buttonIndex ].serverRegion ) } @@ -1161,10 +1162,10 @@ int function ServerSortLogic ( serverStruct a, serverStruct b ) bTemp = Localize( b.serverGamemode ).tolower() direction = filterDirection.serverGamemode break; - case sortingBy.LATENCY: - aTemp = a.serverLatency - bTemp = b.serverLatency - direction = filterDirection.serverLatency + case sortingBy.REGION: + aTemp = a.serverRegion + bTemp = b.serverRegion + direction = filterDirection.serverRegion break; default: return 0 @@ -1238,13 +1239,13 @@ void function SortServerListByGamemode_Activate( var button ) UpdateShownPage() } -void function SortServerListByLatency_Activate( var button ) +void function SortServerListByRegion_Activate( var button ) { - filterDirection.sortingBy = sortingBy.LATENCY + filterDirection.sortingBy = sortingBy.REGION file.serversArrayFiltered.sort( ServerSortLogic ) - filterDirection.serverLatency = !filterDirection.serverLatency + filterDirection.serverRegion = !filterDirection.serverRegion UpdateShownPage() } -- cgit v1.2.3 From 27e000e3feb3741c91708ea47c92ec95d9f3d4d1 Mon Sep 17 00:00:00 2001 From: F1F7Y <64418963+F1F7Y@users.noreply.github.com> Date: Tue, 3 Jan 2023 00:27:15 +0100 Subject: Move region column to the left (#553) --- .../mod/resource/ui/menus/server_browser.menu | 900 ++++++++++----------- 1 file changed, 450 insertions(+), 450 deletions(-) (limited to 'Northstar.Client') diff --git a/Northstar.Client/mod/resource/ui/menus/server_browser.menu b/Northstar.Client/mod/resource/ui/menus/server_browser.menu index b66fb8a6..48cddd73 100644 --- a/Northstar.Client/mod/resource/ui/menus/server_browser.menu +++ b/Northstar.Client/mod/resource/ui/menus/server_browser.menu @@ -143,7 +143,7 @@ resource/ui/menus/mods_browse.menu wide 100 tall 40 ypos -220 - xpos -462 + xpos -422 zpos 101 //fgcolor_override "107 166 196 255" @@ -159,7 +159,7 @@ resource/ui/menus/mods_browse.menu wide 100 tall 40 ypos -220 - xpos -462 + xpos -422 zpos 100 rui "ui/control_options_description.rpak" @@ -419,6 +419,252 @@ resource/ui/menus/mods_browse.menu pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner BOTTOM_LEFT } + + // Region + BtnServerRegionTab + { + ControlName RuiButton + InheritProperties RuiSmallButton + labelText "#REGION_COLUMN" + wide 110 + xpos -4 + ypos -1 + + scriptID 999 + + pin_to_sibling BtnServerPasswordProtectedTab + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + navDown BtnServer1 + navRight BtnServerNameTab + navUp BtnFiltersClear + } + + BtnServerRegion1 + { + ControlName Label + labelText "" + classname Serverregion + textAlignment center + wide 110 + tall 44 + ypos -42 + xpos 0 + + pin_to_sibling BtnServer1 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + BtnServerRegion2 + { + ControlName Label + labelText "" + classname Serverregion + textAlignment center + wide 110 + tall 44 + ypos -42 + xpos 0 + + pin_to_sibling BtnServer2 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + BtnServerRegion3 + { + ControlName Label + labelText "" + classname Serverregion + textAlignment center + wide 110 + tall 44 + ypos -42 + xpos 0 + + pin_to_sibling BtnServer3 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + BtnServerRegion4 + { + ControlName Label + labelText "" + classname Serverregion + textAlignment center + wide 110 + tall 44 + ypos -42 + xpos 0 + + pin_to_sibling BtnServer4 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + BtnServerRegion5 + { + ControlName Label + labelText "" + classname Serverregion + textAlignment center + wide 110 + tall 44 + ypos -42 + xpos 0 + + pin_to_sibling BtnServer5 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + BtnServerRegion6 + { + ControlName Label + labelText "" + classname Serverregion + textAlignment center + wide 110 + tall 44 + ypos -42 + xpos 0 + + pin_to_sibling BtnServer6 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + BtnServerRegion7 + { + ControlName Label + labelText "" + classname Serverregion + textAlignment center + wide 110 + tall 44 + ypos -42 + xpos 0 + + pin_to_sibling BtnServer7 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + BtnServerRegion8 + { + ControlName Label + labelText "" + classname Serverregion + textAlignment center + wide 110 + tall 44 + ypos -42 + xpos 0 + + pin_to_sibling BtnServer8 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + BtnServerRegion9 + { + ControlName Label + labelText "" + classname Serverregion + textAlignment center + wide 110 + tall 44 + ypos -42 + xpos 0 + + pin_to_sibling BtnServer9 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + BtnServerRegion10 + { + ControlName Label + labelText "" + classname Serverregion + textAlignment center + wide 110 + tall 44 + ypos -42 + xpos 0 + + pin_to_sibling BtnServer10 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + BtnServerRegion11 + { + ControlName Label + labelText "" + classname Serverregion + textAlignment center + wide 110 + tall 44 + ypos -42 + xpos 0 + + pin_to_sibling BtnServer11 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + BtnServerRegion12 + { + ControlName Label + labelText "" + classname Serverregion + textAlignment center + wide 110 + tall 44 + ypos -42 + xpos 0 + + pin_to_sibling BtnServer12 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + BtnServerRegion13 + { + ControlName Label + labelText "" + classname Serverregion + textAlignment center + wide 110 + tall 44 + ypos -42 + xpos 0 + + pin_to_sibling BtnServer13 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + BtnServerRegion14 + { + ControlName Label + labelText "" + classname Serverregion + textAlignment center + wide 110 + tall 44 + ypos -42 + xpos 0 + + pin_to_sibling BtnServer14 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } + BtnServerRegion15 + { + ControlName Label + labelText "" + classname Serverregion + textAlignment center + wide 110 + tall 44 + ypos -42 + xpos 0 + + pin_to_sibling BtnServer15 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + } // Name BtnServerNameTab @@ -427,16 +673,16 @@ resource/ui/menus/mods_browse.menu InheritProperties RuiSmallButton labelText "#SERVERS_COLUMN" wide 600 - xpos -4 - ypos -1 + xpos 4 scriptID 999 - pin_to_sibling BtnServerPasswordProtectedTab + pin_to_sibling BtnServerRegionTab pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner TOP_RIGHT navUp BtnFiltersClear navDown BtnServer1 + navLeft BtnServerRegionTab navRight BtnServerPlayersTab } @@ -448,8 +694,8 @@ resource/ui/menus/mods_browse.menu classname ServerName wide 586 tall 44 - ypos -44 - xpos -14 + ypos -42 + xpos -122 interactive false @@ -465,8 +711,8 @@ resource/ui/menus/mods_browse.menu classname ServerName wide 586 tall 44 - ypos -44 - xpos -14 + ypos -42 + xpos -122 pin_to_sibling BtnServer2 pin_corner_to_sibling TOP_LEFT @@ -480,8 +726,8 @@ resource/ui/menus/mods_browse.menu classname ServerName wide 586 tall 44 - ypos -44 - xpos -14 + ypos -42 + xpos -122 pin_to_sibling BtnServer3 pin_corner_to_sibling TOP_LEFT @@ -495,8 +741,8 @@ resource/ui/menus/mods_browse.menu classname ServerName wide 586 tall 44 - ypos -44 - xpos -14 + ypos -42 + xpos -122 pin_to_sibling BtnServer4 pin_corner_to_sibling TOP_LEFT @@ -510,8 +756,8 @@ resource/ui/menus/mods_browse.menu classname ServerName wide 586 tall 44 - ypos -44 - xpos -14 + ypos -42 + xpos -122 pin_to_sibling BtnServer5 pin_corner_to_sibling TOP_LEFT @@ -525,8 +771,8 @@ resource/ui/menus/mods_browse.menu classname ServerName wide 586 tall 44 - ypos -44 - xpos -14 + ypos -42 + xpos -122 pin_to_sibling BtnServer6 pin_corner_to_sibling TOP_LEFT @@ -540,8 +786,8 @@ resource/ui/menus/mods_browse.menu classname ServerName wide 586 tall 44 - ypos -44 - xpos -14 + ypos -42 + xpos -122 pin_to_sibling BtnServer7 pin_corner_to_sibling TOP_LEFT @@ -555,8 +801,8 @@ resource/ui/menus/mods_browse.menu classname ServerName wide 586 tall 44 - ypos -44 - xpos -14 + ypos -42 + xpos -122 pin_to_sibling BtnServer8 pin_corner_to_sibling TOP_LEFT @@ -570,8 +816,8 @@ resource/ui/menus/mods_browse.menu classname ServerName wide 586 tall 44 - ypos -44 - xpos -14 + ypos -42 + xpos -122 pin_to_sibling BtnServer9 pin_corner_to_sibling TOP_LEFT @@ -585,8 +831,8 @@ resource/ui/menus/mods_browse.menu classname ServerName wide 586 tall 44 - ypos -44 - xpos -14 + ypos -42 + xpos -122 pin_to_sibling BtnServer10 pin_corner_to_sibling TOP_LEFT @@ -600,8 +846,8 @@ resource/ui/menus/mods_browse.menu classname ServerName wide 586 tall 44 - ypos -44 - xpos -14 + ypos -42 + xpos -122 pin_to_sibling BtnServer11 pin_corner_to_sibling TOP_LEFT @@ -615,8 +861,8 @@ resource/ui/menus/mods_browse.menu classname ServerName wide 586 tall 44 - ypos -44 - xpos -14 + ypos -42 + xpos -122 pin_to_sibling BtnServer12 pin_corner_to_sibling TOP_LEFT @@ -630,8 +876,8 @@ resource/ui/menus/mods_browse.menu classname ServerName wide 586 tall 44 - ypos -44 - xpos -14 + ypos -42 + xpos -122 pin_to_sibling BtnServer13 pin_corner_to_sibling TOP_LEFT @@ -645,8 +891,8 @@ resource/ui/menus/mods_browse.menu classname ServerName wide 586 tall 44 - ypos -44 - xpos -14 + ypos -42 + xpos -122 pin_to_sibling BtnServer14 pin_corner_to_sibling TOP_LEFT @@ -660,8 +906,8 @@ resource/ui/menus/mods_browse.menu classname ServerName wide 586 tall 44 - ypos -44 - xpos -14 + ypos -42 + xpos -122 pin_to_sibling BtnServer15 pin_corner_to_sibling TOP_LEFT @@ -697,8 +943,8 @@ resource/ui/menus/mods_browse.menu textAlignment center wide 104 tall 44 - ypos -44 - xpos -600 + ypos -42 + xpos -718 pin_to_sibling BtnServer1 pin_corner_to_sibling TOP_LEFT @@ -712,8 +958,8 @@ resource/ui/menus/mods_browse.menu textAlignment center wide 104 tall 44 - ypos -44 - xpos -600 + ypos -42 + xpos -718 pin_to_sibling BtnServer2 pin_corner_to_sibling TOP_LEFT @@ -727,8 +973,8 @@ resource/ui/menus/mods_browse.menu textAlignment center wide 104 tall 44 - ypos -44 - xpos -600 + ypos -42 + xpos -718 pin_to_sibling BtnServer3 pin_corner_to_sibling TOP_LEFT @@ -742,8 +988,8 @@ resource/ui/menus/mods_browse.menu textAlignment center wide 104 tall 44 - ypos -44 - xpos -600 + ypos -42 + xpos -718 pin_to_sibling BtnServer4 pin_corner_to_sibling TOP_LEFT @@ -757,8 +1003,8 @@ resource/ui/menus/mods_browse.menu textAlignment center wide 104 tall 44 - ypos -44 - xpos -600 + ypos -42 + xpos -718 pin_to_sibling BtnServer5 pin_corner_to_sibling TOP_LEFT @@ -772,8 +1018,8 @@ resource/ui/menus/mods_browse.menu textAlignment center wide 104 tall 44 - ypos -44 - xpos -600 + ypos -42 + xpos -718 pin_to_sibling BtnServer6 pin_corner_to_sibling TOP_LEFT @@ -787,8 +1033,8 @@ resource/ui/menus/mods_browse.menu textAlignment center wide 104 tall 44 - ypos -44 - xpos -600 + ypos -42 + xpos -718 pin_to_sibling BtnServer7 pin_corner_to_sibling TOP_LEFT @@ -802,8 +1048,8 @@ resource/ui/menus/mods_browse.menu textAlignment center wide 104 tall 44 - ypos -44 - xpos -600 + ypos -42 + xpos -718 pin_to_sibling BtnServer8 pin_corner_to_sibling TOP_LEFT @@ -817,8 +1063,8 @@ resource/ui/menus/mods_browse.menu textAlignment center wide 104 tall 44 - ypos -44 - xpos -600 + ypos -42 + xpos -718 pin_to_sibling BtnServer9 pin_corner_to_sibling TOP_LEFT @@ -832,8 +1078,8 @@ resource/ui/menus/mods_browse.menu textAlignment center wide 104 tall 44 - ypos -44 - xpos -600 + ypos -42 + xpos -718 pin_to_sibling BtnServer10 pin_corner_to_sibling TOP_LEFT @@ -847,8 +1093,8 @@ resource/ui/menus/mods_browse.menu textAlignment center wide 104 tall 44 - ypos -44 - xpos -600 + ypos -42 + xpos -718 pin_to_sibling BtnServer11 pin_corner_to_sibling TOP_LEFT @@ -862,8 +1108,8 @@ resource/ui/menus/mods_browse.menu textAlignment center wide 104 tall 44 - ypos -44 - xpos -600 + ypos -42 + xpos -718 pin_to_sibling BtnServer12 pin_corner_to_sibling TOP_LEFT @@ -877,8 +1123,8 @@ resource/ui/menus/mods_browse.menu textAlignment center wide 104 tall 44 - ypos -44 - xpos -600 + ypos -42 + xpos -718 pin_to_sibling BtnServer13 pin_corner_to_sibling TOP_LEFT @@ -892,8 +1138,8 @@ resource/ui/menus/mods_browse.menu textAlignment center wide 104 tall 44 - ypos -44 - xpos -600 + ypos -42 + xpos -718 pin_to_sibling BtnServer14 pin_corner_to_sibling TOP_LEFT @@ -907,8 +1153,8 @@ resource/ui/menus/mods_browse.menu textAlignment center wide 104 tall 44 - ypos -44 - xpos -600 + ypos -42 + xpos -718 pin_to_sibling BtnServer15 pin_corner_to_sibling TOP_LEFT @@ -944,8 +1190,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -709 + ypos -42 + xpos -828 pin_to_sibling BtnServer1 pin_corner_to_sibling TOP_LEFT @@ -959,8 +1205,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -709 + ypos -42 + xpos -828 pin_to_sibling BtnServer2 pin_corner_to_sibling TOP_LEFT @@ -974,8 +1220,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -709 + ypos -42 + xpos -828 pin_to_sibling BtnServer3 pin_corner_to_sibling TOP_LEFT @@ -989,8 +1235,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -709 + ypos -42 + xpos -828 pin_to_sibling BtnServer4 pin_corner_to_sibling TOP_LEFT @@ -1004,8 +1250,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -709 + ypos -42 + xpos -828 pin_to_sibling BtnServer5 pin_corner_to_sibling TOP_LEFT @@ -1019,8 +1265,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -709 + ypos -42 + xpos -828 pin_to_sibling BtnServer6 pin_corner_to_sibling TOP_LEFT @@ -1034,8 +1280,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -709 + ypos -42 + xpos -828 pin_to_sibling BtnServer7 pin_corner_to_sibling TOP_LEFT @@ -1049,8 +1295,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -709 + ypos -42 + xpos -828 pin_to_sibling BtnServer8 pin_corner_to_sibling TOP_LEFT @@ -1064,8 +1310,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -709 + ypos -42 + xpos -828 pin_to_sibling BtnServer9 pin_corner_to_sibling TOP_LEFT @@ -1079,8 +1325,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -709 + ypos -42 + xpos -828 pin_to_sibling BtnServer10 pin_corner_to_sibling TOP_LEFT @@ -1094,8 +1340,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -709 + ypos -42 + xpos -828 pin_to_sibling BtnServer11 pin_corner_to_sibling TOP_LEFT @@ -1109,8 +1355,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -709 + ypos -42 + xpos -828 pin_to_sibling BtnServer12 pin_corner_to_sibling TOP_LEFT @@ -1124,8 +1370,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -709 + ypos -42 + xpos -828 pin_to_sibling BtnServer13 pin_corner_to_sibling TOP_LEFT @@ -1139,8 +1385,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -709 + ypos -42 + xpos -828 pin_to_sibling BtnServer14 pin_corner_to_sibling TOP_LEFT @@ -1154,8 +1400,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -709 + ypos -42 + xpos -828 pin_to_sibling BtnServer15 pin_corner_to_sibling TOP_LEFT @@ -1178,7 +1424,7 @@ resource/ui/menus/mods_browse.menu pin_to_sibling_corner TOP_RIGHT navDown BtnServer1 navLeft BtnServerMapTab - navRight BtnServerRegionTab + navRight BtnServerJoin navUp BtnFiltersClear } @@ -1190,8 +1436,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -860 + ypos -42 + xpos -972 pin_to_sibling BtnServer1 pin_corner_to_sibling TOP_LEFT @@ -1205,8 +1451,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -860 + ypos -42 + xpos -972 pin_to_sibling BtnServer2 pin_corner_to_sibling TOP_LEFT @@ -1220,8 +1466,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -860 + ypos -42 + xpos -972 pin_to_sibling BtnServer3 pin_corner_to_sibling TOP_LEFT @@ -1235,8 +1481,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -860 + ypos -42 + xpos -972 pin_to_sibling BtnServer4 pin_corner_to_sibling TOP_LEFT @@ -1250,8 +1496,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -860 + ypos -42 + xpos -972 pin_to_sibling BtnServer5 pin_corner_to_sibling TOP_LEFT @@ -1265,8 +1511,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -860 + ypos -42 + xpos -972 pin_to_sibling BtnServer6 pin_corner_to_sibling TOP_LEFT @@ -1280,8 +1526,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -860 + ypos -42 + xpos -972 pin_to_sibling BtnServer7 pin_corner_to_sibling TOP_LEFT @@ -1295,8 +1541,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -860 + ypos -42 + xpos -972 pin_to_sibling BtnServer8 pin_corner_to_sibling TOP_LEFT @@ -1310,8 +1556,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -860 + ypos -42 + xpos -972 pin_to_sibling BtnServer9 pin_corner_to_sibling TOP_LEFT @@ -1325,8 +1571,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -860 + ypos -42 + xpos -972 pin_to_sibling BtnServer10 pin_corner_to_sibling TOP_LEFT @@ -1340,8 +1586,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -860 + ypos -42 + xpos -972 pin_to_sibling BtnServer11 pin_corner_to_sibling TOP_LEFT @@ -1355,8 +1601,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -860 + ypos -42 + xpos -972 pin_to_sibling BtnServer12 pin_corner_to_sibling TOP_LEFT @@ -1370,8 +1616,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -860 + ypos -42 + xpos -972 pin_to_sibling BtnServer13 pin_corner_to_sibling TOP_LEFT @@ -1385,8 +1631,8 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -860 + ypos -42 + xpos -972 pin_to_sibling BtnServer14 pin_corner_to_sibling TOP_LEFT @@ -1400,366 +1646,120 @@ resource/ui/menus/mods_browse.menu wide 140 textAlignment center tall 44 - ypos -44 - xpos -860 + ypos -42 + xpos -972 pin_to_sibling BtnServer15 pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner BOTTOM_LEFT } - // Region - BtnServerRegionTab - { - ControlName RuiButton - InheritProperties RuiSmallButton - labelText "#REGION_COLUMN" - wide 110 - xpos 4 - - scriptID 999 - - pin_to_sibling BtnServerGamemodeTab - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - navDown BtnServer1 - navLeft BtnServerGamemodeTab - navRight BtnServerJoin - navUp BtnFiltersClear - } - - BtnServerRegion1 - { - ControlName Label - labelText "" - classname Serverregion - textAlignment center - wide 110 - tall 44 - ypos -44 - xpos -1006 - - pin_to_sibling BtnServer1 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner BOTTOM_LEFT - } - BtnServerRegion2 - { - ControlName Label - labelText "" - classname Serverregion - textAlignment center - wide 110 - tall 44 - ypos -44 - xpos -1006 - - pin_to_sibling BtnServer2 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner BOTTOM_LEFT - } - BtnServerRegion3 - { - ControlName Label - labelText "" - classname Serverregion - textAlignment center - wide 110 - tall 44 - ypos -44 - xpos -1006 - - pin_to_sibling BtnServer3 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner BOTTOM_LEFT - } - BtnServerRegion4 - { - ControlName Label - labelText "" - classname Serverregion - textAlignment center - wide 110 - tall 44 - ypos -44 - xpos -1006 + // Dividers: - pin_to_sibling BtnServer4 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner BOTTOM_LEFT - } - BtnServerRegion5 + // Y + YDivider0 { - ControlName Label - labelText "" - classname Serverregion - textAlignment center - wide 110 - tall 44 - ypos -44 - xpos -1006 + ControlName ImagePanel + wide 2 + tall 641 + visible 1 + image "vgui/hud/white" + drawColor "160 157 149 255" + scaleImage 1 + xpos 3 + ypos -1 - pin_to_sibling BtnServer5 + pin_to_sibling BtnServerNameTab pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner BOTTOM_LEFT + pin_to_sibling_corner TOP_LEFT } - BtnServerRegion6 - { - ControlName Label - labelText "" - classname Serverregion - textAlignment center - wide 110 - tall 44 - ypos -44 - xpos -1006 - pin_to_sibling BtnServer6 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner BOTTOM_LEFT - } - BtnServerRegion7 + YDivider1 { - ControlName Label - labelText "" - classname Serverregion - textAlignment center - wide 110 - tall 44 - ypos -44 - xpos -1006 + ControlName ImagePanel + wide 2 + tall 641 + visible 1 + image "vgui/hud/white" + drawColor "160 157 149 255" + scaleImage 1 + xpos 3 + ypos -1 - pin_to_sibling BtnServer7 + pin_to_sibling BtnServerPlayersTab pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner BOTTOM_LEFT + pin_to_sibling_corner TOP_LEFT } - BtnServerRegion8 - { - ControlName Label - labelText "" - classname Serverregion - textAlignment center - wide 110 - tall 44 - ypos -44 - xpos -1006 - pin_to_sibling BtnServer8 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner BOTTOM_LEFT - } - BtnServerRegion9 + YDivider2 { - ControlName Label - labelText "" - classname Serverregion - textAlignment center - wide 110 - tall 44 - ypos -44 - xpos -1006 + ControlName ImagePanel + wide 2 + tall 641 + visible 1 + image "vgui/hud/white" + drawColor "160 157 149 255" + scaleImage 1 + xpos 3 + ypos -1 - pin_to_sibling BtnServer9 + pin_to_sibling BtnServerMapTab pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner BOTTOM_LEFT + pin_to_sibling_corner TOP_LEFT } - BtnServerRegion10 - { - ControlName Label - labelText "" - classname Serverregion - textAlignment center - wide 110 - tall 44 - ypos -44 - xpos -1006 - pin_to_sibling BtnServer10 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner BOTTOM_LEFT - } - BtnServerRegion11 + YDivider3 { - ControlName Label - labelText "" - classname Serverregion - textAlignment center - wide 110 - tall 44 - ypos -44 - xpos -1006 + ControlName ImagePanel + wide 2 + tall 641 + visible 1 + image "vgui/hud/white" + drawColor "160 157 149 255" + scaleImage 1 + xpos 3 + ypos -1 - pin_to_sibling BtnServer11 + pin_to_sibling BtnServerGamemodeTab pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner BOTTOM_LEFT + pin_to_sibling_corner TOP_LEFT } - BtnServerRegion12 - { - ControlName Label - labelText "" - classname Serverregion - textAlignment center - wide 110 - tall 44 - ypos -44 - xpos -1006 - pin_to_sibling BtnServer12 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner BOTTOM_LEFT - } - BtnServerRegion13 + YDivider4 { - ControlName Label - labelText "" - classname Serverregion - textAlignment center - wide 110 - tall 44 - ypos -44 - xpos -1006 + ControlName ImagePanel + wide 2 + tall 641 + visible 1 + image "vgui/hud/white" + drawColor "160 157 149 255" + scaleImage 1 + xpos 3 + ypos -1 - pin_to_sibling BtnServer13 + pin_to_sibling BtnServerRegionTab pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner BOTTOM_LEFT + pin_to_sibling_corner TOP_LEFT } - BtnServerRegion14 - { - ControlName Label - labelText "" - classname Serverregion - textAlignment center - wide 110 - tall 44 - ypos -44 - xpos -1006 - pin_to_sibling BtnServer14 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner BOTTOM_LEFT - } - BtnServerRegion15 + // X + XDivider0 { - ControlName Label - labelText "" - classname Serverregion - textAlignment center - wide 110 - tall 44 - ypos -44 - xpos -1006 + ControlName ImagePanel + wide 1150 + tall 2 + visible 1 + image "vgui/hud/white" + drawColor "160 157 149 255" + scaleImage 1 + ypos 3 + xpos 37 - pin_to_sibling BtnServer15 - pin_corner_to_sibling TOP_LEFT + pin_to_sibling BtnServerRegionTab + pin_corner_to_sibling BOTTOM_LEFT pin_to_sibling_corner BOTTOM_LEFT } - // Dividers: - - // Y - YDivider0 - { - ControlName ImagePanel - wide 2 - tall 641 - visible 1 - image "vgui/hud/white" - drawColor "160 157 149 255" - scaleImage 1 - xpos 3 - ypos -1 - - pin_to_sibling BtnServerNameTab - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_LEFT - } - - YDivider1 - { - ControlName ImagePanel - wide 2 - tall 641 - visible 1 - image "vgui/hud/white" - drawColor "160 157 149 255" - scaleImage 1 - xpos 3 - ypos -1 - - pin_to_sibling BtnServerPlayersTab - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_LEFT - } - - YDivider2 - { - ControlName ImagePanel - wide 2 - tall 641 - visible 1 - image "vgui/hud/white" - drawColor "160 157 149 255" - scaleImage 1 - xpos 3 - ypos -1 - - pin_to_sibling BtnServerMapTab - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_LEFT - } - - YDivider3 - { - ControlName ImagePanel - wide 2 - tall 641 - visible 1 - image "vgui/hud/white" - drawColor "160 157 149 255" - scaleImage 1 - xpos 3 - ypos -1 - - pin_to_sibling BtnServerGamemodeTab - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_LEFT - } - - YDivider4 - { - ControlName ImagePanel - wide 2 - tall 641 - visible 1 - image "vgui/hud/white" - drawColor "160 157 149 255" - scaleImage 1 - xpos 3 - ypos -1 - - pin_to_sibling BtnServerRegionTab - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_LEFT - } - - // X - XDivider0 - { - ControlName ImagePanel - wide 1150 - tall 2 - visible 1 - image "vgui/hud/white" - drawColor "160 157 149 255" - scaleImage 1 - ypos 3 - xpos 37 - - pin_to_sibling BtnServerNameTab - pin_corner_to_sibling BOTTOM_LEFT - pin_to_sibling_corner BOTTOM_LEFT - } - // List: BtnServerDummmyTop { ControlName RuiButton @@ -2082,7 +2082,7 @@ resource/ui/menus/mods_browse.menu wide 40 tall 562 xpos 2 - ypos -40 + ypos -42 zpos 0 image "vgui/hud/white" @@ -2099,7 +2099,7 @@ resource/ui/menus/mods_browse.menu wide 40 tall 562 xpos 2 - ypos -40 + ypos -42 rui "ui/control_options_description.rpak" @@ -2120,7 +2120,7 @@ resource/ui/menus/mods_browse.menu wide 40 tall 562 xpos 2 - ypos -40 + ypos -42 zpos 1 pin_to_sibling ServerDetailsPanel -- cgit v1.2.3 From 92a3d6c0d00e2d4cb8a320ee47870beb407110b3 Mon Sep 17 00:00:00 2001 From: F1F7Y <64418963+F1F7Y@users.noreply.github.com> Date: Wed, 4 Jan 2023 02:50:11 +0100 Subject: Fix connecting UI (#560) Fixes misaligned buttons when showing server connecting pop up --- Northstar.Client/mod/resource/ui/menus/server_browser.menu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Northstar.Client') diff --git a/Northstar.Client/mod/resource/ui/menus/server_browser.menu b/Northstar.Client/mod/resource/ui/menus/server_browser.menu index 48cddd73..4a84a714 100644 --- a/Northstar.Client/mod/resource/ui/menus/server_browser.menu +++ b/Northstar.Client/mod/resource/ui/menus/server_browser.menu @@ -143,7 +143,7 @@ resource/ui/menus/mods_browse.menu wide 100 tall 40 ypos -220 - xpos -422 + xpos -462 zpos 101 //fgcolor_override "107 166 196 255" @@ -159,7 +159,7 @@ resource/ui/menus/mods_browse.menu wide 100 tall 40 ypos -220 - xpos -422 + xpos -462 zpos 100 rui "ui/control_options_description.rpak" -- cgit v1.2.3 From 26e49bdf49689f64453a398a3a76f7e44946e20c Mon Sep 17 00:00:00 2001 From: NoCatt <86153630+NoCatt@users.noreply.github.com> Date: Sun, 8 Jan 2023 02:40:10 +0100 Subject: Fix server chat messages being send twice when watching a replay (#555) * fixes chat messages being send twice * OCD is a real issue --- .../mod/scripts/vscripts/_custom_codecallbacks_client.gnut | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Northstar.Client') diff --git a/Northstar.Client/mod/scripts/vscripts/_custom_codecallbacks_client.gnut b/Northstar.Client/mod/scripts/vscripts/_custom_codecallbacks_client.gnut index 811874c5..277ed030 100644 --- a/Northstar.Client/mod/scripts/vscripts/_custom_codecallbacks_client.gnut +++ b/Northstar.Client/mod/scripts/vscripts/_custom_codecallbacks_client.gnut @@ -22,6 +22,10 @@ struct { } NsCustomCallbacksClient void function OnReceivedMessage(ClClient_MessageStruct localMessage) { + + if ( IsWatchingReplay() ) + return + if (localMessage.player != null) { foreach (callbackFunc in NsCustomCallbacksClient.OnReceivedSayTextMessageCallbacks) -- cgit v1.2.3