Skip to content

Commit

Permalink
Merge branch 'main' into mixtapemenu_matchmaking
Browse files Browse the repository at this point in the history
  • Loading branch information
Zanieon authored Sep 2, 2023
2 parents 13a5ab0 + 97d34de commit 0a17581
Show file tree
Hide file tree
Showing 28 changed files with 2,473 additions and 104 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ Press Yes if you agree to this. This choice can be changed in the mods menu at a
"classic_rodeo" "Classic Rodeo"
"oob_timer_enabled" "Out of Bounds Timer"
"riff_instagib" "Instagib Mode"
"player_force_respawn" "Forced Respawn"

"riff_player_bleedout" "Pilot Bleedout"
"player_bleedout_forceHolster" "Holster weapons when downed"
Expand Down Expand Up @@ -342,5 +343,23 @@ Press Yes if you agree to this. This choice can be changed in the mods menu at a
"MOD_SETTINGS_RESET_ALL" "Reset All"
"NO_RESULTS" "No results."
"NO_MODS" "No settings available! Install more mods at ^5588FF00northstar.thunderstore.io^0."

// Toggleable progression
"TOGGLE_PROGRESSION" "Toggle Progression"
"Y_BUTTON_TOGGLE_PROGRESSION" "%[Y_BUTTON]% Toggle Progression"

"PROGRESSION_TOGGLE_ENABLED_HEADER" "Disable Progression?"
"PROGRESSION_TOGGLE_ENABLED_BODY" "Titans, Weapons, Factions, Skins, etc. will all be unlocked and usable at any time.\n\nThis can be changed at any time in the multiplayer lobby."

"PROGRESSION_TOGGLE_DISABLED_HEADER" "Enable Progression?"
"PROGRESSION_TOGGLE_DISABLED_BODY" "Titans, Weapons, Factions, Skins, etc. will need to be unlocked by levelling up, or bought with Merits.\n\nThis can be changed at any time in the multiplayer lobby.\n\n^CC000000Warning: if you have currently equipped any items that you do not have unlocked, they will be reset!"

"PROGRESSION_ENABLED_HEADER" "Progression Enabled!"
"PROGRESSION_ENABLED_BODY" "^CCCC0000Progression has been enabled.^\n\nTitans, Weapons, Factions, Skins, etc. will need to be unlocked by levelling up, or bought with Merits.\n\nThis can be changed at any time in the multiplayer lobby."

"PROGRESSION_DISABLED_HEADER" "Progression Disabled!"
"PROGRESSION_DISABLED_BODY" "^CCCC0000Progression has been disabled.^\n\nTitans, Weapons, Factions, Skins, etc. will all be unlocked and usable at any time.\n\nThis can be changed at any time in the multiplayer lobby."

"PROGRESSION_ANNOUNCEMENT_BODY" "^CCCC0000Progression can now be enabled!^\n\nNorthstar now supports vanilla progression, meaning you can choose to unlock Weapons, Skins, Titans, etc. through levelling up and completing challenges.\n\nYou can enable progression using the button at the bottom of the lobby screen.\n\nThis can be changed at any time."
}
}
53 changes: 53 additions & 0 deletions Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ void function InitLobbyMenu()
AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" )
AddMenuFooterOption( menu, BUTTON_BACK, "#BACK_BUTTON_POSTGAME_REPORT", "#POSTGAME_REPORT", OpenPostGameMenu, IsPostGameMenuValid )
AddMenuFooterOption( menu, BUTTON_TRIGGER_RIGHT, "#R_TRIGGER_CHAT", "", null, IsVoiceChatPushToTalk )
// Client side progression toggle
AddMenuFooterOption( menu, BUTTON_Y, "#Y_BUTTON_TOGGLE_PROGRESSION", "#TOGGLE_PROGRESSION", ShowToggleProgressionDialog )

InitChatroom( menu )

Expand Down Expand Up @@ -228,6 +230,57 @@ void function InitLobbyMenu()
RegisterSignal( "LeaveParty" )
}

void function ShowToggleProgressionDialog( var button )
{
bool enabled = Progression_GetPreference()

DialogData dialogData
dialogData.menu = GetMenu( "AnnouncementDialog" )
dialogData.header = enabled ? "#PROGRESSION_TOGGLE_ENABLED_HEADER" : "#PROGRESSION_TOGGLE_DISABLED_HEADER"
dialogData.message = enabled ? "#PROGRESSION_TOGGLE_ENABLED_BODY" : "#PROGRESSION_TOGGLE_DISABLED_BODY"
dialogData.image = $"ui/menu/common/dialog_announcement_1"

AddDialogButton( dialogData, "#NO" )
AddDialogButton( dialogData, "#YES", enabled ? DisableProgression : EnableProgression )

OpenDialog( dialogData )
}

