Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/maps/scripts/TriggerHelper.js
Show All 26 Lines | |||||
* @param source Entity id of the point where they will be spawned from | * @param source Entity id of the point where they will be spawned from | ||||
* @param template Name of the template | * @param template Name of the template | ||||
* @param count Number of units to spawn | * @param count Number of units to spawn | ||||
* @param owner Player id of the owner of the new units. By default, the owner | * @param owner Player id of the owner of the new units. By default, the owner | ||||
* of the source entity. | * of the source entity. | ||||
*/ | */ | ||||
TriggerHelper.SpawnUnits = function(source, template, count, owner) | TriggerHelper.SpawnUnits = function(source, template, count, owner) | ||||
{ | { | ||||
if (count < 1) | |||||
return []; | |||||
warn("SpawnUnits " + count + " " + template); | |||||
let entities = []; | let entities = []; | ||||
let cmpFootprint = Engine.QueryInterface(source, IID_Footprint); | let cmpFootprint = Engine.QueryInterface(source, IID_Footprint); | ||||
let cmpPosition = Engine.QueryInterface(source, IID_Position); | let cmpPosition = Engine.QueryInterface(source, IID_Position); | ||||
if (!cmpPosition || !cmpPosition.IsInWorld()) | if (!cmpPosition || !cmpPosition.IsInWorld()) | ||||
{ | { | ||||
error("tried to create entity from a source without position"); | error("tried to create entity from a source without position"); | ||||
return entities; | return entities; | ||||
▲ Show 20 Lines • Show All 119 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator