Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/maps/scripts/TriggerHelper.js
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* Returns the elapsed ingame time in milliseconds since the gamestart. | * Returns the elapsed ingame time in milliseconds since the gamestart. | ||||
*/ | */ | ||||
TriggerHelper.GetTime = function() | TriggerHelper.GetTime = function() | ||||
{ | { | ||||
return Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer).GetTime(); | return Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer).GetTime(); | ||||
}; | }; | ||||
/** | /** | ||||
Lint: ESLintBear (indent): `Expected indentation of 0 tabs but found 1 space.` | |||||
* Returns the elpased ingame time in minutes since the gamestart. Useful for balancing. | * Returns the elpased ingame time in minutes since the gamestart. Useful for balancing. | ||||
*/ | */ | ||||
TriggerHelper.GetMinutes = function() | TriggerHelper.GetMinutes = function() | ||||
{ | { | ||||
return Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer).GetTime() / 60 / 1000; | return Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer).GetTime() / 60 / 1000; | ||||
}; | }; | ||||
TriggerHelper.GetEntitiesByPlayer = function(playerID) | TriggerHelper.GetEntitiesByPlayer = function(playerID) | ||||
▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | TriggerHelper.SpawnGarrisonedUnits = function(entity, template, count, owner) | ||||
{ | { | ||||
let ent = Engine.AddEntity(template); | let ent = Engine.AddEntity(template); | ||||
let cmpOwnership = Engine.QueryInterface(ent, IID_Ownership); | let cmpOwnership = Engine.QueryInterface(ent, IID_Ownership); | ||||
if (cmpOwnership) | if (cmpOwnership) | ||||
cmpOwnership.SetOwner(owner); | cmpOwnership.SetOwner(owner); | ||||
let cmpGarrisonable = Engine.QueryInterface(ent, IID_Garrisonable); | let cmpGarrisonable = Engine.QueryInterface(ent, IID_Garrisonable); | ||||
if (cmpGarrisonable && cmpGarrisonable.Autogarrison(entity)) | if (cmpGarrisonable && cmpGarrisonable.Garrison(entity)) | ||||
entities.push(ent); | entities.push(ent); | ||||
else | else | ||||
error("failed to garrison entity " + ent + " (" + template + ") inside " + entity); | error("failed to garrison entity " + ent + " (" + template + ") inside " + entity); | ||||
} | } | ||||
return entities; | return entities; | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 325 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Expected indentation of 0 tabs but found 1 space.