void function EnableProgression()
{
Progression_SetPreference( true )

// update the cache just in case something changed
UpdateCachedLoadouts_Delayed()

DialogData dialogData
dialogData.menu = GetMenu( "AnnouncementDialog" )
dialogData.header = "#PROGRESSION_ENABLED_HEADER"
dialogData.message = "#PROGRESSION_ENABLED_BODY"
dialogData.image = $"ui/menu/common/dialog_announcement_1"

AddDialogButton( dialogData, "#OK" )

EmitUISound( "UI_Menu_Item_Purchased_Stinger" )

OpenDialog( dialogData )
}

void function DisableProgression()
{
Progression_SetPreference( false )

DialogData dialogData
dialogData.menu = GetMenu( "AnnouncementDialog" )
dialogData.header = "#PROGRESSION_DISABLED_HEADER"
dialogData.message = "#PROGRESSION_DISABLED_BODY"
dialogData.image = $"ui/menu/common/dialog_announcement_1"

AddDialogButton( dialogData, "#OK" )

OpenDialog( dialogData )
}

void function SetupComboButtonTest( var menu )
{
ComboStruct comboStruct = ComboButtons_Create( menu )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1274,10 +1274,16 @@ void function RemoveConnectToServerCallback( void functionref( ServerInfo ) call
file.connectCallbacks.fastremovebyvalue( callback )
}

void function TriggerConnectToServerCallbacks()
void function TriggerConnectToServerCallbacks( ServerInfo ornull targetServer = null )
{
ServerInfo server;
if (targetServer == null)
{
targetServer = file.lastSelectedServer
}

foreach( callback in file.connectCallbacks )
{
callback( file.lastSelectedServer )
callback( expect ServerInfo( targetServer ) )
}
}
127 changes: 77 additions & 50 deletions Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fw.nut
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ global function FW_ReplaceMegaTurret
global function FW_IsPlayerInFriendlyTerritory
global function FW_IsPlayerInEnemyTerritory

// Callbacks for mods to reduce harvester damage of modded weapons
global function FW_AddHarvesterDamageSourceModifier
global function FW_RemoveHarvesterDamageSourceModifier

// you need to deal this much damage to trigger "FortWarTowerDamage" score event
const int FW_HARVESTER_DAMAGE_SEGMENT = 1500
const int FW_HARVESTER_DAMAGE_SEGMENT = 5250

// basically needs to match "waves count - bosswaves count"
const int FW_MAX_LEVELS = 3
Expand Down Expand Up @@ -85,6 +89,9 @@ struct CampSpawnStruct
struct
{
array<HarvesterStruct> harvesters

// Stores damage source IDs and the modifier applied to them when they damage a harvester
table< int, float > harvesterDamageSourceMods

// save camp's info_target, we spawn camps after game starts, or player's first life won't show up correct camp icons
array<entity> camps
Expand Down Expand Up @@ -1738,13 +1745,14 @@ void function FW_createHarvester()
{
// imc havester spawn
fw_harvesterImc = SpawnHarvester( file.harvesterImc_info.GetOrigin(), file.harvesterImc_info.GetAngles(), GetCurrentPlaylistVarInt( "fw_harvester_health", FW_DEFAULT_HARVESTER_HEALTH ), GetCurrentPlaylistVarInt( "fw_harvester_shield", FW_DEFAULT_HARVESTER_SHIELD ), TEAM_IMC )
fw_harvesterImc.harvester.SetArmorType( ARMOR_TYPE_HEAVY )
fw_harvesterImc.harvester.Minimap_SetAlignUpright( true )
fw_harvesterImc.harvester.Minimap_AlwaysShow( TEAM_IMC, null )
fw_harvesterImc.harvester.Minimap_AlwaysShow( TEAM_MILITIA, null )
fw_harvesterImc.harvester.Minimap_SetHeightTracking( true )
fw_harvesterImc.harvester.Minimap_SetZOrder( MINIMAP_Z_OBJECT )
fw_harvesterImc.harvester.Minimap_SetCustomState( eMinimapObject_prop_script.FD_HARVESTER )
AddEntityCallback_OnDamaged( fw_harvesterImc.harvester, OnHarvesterDamaged )
AddEntityCallback_OnFinalDamaged( fw_harvesterImc.harvester, OnHarvesterDamaged )
AddEntityCallback_OnPostDamaged( fw_harvesterImc.harvester, OnHarvesterPostDamaged )

// imc havester settings
Expand All @@ -1763,13 +1771,14 @@ void function FW_createHarvester()

// mlt havester spawn
fw_harvesterMlt = SpawnHarvester( file.harvesterMlt_info.GetOrigin(), file.harvesterMlt_info.GetAngles(), GetCurrentPlaylistVarInt( "fw_harvester_health", FW_DEFAULT_HARVESTER_HEALTH ), GetCurrentPlaylistVarInt( "fw_harvester_shield", FW_DEFAULT_HARVESTER_SHIELD ), TEAM_MILITIA )
fw_harvesterMlt.harvester.SetArmorType( ARMOR_TYPE_HEAVY )
fw_harvesterMlt.harvester.Minimap_SetAlignUpright( true )
fw_harvesterMlt.harvester.Minimap_AlwaysShow( TEAM_IMC, null )
fw_harvesterMlt.harvester.Minimap_AlwaysShow( TEAM_MILITIA, null )
fw_harvesterMlt.harvester.Minimap_SetHeightTracking( true )
fw_harvesterMlt.harvester.Minimap_SetZOrder( MINIMAP_Z_OBJECT )
fw_harvesterMlt.harvester.Minimap_SetCustomState( eMinimapObject_prop_script.FD_HARVESTER )
AddEntityCallback_OnDamaged( fw_harvesterMlt.harvester, OnHarvesterDamaged )
AddEntityCallback_OnFinalDamaged( fw_harvesterMlt.harvester, OnHarvesterDamaged )
AddEntityCallback_OnPostDamaged( fw_harvesterMlt.harvester, OnHarvesterPostDamaged )

// mlt havester settings
Expand All @@ -1784,6 +1793,53 @@ void function FW_createHarvester()
// scores starts from 100, TeamScore means harvester health; TeamScore2 means shield bar
GameRules_SetTeamScore( TEAM_IMC , 100 )
GameRules_SetTeamScore2( TEAM_IMC , 100 )

InitHarvesterDamageMods()
}

void function FW_AddHarvesterDamageSourceModifier( int id, float mod )
{
if ( !( id in file.harvesterDamageSourceMods ) )
file.harvesterDamageSourceMods[id] <- 1.0

file.harvesterDamageSourceMods[id] *= mod
}

void function FW_RemoveHarvesterDamageSourceModifier( int id, float mod )
{
if ( !( id in file.harvesterDamageSourceMods ) )
return

file.harvesterDamageSourceMods[id] /= mod

if ( file.harvesterDamageSourceMods[id] == 1.0 )
delete file.harvesterDamageSourceMods[id]
}

void function InitHarvesterDamageMods()
{
// Damage balancing
const float CORE_DAMAGE_FRAC = 0.67
const float NUKE_EJECT_DAMAGE_FRAC = 0.25
const float DOT_DAMAGE_FRAC = 0.5

// Core balancing
FW_AddHarvesterDamageSourceModifier( eDamageSourceId.mp_titancore_laser_cannon, CORE_DAMAGE_FRAC )
FW_AddHarvesterDamageSourceModifier( eDamageSourceId.mp_titancore_salvo_core, CORE_DAMAGE_FRAC )
FW_AddHarvesterDamageSourceModifier( eDamageSourceId.mp_titanweapon_flightcore_rockets, CORE_DAMAGE_FRAC )
FW_AddHarvesterDamageSourceModifier( eDamageSourceId.mp_titancore_shift_core, CORE_DAMAGE_FRAC )
// Flame Core is not included since its single target damage is low compared to the others

// Nuke eject balancing
FW_AddHarvesterDamageSourceModifier( eDamageSourceId.damagedef_nuclear_core, NUKE_EJECT_DAMAGE_FRAC )

// Damage over time balancing
FW_AddHarvesterDamageSourceModifier( eDamageSourceId.mp_titanweapon_dumbfire_rockets, DOT_DAMAGE_FRAC )
FW_AddHarvesterDamageSourceModifier( eDamageSourceId.mp_titanweapon_meteor_thermite, DOT_DAMAGE_FRAC )
FW_AddHarvesterDamageSourceModifier( eDamageSourceId.mp_titanweapon_flame_wall, DOT_DAMAGE_FRAC )
FW_AddHarvesterDamageSourceModifier( eDamageSourceId.mp_titanability_slow_trap, DOT_DAMAGE_FRAC )
FW_AddHarvesterDamageSourceModifier( eDamageSourceId.mp_titancore_flame_wave_secondary, DOT_DAMAGE_FRAC )
FW_AddHarvesterDamageSourceModifier( eDamageSourceId.mp_titanweapon_heat_shield, DOT_DAMAGE_FRAC )
}

// this function can't handle specific damageSourceID, such as plasma railgun, but is the best to scale both shield and health damage
Expand All @@ -1792,6 +1848,21 @@ void function OnHarvesterDamaged( entity harvester, var damageInfo )
if ( !IsValid( harvester ) )
return

// Entities (non-Players and non-NPCs) don't consider damaged entity lists, which makes ground attacks (e.g. Arc Wave) and thermite hit more than they should
entity inflictor = DamageInfo_GetInflictor( damageInfo )
if ( IsValid( inflictor ) && ( inflictor.e.onlyDamageEntitiesOnce || inflictor.e.onlyDamageEntitiesOncePerTick ) )
{
if ( inflictor.e.damagedEntities.contains( harvester ) )
{
DamageInfo_SetDamage( damageInfo, 0 )
return
}
else
{
inflictor.e.damagedEntities.append( harvester )
}
}

int friendlyTeam = harvester.GetTeam()
int enemyTeam = GetOtherTeam( friendlyTeam )
int damageSourceID = DamageInfo_GetDamageSourceIdentifier( damageInfo )
Expand All @@ -1816,52 +1887,9 @@ void function OnHarvesterDamaged( entity harvester, var damageInfo )
// always reset harvester's recharge delay
harvesterstruct.lastDamage = Time()


// done damage adjustments here, since harvester prop's health is setting manually through damageAmount
if ( damageSourceID == eDamageSourceId.mp_titancore_laser_cannon )
DamageInfo_SetDamage( damageInfo, DamageInfo_GetDamage( damageInfo ) / 50 ) // laser core shreds super well for some reason

// plasma railgun can always do no-charge shots and deal same damage
if ( damageSourceID == eDamageSourceId.mp_titanweapon_sniper ) // nerf northstar
{
DamageInfo_SetDamage( damageInfo, DamageInfo_GetDamage( damageInfo ) / 3 )
entity inflictor = DamageInfo_GetInflictor( damageInfo )
if( IsValid( inflictor ) && inflictor.IsProjectile() )
{
inflictor.s.extraDamagePerBullet = expect int( inflictor.s.extraDamagePerBullet ) / 3
}
}

// leadwall have high pilot damage so works really well aginst harvester
if ( damageSourceID == eDamageSourceId.mp_titanweapon_leadwall ) // nerf ronin
DamageInfo_SetDamage( damageInfo, DamageInfo_GetDamage( damageInfo ) / 2 )

// missiles mostly have high pilot damage so works really well aginst harvester
if ( damageSourceID == eDamageSourceId.mp_titanweapon_salvo_rockets ||
damageSourceID == eDamageSourceId.mp_titanweapon_shoulder_rockets ||
damageSourceID == eDamageSourceId.mp_titancore_salvo_core
) // titan missiles
DamageInfo_SetDamage( damageInfo, DamageInfo_GetDamage( damageInfo ) / 3 )

if ( damageSourceID == eDamageSourceId.mp_titanweapon_sticky_40mm ) // 40mm trakcer cannon
DamageInfo_SetDamage( damageInfo, DamageInfo_GetDamage( damageInfo ) / 2 )

if ( damageSourceID == eDamageSourceId.mp_titanweapon_flightcore_rockets ) // flight core shreds well
DamageInfo_SetDamage( damageInfo, DamageInfo_GetDamage( damageInfo ) / 5 )

// cluster missle is very effective against non-moving targets
if ( damageSourceID == eDamageSourceId.mp_titanweapon_dumbfire_rockets ) // cluster missile shreds super well
DamageInfo_SetDamage( damageInfo, DamageInfo_GetDamage( damageInfo ) / 10 )

// scorch's thermites is very effective against non-moving targets
if ( damageSourceID == eDamageSourceId.mp_titanweapon_heat_shield ||
damageSourceID == eDamageSourceId.mp_titanweapon_meteor_thermite ||
damageSourceID == eDamageSourceId.mp_titanweapon_flame_wall ||
damageSourceID == eDamageSourceId.mp_titanability_slow_trap ||
damageSourceID == eDamageSourceId.mp_titancore_flame_wave_secondary
) // scorch's thermite damages, nerf scorch
DamageInfo_SetDamage( damageInfo, DamageInfo_GetDamage( damageInfo ) / 5 )

// Should be moved to a final damage callback once those are added
if ( damageSourceID in file.harvesterDamageSourceMods )
DamageInfo_ScaleDamage( damageInfo, file.harvesterDamageSourceMods[ damageSourceID ] )
}
void function OnHarvesterPostDamaged( entity harvester, var damageInfo )
{
Expand Down Expand Up @@ -1977,7 +2005,6 @@ void function OnHarvesterPostDamaged( entity harvester, var damageInfo )
}
}


