Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/DeathDamage.js
function DeathDamage() {} | function DeathDamage() {} | ||||
DeathDamage.prototype.Schema = | DeathDamage.prototype.Schema = | ||||
"<a:help>When a unit or building is destroyed, it inflicts damage to nearby units.</a:help>" + | "<a:help>When a unit or building is destroyed, it inflicts damage to nearby units.</a:help>" + | ||||
"<a:example>" + | "<a:example>" + | ||||
"<Shape>Circular</Shape>" + | "<Shape>Circular</Shape>" + | ||||
"<Range>20</Range>" + | "<Range>20</Range>" + | ||||
"<FriendlyFire>false</FriendlyFire>" + | "<FriendlyFire>false</FriendlyFire>" + | ||||
"<Damage>" + | "<Damage>" + | ||||
"<Hack>0.0</Hack>" + | "<Hack>0.0</Hack>" + | ||||
"<Pierce>10.0</Pierce>" + | "<Pierce>10.0</Pierce>" + | ||||
"<Crush>50.0</Crush>" + | "<Crush>50.0</Crush>" + | ||||
"</Damage>" + | "</Damage>" + | ||||
"</a:example>" + | "</a:example>" + | ||||
"<element name='Shape' a:help='Shape of the splash damage, can be circular.'><text/></element>" + | "<element name='Shape' a:help='Shape of the splash damage, can be circular.'><text/></element>" + | ||||
"<element name='Range' a:help='Size of the area affected by the splash.'><ref name='nonNegativeDecimal'/></element>" + | "<optional>" + | ||||
"<element name='MinRange' a:help='Inner size of the area not affected by the death damage (in meters). Defaults to 0.'><ref name='nonNegativeDecimal'/></element>" + | |||||
"</optional>" + | |||||
"<element name='MaxRange' a:help='Size of the area affected by the death damage (in meters).'><ref name='nonNegativeDecimal'/></element>" + | |||||
"<element name='FriendlyFire' a:help='Whether the splash damage can hurt non enemy units.'><data type='boolean'/></element>" + | "<element name='FriendlyFire' a:help='Whether the splash damage can hurt non enemy units.'><data type='boolean'/></element>" + | ||||
AttackHelper.BuildAttackEffectsSchema(); | AttackHelper.BuildAttackEffectsSchema(); | ||||
DeathDamage.prototype.Init = function() | DeathDamage.prototype.Init = function() | ||||
{ | { | ||||
}; | }; | ||||
// We have no dynamic state to save. | // We have no dynamic state to save. | ||||
Show All 17 Lines | if (owner == INVALID_PLAYER) | ||||
warn("Unit causing death damage does not have any owner."); | warn("Unit causing death damage does not have any owner."); | ||||
AttackHelper.CauseDamageOverArea({ | AttackHelper.CauseDamageOverArea({ | ||||
"type": "Death", | "type": "Death", | ||||
"attackData": this.GetDeathDamageEffects(), | "attackData": this.GetDeathDamageEffects(), | ||||
"attacker": this.entity, | "attacker": this.entity, | ||||
"attackerOwner": owner, | "attackerOwner": owner, | ||||
"origin": pos, | "origin": pos, | ||||
"radius": ApplyValueModificationsToEntity("DeathDamage/Range", +this.template.Range, this.entity), | "minRange": ApplyValueModificationsToEntity("DeathDamage/MinRange", +(this.template.MinRange || 0), this.entity), | ||||
"maxRange": ApplyValueModificationsToEntity("DeathDamage/MaxRange", +this.template.MaxRange, this.entity), | |||||
"shape": this.template.Shape, | "shape": this.template.Shape, | ||||
"friendlyFire": this.template.FriendlyFire == "true", | "friendlyFire": this.template.FriendlyFire == "true", | ||||
}); | }); | ||||
}; | }; | ||||
Engine.RegisterComponentType(IID_DeathDamage, "DeathDamage", DeathDamage); | Engine.RegisterComponentType(IID_DeathDamage, "DeathDamage", DeathDamage); |
Wildfire Games · Phabricator