Skip to content

Commit

Permalink
Merge branch 'main' into feat/auto-dl
Browse files Browse the repository at this point in the history
  • Loading branch information
Alystrasz authored Nov 22, 2023
2 parents a179dfd + 4e394ce commit d16da9a
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 2 deletions.
50 changes: 48 additions & 2 deletions Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ void function InitPlayerForScoreEvents( entity player )
player.s.currentKillstreak <- 0
player.s.lastKillTime <- 0.0
player.s.currentTimedKillstreak <- 0
player.s.lastKillTime_Mayhem <- 0.0
player.s.currentTimedKillstreak_Mayhem <- 0
player.s.lastKillTime_Onslaught <- 0.0
player.s.currentTimedKillstreak_Onslaught <- 0
}

void function AddPlayerScore( entity targetPlayer, string scoreEventName, entity associatedEnt = null, string noideawhatthisis = "", int pointValueOverride = -1 )
Expand Down Expand Up @@ -93,6 +97,7 @@ void function ScoreEvent_PlayerKilled( entity victim, entity attacker, var damag
victim.s.currentTimedKillstreak = 0

victim.p.numberOfDeathsSinceLastKill++ // this is reset on kill
victim.p.lastKiller = attacker

// have to do this early before we reset victim's player killstreaks
// nemesis when you kill a player that is dominating you
Expand Down Expand Up @@ -131,12 +136,20 @@ void function ScoreEvent_PlayerKilled( entity victim, entity attacker, var damag
attacker.p.numberOfDeathsSinceLastKill = 0
}

// revenge + quick revenge
if ( attacker.p.lastKiller == victim )
{
if ( Time() - GetPlayerLastRespawnTime( attacker ) < QUICK_REVENGE_TIME_LIMIT )
AddPlayerScore( attacker, "QuickRevenge" )
else
AddPlayerScore( attacker, "Revenge" )
}

// untimed killstreaks
attacker.s.currentKillstreak++
if ( attacker.s.currentKillstreak == 3 )
if ( attacker.s.currentKillstreak == KILLINGSPREE_KILL_REQUIREMENT )
AddPlayerScore( attacker, "KillingSpree" )
else if ( attacker.s.currentKillstreak == 5 )
else if ( attacker.s.currentKillstreak == RAMPAGE_KILL_REQUIREMENT )
AddPlayerScore( attacker, "Rampage" )

// increment untimed killstreaks against specific players
Expand Down Expand Up @@ -234,6 +247,39 @@ void function ScoreEvent_NPCKilled( entity victim, entity attacker, var damageIn
AddPlayerScore( attacker, ScoreEventForNPCKilled( victim, damageInfo ), victim )
}
catch ( ex ) {}

if ( !attacker.IsPlayer() )
return

// mayhem/onslaught (timed killstreaks vs AI)

// reset before checking
if ( Time() - attacker.s.lastKillTime_Mayhem > MAYHEM_REQUIREMENT_TIME )
{
attacker.s.currentTimedKillstreak_Mayhem = 0
attacker.s.lastKillTime_Mayhem = Time()
}
if ( Time() - attacker.s.lastKillTime_Mayhem <= MAYHEM_REQUIREMENT_TIME )
{
attacker.s.currentTimedKillstreak_Mayhem++

if ( attacker.s.currentTimedKillstreak_Mayhem == MAYHEM_REQUIREMENT_KILLS )
AddPlayerScore( attacker, "Mayhem" )
}

// reset before checking
if ( Time() - attacker.s.lastKillTime_Onslaught > ONSLAUGHT_REQUIREMENT_TIME )
{
attacker.s.currentTimedKillstreak_Onslaught = 0
attacker.s.lastKillTime_Onslaught = Time()
}
if ( Time() - attacker.s.lastKillTime_Onslaught <= ONSLAUGHT_REQUIREMENT_TIME )
{
attacker.s.currentTimedKillstreak_Onslaught++

if ( attacker.s.currentTimedKillstreak_Onslaught == ONSLAUGHT_REQUIREMENT_KILLS )
AddPlayerScore( attacker, "Onslaught" )
}
}

void function ScoreEvent_MatchComplete( int winningTeam )
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# NorthstarMods
<a href="https://translate.harmony.tf/engage/northstar/">
<img src="https://translate.harmony.tf/widgets/northstar/-/client/svg-badge.svg" alt="Translation status" />
</a>

[Squirrel](http://www.squirrel-lang.org/squirreldoc/reference/index.html) scripts used to recreate server-side gamelogic and add [custom content](https://r2northstar.gitbook.io/r2northstar-wiki/using-northstar/gamemodes) to the game.

Expand All @@ -9,3 +12,11 @@ Issues in this repository should be created if they are related to these domains
- `Northstar.Coop` - Soon™.
- `Northstar.Custom` - Northstar custom content.
- `Northstar.CustomServer` - Server config files and scripts necessary for multiplayer.

### Translating

Translations can be submitted via [weblate](https://translate.harmony.tf/projects/northstar/client/).

<a href="https://translate.harmony.tf/engage/northstar/">
<img src="https://translate.harmony.tf/widgets/northstar/-/client/multi-auto.svg" alt="Translation status" />
</a>

0 comments on commit d16da9a

Please sign in to comment.