// harvester down!
if ( harvester.GetHealth() == 0 )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ global function SHCreateGamemodeFW_Init

// object settings, changable through playlist vars
// default havester settings
global const int FW_DEFAULT_HARVESTER_HEALTH = 25000
global const int FW_DEFAULT_HARVESTER_SHIELD = 5000
global const int FW_DEFAULT_HARVESTER_HEALTH = 87500
global const int FW_DEFAULT_HARVESTER_SHIELD = 17500
global const float FW_DEFAULT_HARVESTER_REGEN_DELAY = 12.0
global const float FW_DEFAULT_HARVESTER_REGEN_TIME = 10.0
// default turret settings
Expand Down
13 changes: 13 additions & 0 deletions Northstar.CustomServers/keyvalues/playlists_v2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
playlists
{
Gamemodes
{
defaults
{
vars
{
player_force_respawn 5
}
}
}
}
18 changes: 18 additions & 0 deletions Northstar.CustomServers/mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@
{
"Name": "ns_allow_kill_commands",
"DefaultValue": "0"
},
{
"Name": "ns_progression_enabled",
"DefaultValue": "0",
"Flags": "ARCHIVE_PLAYERPROFILE"
}
],
"Scripts": [
Expand Down Expand Up @@ -150,6 +155,19 @@
"ServerCallback": {
"After": "AiTurretSentry_Init"
}
},
{
"Path": "sh_progression.nut",
"RunOn": "UI || SERVER || CLIENT",
"ServerCallback": {
"Before": "Progression_Init"
},
"ClientCallback": {
"Before": "Progression_Init"
},
"UICallback": {
"Before": "Progression_Init"
}
}
]
}
5 changes: 4 additions & 1 deletion Northstar.CustomServers/mod/cfg/autoexec_ns_server.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ sv_updaterate_mp 20 // default updaterate: 20 tick
sv_minupdaterate 20 // unsure if this actually works, but if it does, should set minimum client updaterate
sv_max_snapshots_multiplayer 300 // this needs to be updaterate * 15, or clients will dc in killreplay
net_data_block_enabled 0 // not really sure on this, have heard datablock could have security issues? doesn't seem to have any adverse effects being disabled
host_skip_client_dll_crc 1 // allow people to run modded client dlls, this is mainly so people running pilot visor colour mods can keep those, since they use a client.dll edit
host_skip_client_dll_crc 1 // allow people to run modded client dlls, this is mainly so people running pilot visor colour mods can keep those, since they use a client.dll edit

announcementVersion 1
announcement #PROGRESSION_ANNOUNCEMENT_BODY
4 changes: 3 additions & 1 deletion Northstar.CustomServers/mod/scripts/vscripts/_harvester.gnut
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ HarvesterStruct function SpawnHarvester( vector origin, vector angles, int healt
harvester.SetShieldHealthMax( shieldHealth )
harvester.SetShieldHealth( shieldHealth )
harvester.EnableAttackableByAI( 30, 0, AI_AP_FLAG_NONE )
SetObjectCanBeMeleed( harvester, false )
SetCustomSmartAmmoTarget( harvester, true )
SetObjectCanBeMeleed( harvester, true )
SetVisibleEntitiesInConeQueriableEnabled( harvester, true )
SetTeam(harvester,team)

DispatchSpawn( harvester )
Expand Down
Loading

0 comments on commit 0a17581

Please sign in to comment.