Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Northstar.Client/mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@
"RunOn": "UI"
}
],
"Dependencies": {
"HAS_NORTHSTAR_CUSTOM": "Northstar.Custom"
},
"Localisation": [
"resource/northstar_client_localisation_%language%.txt"
]
Expand Down
4 changes: 4 additions & 0 deletions Northstar.Client/mod/scripts/vscripts/ui/_menus.nut
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,10 @@ void function UpdateMenusOnConnect( string levelname )
}

thread UpdateAnnouncementDialog()
#if HAS_NORTHSTAR_CUSTOM
// relies on script HTTP which is in Northstar.Custom
thread GetAtlasAnnouncement_Threaded()
#endif // HAS_NORTHSTAR_CUSTOM
Comment thread
ASpoonPlaysGames marked this conversation as resolved.
Outdated
}
else
{
Expand Down
4 changes: 4 additions & 0 deletions Northstar.Custom/mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,10 @@
{
"Path": "sh_northstar_safe_io.gnut",
"RunOn": "CLIENT || SERVER || UI"
},
{
"Path": "_atlas_announcements.nut",
"RunOn": "UI"
}
],

Expand Down
57 changes: 57 additions & 0 deletions Northstar.Custom/mod/scripts/vscripts/_atlas_announcements.nut
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
untyped

global function GetAtlasAnnouncement_Threaded

const string ATLAS_ANNOUNCEMENT_SUFFIX = "/client/announcement"

void function GetAtlasAnnouncement_Threaded()
{
string url = format( "%s%s", GetConVarString( "ns_masterserver_hostname" ), ATLAS_ANNOUNCEMENT_SUFFIX )
printt( format( "Getting announcement data from %s", url ) )

if ( !NSHttpGet( url, {}, OnRequestSuccess, OnRequestFailure ) )
printt( "Failed to get announcement data! (request failed to start)" )
}

void function OnRequestSuccess( HttpRequestResponse response )
{
if ( response.statusCode != 200 )
{
printt( format( "Failed to get announcement data! (Code: %i)\nReceived response: %s", response.statusCode, response.body ) )
return
}

string announcement
string announcementVersion

table responseBody = DecodeJSON( response.body )

if ( "announcement" in responseBody && typeof( responseBody[ "announcement" ] ) == "string" )
{
announcement = expect string( responseBody[ "announcement" ] )
}
else
{
printt( "Failed to parse announcement data! Couldnt parse \"announcement\" field,\n", response.body )
return
}

if ( "announcementVersion" in responseBody && typeof( responseBody[ "announcementVersion" ] ) == "string" )
{
announcementVersion = expect string( responseBody[ "announcementVersion" ] )
}
else
{
printt( "Failed to parse announcement data! Couldnt parse \"announcementVersion\" field,\n", response.body )
return
}

printt( "Successfully got announcement data!" )
SetConVarString( "announcement", announcement )
SetConVarString( "announcementVersion", announcementVersion )
}

void function OnRequestFailure( HttpRequestFailure response )
{
printt( format( "Failed to get announcement data! (Code: %i)\nReceived response: %s", response.errorCode, response.errorMessage ) )
}
3 changes: 0 additions & 3 deletions Northstar.CustomServers/mod/cfg/autoexec_ns_server.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,3 @@ sv_minupdaterate 20 // unsure if this actually works, but if it does, should set
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

announcementVersion 1
announcement #PROGRESSION_ANNOUNCEMENT_BODY