Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/unit_actions.js
/** | /** | ||||
* Specifies which template should indicate the target location of a player command, | * Specifies which template should indicate the target location of a player command, | ||||
* given a command type. | * given a command type. | ||||
*/ | */ | ||||
var g_TargetMarker = { | var g_TargetMarker = { | ||||
"move": "special/target_marker" | "move": "special/target_marker" | ||||
}; | }; | ||||
var g_DefaultFormation = "special/formations/box"; | |||||
var g_NullFormation = "special/formations/null"; | |||||
/** | /** | ||||
* Which enemy entity types will be attacked on sight when patroling. | * Which enemy entity types will be attacked on sight when patroling. | ||||
*/ | */ | ||||
var g_PatrolTargets = ["Unit"]; | var g_PatrolTargets = ["Unit"]; | ||||
const g_DisabledTags = { "color": "255 140 0" }; | const g_DisabledTags = { "color": "255 140 0" }; | ||||
/** | /** | ||||
Show All 30 Lines | var g_UnitActions = | ||||
{ | { | ||||
"execute": function(target, action, selection, queued) | "execute": function(target, action, selection, queued) | ||||
{ | { | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "walk", | "type": "walk", | ||||
"entities": selection, | "entities": selection, | ||||
"x": target.x, | "x": target.x, | ||||
"z": target.z, | "z": target.z, | ||||
"queued": queued | "queued": queued, | ||||
"formation": g_DefaultFormation | |||||
}); | }); | ||||
DrawTargetMarker(target); | DrawTargetMarker(target); | ||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_walk", | "name": "order_walk", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
Show All 34 Lines | "execute": function(target, action, selection, queued) | ||||
targetClasses = { "attack": ["Unit", "Structure"] }; | targetClasses = { "attack": ["Unit", "Structure"] }; | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "attack-walk", | "type": "attack-walk", | ||||
"entities": selection, | "entities": selection, | ||||
"x": target.x, | "x": target.x, | ||||
"z": target.z, | "z": target.z, | ||||
"targetClasses": targetClasses, | "targetClasses": targetClasses, | ||||
"queued": queued | "queued": queued, | ||||
"formation": g_DefaultFormation | |||||
}); | }); | ||||
DrawTargetMarker(target); | DrawTargetMarker(target); | ||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_walk", | "name": "order_walk", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
Show All 23 Lines | var g_UnitActions = | ||||
{ | { | ||||
"execute": function(target, action, selection, queued) | "execute": function(target, action, selection, queued) | ||||
{ | { | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "attack", | "type": "attack", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
"allowCapture": true, | "allowCapture": true, | ||||
"queued": queued | "queued": queued, | ||||
"formation": g_DefaultFormation | |||||
}); | }); | ||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_attack", | "name": "order_attack", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
Show All 29 Lines | var g_UnitActions = | ||||
{ | { | ||||
"execute": function(target, action, selection, queued) | "execute": function(target, action, selection, queued) | ||||
{ | { | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "attack", | "type": "attack", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
"queued": queued, | "queued": queued, | ||||
"allowCapture": false | "allowCapture": false, | ||||
"formation": g_DefaultFormation | |||||
}); | }); | ||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_attack", | "name": "order_attack", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | "execute": function(target, action, selection, queued) | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "patrol", | "type": "patrol", | ||||
"entities": selection, | "entities": selection, | ||||
"x": target.x, | "x": target.x, | ||||
"z": target.z, | "z": target.z, | ||||
"target": action.target, | "target": action.target, | ||||
"targetClasses": { "attack": g_PatrolTargets }, | "targetClasses": { "attack": g_PatrolTargets }, | ||||
"queued": queued, | "queued": queued, | ||||
"allowCapture": false | "allowCapture": false, | ||||
"formation": g_DefaultFormation | |||||
}); | }); | ||||
DrawTargetMarker(target); | DrawTargetMarker(target); | ||||
Engine.GuiInterfaceCall("PlaySound", { "name": "order_patrol", "entity": selection[0] }); | Engine.GuiInterfaceCall("PlaySound", { "name": "order_patrol", "entity": selection[0] }); | ||||
return true; | return true; | ||||
}, | }, | ||||
"getActionInfo": function(entState, targetState) | "getActionInfo": function(entState, targetState) | ||||
Show All 31 Lines | var g_UnitActions = | ||||
"heal": | "heal": | ||||
{ | { | ||||
"execute": function(target, action, selection, queued) | "execute": function(target, action, selection, queued) | ||||
{ | { | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "heal", | "type": "heal", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
"queued": queued | "queued": queued, | ||||
"formation": g_NullFormation | |||||
}); | }); | ||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_heal", | "name": "order_heal", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
Show All 34 Lines | var g_UnitActions = | ||||
{ | { | ||||
"execute": function(target, action, selection, queued) | "execute": function(target, action, selection, queued) | ||||
{ | { | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "repair", | "type": "repair", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
"autocontinue": true, | "autocontinue": true, | ||||
"queued": queued | "queued": queued, | ||||
"formation": g_NullFormation | |||||
}); | }); | ||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": action.foundation ? "order_build" : "order_repair", | "name": action.foundation ? "order_build" : "order_repair", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | var g_UnitActions = | ||||
"gather": | "gather": | ||||
{ | { | ||||
"execute": function(target, action, selection, queued) | "execute": function(target, action, selection, queued) | ||||
{ | { | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "gather", | "type": "gather", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
"queued": queued | "queued": queued, | ||||
"formation": g_NullFormation | |||||
}); | }); | ||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_gather", | "name": "order_gather", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
Show All 31 Lines | var g_UnitActions = | ||||
"returnresource": | "returnresource": | ||||
{ | { | ||||
"execute": function(target, action, selection, queued) | "execute": function(target, action, selection, queued) | ||||
{ | { | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "returnresource", | "type": "returnresource", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
"queued": queued | "queued": queued, | ||||
"formation": g_NullFormation | |||||
}); | }); | ||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_gather", | "name": "order_gather", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | "setup-trade-route": | ||||
"execute": function(target, action, selection, queued) | "execute": function(target, action, selection, queued) | ||||
{ | { | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "setup-trade-route", | "type": "setup-trade-route", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
"source": null, | "source": null, | ||||
"route": null, | "route": null, | ||||
"queued": queued | "queued": queued, | ||||
"formation": g_NullFormation | |||||
}); | }); | ||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_trade", | "name": "order_trade", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | var g_UnitActions = | ||||
"garrison": | "garrison": | ||||
{ | { | ||||
"execute": function(target, action, selection, queued) | "execute": function(target, action, selection, queued) | ||||
{ | { | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "garrison", | "type": "garrison", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
"queued": queued | "queued": queued, | ||||
"formation": g_NullFormation | |||||
}); | }); | ||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_garrison", | "name": "order_garrison", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | var g_UnitActions = | ||||
"guard": | "guard": | ||||
{ | { | ||||
"execute": function(target, action, selection, queued) | "execute": function(target, action, selection, queued) | ||||
{ | { | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "guard", | "type": "guard", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
"queued": queued | "queued": queued, | ||||
"formation": g_DefaultFormation | |||||
}); | }); | ||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_guard", | "name": "order_guard", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 863 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator