small updates for game interface
This commit is contained in:
parent
f3c6b10a35
commit
3640d1df54
@ -33,7 +33,12 @@ init()
|
|||||||
level.eventCallbacks[level.eventTypes.clientDataReceived] = ::OnClientDataReceived;
|
level.eventCallbacks[level.eventTypes.clientDataReceived] = ::OnClientDataReceived;
|
||||||
level.eventCallbacks[level.eventTypes.executeCommandRequested] = ::OnExecuteCommand;
|
level.eventCallbacks[level.eventTypes.executeCommandRequested] = ::OnExecuteCommand;
|
||||||
level.eventCallbacks[level.eventTypes.setClientDataCompleted] = ::OnSetClientDataCompleted;
|
level.eventCallbacks[level.eventTypes.setClientDataCompleted] = ::OnSetClientDataCompleted;
|
||||||
|
|
||||||
|
if ( GetDvarInt( "sv_iw4madmin_integration_enabled" ) != 1 )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// start long running tasks
|
// start long running tasks
|
||||||
level thread MonitorClientEvents();
|
level thread MonitorClientEvents();
|
||||||
level thread MonitorBus();
|
level thread MonitorBus();
|
||||||
@ -233,6 +238,7 @@ SaveTrackingMetrics()
|
|||||||
|
|
||||||
currentShotCount = self getPlayerStat( "mostshotsfired" );
|
currentShotCount = self getPlayerStat( "mostshotsfired" );
|
||||||
change = currentShotCount - self.lastShotCount;
|
change = currentShotCount - self.lastShotCount;
|
||||||
|
self.lastShotCount = currentShotCount;
|
||||||
|
|
||||||
if ( level.iw4adminIntegrationDebug == 1 )
|
if ( level.iw4adminIntegrationDebug == 1 )
|
||||||
{
|
{
|
||||||
@ -251,7 +257,6 @@ SaveTrackingMetrics()
|
|||||||
|
|
||||||
IncrementClientMeta( "TotalShotsFired", change, self.persistentClientId );
|
IncrementClientMeta( "TotalShotsFired", change, self.persistentClientId );
|
||||||
|
|
||||||
self.lastShotCount = currentShotCount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildEventRequest( responseExpected, eventType, eventSubtype, entOrId, data )
|
BuildEventRequest( responseExpected, eventType, eventSubtype, entOrId, data )
|
||||||
|
@ -17,12 +17,16 @@ let plugin = {
|
|||||||
name: 'Game Interface',
|
name: 'Game Interface',
|
||||||
|
|
||||||
onEventAsync: (gameEvent, server) => {
|
onEventAsync: (gameEvent, server) => {
|
||||||
const eventType = eventTypes[gameEvent.Type];
|
|
||||||
|
|
||||||
if (servers[server.EndPoint] != null && !servers[server.EndPoint].enabled) {
|
if (servers[server.EndPoint] != null && !servers[server.EndPoint].enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const eventType = eventTypes[gameEvent.Type];
|
||||||
|
|
||||||
|
if (eventType === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (eventType) {
|
switch (eventType) {
|
||||||
case 'start':
|
case 'start':
|
||||||
const enabled = initialize(server);
|
const enabled = initialize(server);
|
||||||
@ -265,6 +269,11 @@ const parseEvent = (input) => {
|
|||||||
|
|
||||||
const initialize = (server) => {
|
const initialize = (server) => {
|
||||||
const logger = _serviceResolver.ResolveService('ILogger');
|
const logger = _serviceResolver.ResolveService('ILogger');
|
||||||
|
|
||||||
|
servers[server.EndPoint] = {
|
||||||
|
enabled: false
|
||||||
|
}
|
||||||
|
|
||||||
let enabled = false;
|
let enabled = false;
|
||||||
try {
|
try {
|
||||||
enabled = server.GetServerDvar('sv_iw4madmin_integration_enabled') === '1';
|
enabled = server.GetServerDvar('sv_iw4madmin_integration_enabled') === '1';
|
||||||
@ -275,9 +284,6 @@ const initialize = (server) => {
|
|||||||
logger.WriteInfo(`GSC Integration enabled = ${enabled}`);
|
logger.WriteInfo(`GSC Integration enabled = ${enabled}`);
|
||||||
|
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
servers[server.EndPoint] = {
|
|
||||||
enabled: false
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,10 +294,8 @@ const initialize = (server) => {
|
|||||||
// necessary to prevent multi-threaded access to the JS context
|
// necessary to prevent multi-threaded access to the JS context
|
||||||
timer.SetDependency(_lock);
|
timer.SetDependency(_lock);
|
||||||
|
|
||||||
servers[server.EndPoint] = {
|
servers[server.EndPoint].timer = timer;
|
||||||
timer: timer,
|
servers[server.EndPoint].enabled = true;
|
||||||
enabled: true
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
server.SetServerDvar(inDvar, '');
|
server.SetServerDvar(inDvar, '');
|
||||||
|
Loading…
Reference in New Issue
Block a user