Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/unit_actions.js
Show First 20 Lines • Show All 941 Lines • ▼ Show 20 Lines | "getActionInfo": function(entState, targetState) | ||||
!targetState.production || | !targetState.production || | ||||
!targetState.production.entities.length) | !targetState.production.entities.length) | ||||
{ | { | ||||
for (let ent in g_Selection.selected) | for (let ent in g_Selection.selected) | ||||
if (targetState.id == +ent) | if (targetState.id == +ent) | ||||
return false; | return false; | ||||
} | } | ||||
// if the target has a static obstruction, move the rallypoint position closer to us | |||||
// keep this in sync with Rallypoint.js | |||||
let position = {}; | |||||
let template = GetTemplateData(targetState.template); | |||||
if (template.obstruction && template.obstruction.shape && template.obstruction.shape.type == "static") | |||||
{ | |||||
let size = Math.min(+template.obstruction.shape.width, +template.obstruction.shape.depth); | |||||
let vector = new Vector2D(targetState.position.x-entState.position.x,targetState.position.z-entState.position.z); | |||||
let pos = new Vector2D(targetState.position.x, targetState.position.z); | |||||
pos = pos.sub(vector.normalize().mult(size * 0.49)); | |||||
position.x = pos.x; | |||||
position.z = pos.y; | |||||
position.y = targetState.position.y; | |||||
} | |||||
else | |||||
{ | |||||
position.x = targetState.position.x; | |||||
position.z = targetState.position.z; | |||||
position.y = targetState.position.y; | |||||
} | |||||
return { | return { | ||||
"possible": true, | "possible": true, | ||||
"data": data, | "data": data, | ||||
"position": targetState.position, | "position": position, | ||||
"cursor": cursor, | "cursor": cursor, | ||||
"tooltip": tooltip | "tooltip": tooltip | ||||
}; | }; | ||||
}, | }, | ||||
"actionCheck": function(target, selection) | "actionCheck": function(target, selection) | ||||
{ | { | ||||
if (someUnitAI(selection) || !someRallyPoints(selection)) | if (someUnitAI(selection) || !someRallyPoints(selection)) | ||||
▲ Show 20 Lines • Show All 491 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator