Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/GuiInterface.js
Show First 20 Lines • Show All 385 Lines • ▼ Show 20 Lines | GuiInterface.prototype.GetEntityState = function(player, ent) | ||||
if (cmpTurretHolder) | if (cmpTurretHolder) | ||||
ret.turretHolder = { | ret.turretHolder = { | ||||
"turretPoints": cmpTurretHolder.GetTurretPoints() | "turretPoints": cmpTurretHolder.GetTurretPoints() | ||||
}; | }; | ||||
let cmpTurretable = Engine.QueryInterface(ent, IID_Turretable); | let cmpTurretable = Engine.QueryInterface(ent, IID_Turretable); | ||||
if (cmpTurretable) | if (cmpTurretable) | ||||
ret.turretable = { | ret.turretable = { | ||||
"ejectable": cmpTurretable.IsEjectable(), | |||||
"holder": cmpTurretable.HolderID() | "holder": cmpTurretable.HolderID() | ||||
}; | }; | ||||
let cmpGarrisonable = Engine.QueryInterface(ent, IID_Garrisonable); | let cmpGarrisonable = Engine.QueryInterface(ent, IID_Garrisonable); | ||||
if (cmpGarrisonable) | if (cmpGarrisonable) | ||||
ret.garrisonable = { | ret.garrisonable = { | ||||
"holder": cmpGarrisonable.HolderID(), | "holder": cmpGarrisonable.HolderID(), | ||||
"size": cmpGarrisonable.UnitSize() | "size": cmpGarrisonable.UnitSize() | ||||
▲ Show 20 Lines • Show All 1,518 Lines • ▼ Show 20 Lines | result = { | ||||
"gain": cmpEntityTrader.CalculateGain(firstMarket, data.target), | "gain": cmpEntityTrader.CalculateGain(firstMarket, data.target), | ||||
}; | }; | ||||
else | else | ||||
result = { "type": "set first" }; | result = { "type": "set first" }; | ||||
return result; | return result; | ||||
}; | }; | ||||
GuiInterface.prototype.CanAttack = function(player, data) | GuiInterface.prototype.CanAttack = function(player, data) | ||||
Stan: In antoher diff since player is unused I guess it could be removed ? | |||||
Done Inline ActionsNot really, the GUI always sends player first, even though it is often unused. Freagarach: Not really, the GUI always sends `player` first, even though it is often unused. | |||||
{ | { | ||||
let cmpAttack = Engine.QueryInterface(data.entity, IID_Attack); | let cmpAttack = Engine.QueryInterface(data.entity, IID_Attack); | ||||
return cmpAttack && cmpAttack.CanAttack(data.target, data.types || undefined); | return cmpAttack && cmpAttack.CanAttack(data.target, data.types || undefined); | ||||
Done Inline ActionsI'd reverse those two checks. The natural condition is having a cmpAttack, and then only check for UnitAI. wraitii: I'd reverse those two checks. The natural condition is having a cmpAttack, and then only check… | |||||
}; | }; | ||||
/* | /* | ||||
* Returns batch build time. | * Returns batch build time. | ||||
*/ | */ | ||||
GuiInterface.prototype.GetBatchTime = function(player, data) | GuiInterface.prototype.GetBatchTime = function(player, data) | ||||
{ | { | ||||
Done Inline ActionsThese changes seem unrelated? wraitii: These changes seem unrelated? | |||||
Done Inline ActionsSame as above, we allow to have healers as turrets now. Freagarach: Same as above, we allow to have healers as turrets now. | |||||
let cmpProductionQueue = Engine.QueryInterface(data.entity, IID_ProductionQueue); | let cmpProductionQueue = Engine.QueryInterface(data.entity, IID_ProductionQueue); | ||||
if (!cmpProductionQueue) | if (!cmpProductionQueue) | ||||
return 0; | return 0; | ||||
Done Inline ActionsSame here. wraitii: Same here. | |||||
return cmpProductionQueue.GetBatchTime(data.batchSize); | return cmpProductionQueue.GetBatchTime(data.batchSize); | ||||
}; | }; | ||||
GuiInterface.prototype.IsMapRevealed = function(player) | GuiInterface.prototype.IsMapRevealed = function(player) | ||||
{ | { | ||||
return Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).GetLosRevealAll(player); | return Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).GetLosRevealAll(player); | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 164 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
In antoher diff since player is unused I guess it could be removed ?