# Rewrite of the game's simulation system

Giant merge from
http://svn.wildfiregames.com/hg-source/file/5fb522019d5e
Infrastructure is largely complete, gameplay is largely missing
Disabled by default; use command-line flag "-sim2"
(Second attempt at commit...)

This was SVN commit r7259.
This commit is contained in:
Ykkrosh 2010-01-09 19:20:14 +00:00
parent 3339aea2a7
commit 7c2e9027c2
480 changed files with 16454 additions and 775 deletions

View File

@ -0,0 +1,11 @@
function TestScript2A() {}
TestScript2A.prototype.Init = function() {
this.x = eval(this.template.y);
};
TestScript2A.prototype.GetX = function() {
return this.x;
};
Engine.RegisterComponentType(IID_Test2, "TestScript2A", TestScript2A);

View File

@ -0,0 +1,12 @@
function TestScript1A() {}
try {
Engine.RegisterComponentType(12345, "TestScript1A", TestScript1A);
Engine.TS_FAIL("Missed exception");
} catch (e) {
// print("Caught exception: " + e + "\n");
}
var n = Engine.QueryInterface(12345, IID_Test1);
if (n !== null)
Engine.TS_FAIL("QueryInterface return "+n+", not null");

View File

@ -0,0 +1,12 @@
function TestScript1A() {}
TestScript1A.prototype.GetX = function() {
// Test that .entity is readonly
delete this.entity;
this.entity = -1;
// and return the value
return this.entity;
};
Engine.RegisterComponentType(IID_Test1, "TestScript1A", TestScript1A);

View File

@ -0,0 +1,7 @@
function TestScript1_Helper() {}
TestScript1_Helper.prototype.GetX = function() {
return AdditionHelper(1, 2);
};
Engine.RegisterComponentType(IID_Test1, "TestScript1_Helper", TestScript1_Helper);

View File

@ -0,0 +1,23 @@
function HotloadA() {}
HotloadA.prototype.Init = function() {
this.x = +this.template.x;
};
HotloadA.prototype.GetX = function() {
return this.x;
};
Engine.RegisterComponentType(IID_Test1, "HotloadA", HotloadA);
function HotloadB() {}
HotloadB.prototype.Init = function() {
this.x = +this.template.x;
};
HotloadB.prototype.GetX = function() {
return this.x*2;
};
Engine.RegisterComponentType(IID_Test1, "HotloadB", HotloadB);

View File

@ -0,0 +1,11 @@
function HotloadA() {}
HotloadA.prototype.Init = function() {
this.x = +this.template.x;
};
HotloadA.prototype.GetX = function() {
return this.x*10;
};
Engine.RegisterComponentType(IID_Test1, "HotloadA", HotloadA);

View File

@ -0,0 +1,32 @@
function TestScript1A() {}
TestScript1A.prototype.Init = function() {
this.x = 100;
};
TestScript1A.prototype.GetX = function() {
return this.x;
};
TestScript1A.prototype.OnUpdate = function(msg) {
this.x += msg.turnLength;
}
Engine.RegisterComponentType(IID_Test1, "TestScript1A", TestScript1A);
// -------- //
function TestScript2A() {}
TestScript2A.prototype.Init = function() {
this.x = 200;
};
TestScript2A.prototype.GetX = function() {
Engine.BroadcastMessage(MT_Update, { turnLength: 50 });
Engine.PostMessage(1, MT_Update, { turnLength: 500 });
Engine.PostMessage(2, MT_Update, { turnLength: 5000 });
return this.x;
};
Engine.RegisterComponentType(IID_Test2, "TestScript2A", TestScript2A);

View File

@ -0,0 +1,31 @@
function TestScript1_Init() {}
TestScript1_Init.prototype.Init = function() {
var param = this.template;
// print("# ",uneval(param),"\n");
if (param)
this.x = (+param.x) + (+param.y._string) + (+param.y.z['@w']) + (+param.y.z.a);
else
this.x = 100;
};
TestScript1_Init.prototype.GetX = function() {
return this.x;
};
Engine.RegisterComponentType(IID_Test1, "TestScript1_Init", TestScript1_Init);
// -------- //
function TestScript1_readonly() {}
TestScript1_readonly.prototype.GetX = function() {
this.template = null;
delete this.template;
try { this.template.x += 1000; } catch(e) { }
try { delete this.template.x; } catch(e) { }
try { this.template.y = 2000; } catch(e) { }
return +(this.template.x || 1) + +(this.template.y || 2);
};
Engine.RegisterComponentType(IID_Test1, "TestScript1_readonly", TestScript1_readonly);

View File

@ -0,0 +1,26 @@
function TestScript1A() {}
TestScript1A.prototype.Init = function() {
this.x = 100;
};
TestScript1A.prototype.GetX = function() {
var test2 = Engine.QueryInterface(this.entity, IID_Test2);
return test2.GetX() + (test2.x || 0);
};
Engine.RegisterComponentType(IID_Test1, "TestScript1A", TestScript1A);
// -------- //
function TestScript2A() {}
TestScript2A.prototype.Init = function() {
this.x = 200;
};
TestScript2A.prototype.GetX = function() {
return this.x;
};
Engine.RegisterComponentType(IID_Test2, "TestScript2A", TestScript2A);

View File

@ -0,0 +1,68 @@
function TestScript1_values() {}
TestScript1_values.prototype.Init = function() {
this.x = +this.template.x;
this.str = "this is a string";
this.things = { a: 1, b: "2", c: [3, "4", [5, []]] };
};
TestScript1_values.prototype.GetX = function() {
// print(uneval(this));
return this.x;
};
Engine.RegisterComponentType(IID_Test1, "TestScript1_values", TestScript1_values);
// -------- //
function TestScript1_entity() {}
TestScript1_entity.prototype.GetX = function() {
// Test that .entity is readonly
delete this.entity;
this.entity = -1;
// and return the value
return this.entity;
};
Engine.RegisterComponentType(IID_Test1, "TestScript1_entity", TestScript1_entity);
// -------- //
function TestScript1_nontree() {}
TestScript1_nontree.prototype.Init = function() {
var n = [1];
this.x = [n, n, null, { y: n }];
this.x[2] = this.x;
};
TestScript1_nontree.prototype.GetX = function() {
// print(uneval(this)+"\n");
this.x[0][0] += 1;
return this.x[0][0] + this.x[1][0] + this.x[2][0][0] + this.x[3].y[0];
}
Engine.RegisterComponentType(IID_Test1, "TestScript1_nontree", TestScript1_nontree);
// -------- //
function TestScript1_getter() {}
TestScript1_getter.prototype.Init = function() {
this.x = 100;
this.__defineGetter__('x', function () { return 200; });
};
Engine.RegisterComponentType(IID_Test1, "TestScript1_getter", TestScript1_getter);
// -------- //
function TestScript1_consts() {}
TestScript1_consts.prototype.GetX = function() {
return (+this.entity) + (+this.template.x);
};
Engine.RegisterComponentType(IID_Test1, "TestScript1_consts", TestScript1_consts);

View File

@ -0,0 +1,45 @@
function TestScript1A() {}
TestScript1A.prototype.Init = function() {
this.x = 101000;
};
TestScript1A.prototype.GetX = function() {
return this.x;
};
TestScript1A.prototype.OnTurnStart = function(msg) {
this.x += 1;
};
Engine.RegisterComponentType(IID_Test1, "TestScript1A", TestScript1A);
// -------- //
function TestScript1B() {}
TestScript1B.prototype = new TestScript1A();
TestScript1B.prototype.Init = function() {
this.x = 102000;
};
Engine.RegisterComponentType(IID_Test1, "TestScript1B", TestScript1B);
// -------- //
function TestScript2A() {}
TestScript2A.prototype.Init = function() {
this.x = 201000;
};
TestScript2A.prototype.GetX = function() {
return this.x;
};
TestScript2A.prototype.OnUpdate = function(msg) {
this.x += msg.turnLength;
};
Engine.RegisterComponentType(IID_Test2, "TestScript2A", TestScript2A);

View File

@ -0,0 +1,5 @@
function AdditionHelper(a, b) {
return a+b;
}
Engine.RegisterGlobal("AdditionHelper", AdditionHelper);

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity>
<x>12345</x>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity>
<HotloadA>
<x>100</x>
</HotloadA>
</Entity>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="inherit-nonexistent">broken</Entity>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity loop2="2" parent="inherit-loop">loop-2</Entity>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity loop1="1" parent="inherit-loop-2">loop</Entity>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity>
<x a="a1" b="b1" c="c1">
<d>d1</d>
<e>e1</e>
<f>f1</f>
</x>
</Entity>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="inherit1">
<x a="a2">
<d>d2</d>
<g>g2</g>
</x>
</Entity>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity>
<TestScript1_consts><x>12345</x></TestScript1_consts>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="test1">
<Test1A>
<x>1234</x>
</Test1A>
</Entity>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity>
<Test1A>
<x>999</x>
</Test1A>
<TestScript2A>
<y>(600+17)*20+5</y>
</TestScript2A>
</Entity>

View File

@ -14,7 +14,7 @@
function messageBox (mbWidth, mbHeight, mbMessage, mbTitle, mbMode, mbButtonCaptions, mbButtonsCode) function messageBox (mbWidth, mbHeight, mbMessage, mbTitle, mbMode, mbButtonCaptions, mbButtonsCode)
{ {
pushGuiPage("page_msgbox.xml", { Engine.PushGuiPage("page_msgbox.xml", {
width: mbWidth, width: mbWidth,
height: mbHeight, height: mbHeight,
message: mbMessage, message: mbMessage,

View File

@ -39,7 +39,7 @@ function launchGame ()
closeMainMenuSubWindow ("pgSessionSetup"); closeMainMenuSubWindow ("pgSessionSetup");
// Display loading screen. // Display loading screen.
switchGuiPage("page_loading.xml"); Engine.SwitchGuiPage("page_loading.xml");
console.write( "running startGame()" ); console.write( "running startGame()" );
@ -47,7 +47,7 @@ function launchGame ()
if (! startGame()) if (! startGame())
{ {
// Failed to start the game; go back to the main menu. // Failed to start the game; go back to the main menu.
switchGuiPage("page_pregame.xml"); Engine.SwitchGuiPage("page_pregame.xml");
// Restore default cursor. // Restore default cursor.
setCursor ("arrow-default"); setCursor ("arrow-default");
// Show an error message // Show an error message

View File

@ -146,43 +146,19 @@
========================================== ==========================================
--> -->
<color name="black" <color name="black">0 0 0</color>
>0 0 0 <color name="white">255 255 255</color>
</color> <color name="red">255 0 0</color>
<color name="blue">0 0 255</color>
<color name="yellow">255 255 0</color>
<color name="gold" <color name="gold">237 227 167</color>
>237 227 167 <color name="gray">243 242 240</color>
</color> <color name="darkgray">43 42 40</color>
<color name="green">0 200 0</color>
<color name="mustard">191 191 2</color>
<color name="brown">159 98 24</color>
<color name="white"
>255 255 255
</color>
<color name="gray"
>243 242 240
</color>
<color name="darkgray"
>43 42 40
</color>
<color name="blue"
>0 0 255
</color>
<color name="green"
>0 200 0
</color>
<color name="mustard"
>191 191 2
</color>
<color name="brown"
>159 98 24
</color>
<!-- <!--
NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED
NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED

View File

@ -38,7 +38,10 @@ function reallyStartGame()
// to start the game (ie loading progress has reached 100%). // to start the game (ie loading progress has reached 100%).
// Switch GUI from loading screen to game session. // Switch GUI from loading screen to game session.
switchGuiPage("page_session.xml"); if (Engine.IsNewSimulation())
Engine.SwitchGuiPage("page_session_new.xml");
else
Engine.SwitchGuiPage("page_session.xml");
// Restore default cursor. // Restore default cursor.
setCursor ("arrow-default"); setCursor ("arrow-default");

View File

@ -49,19 +49,19 @@
if (data.buttonCaptions.length >= 1) if (data.buttonCaptions.length >= 1)
{ {
mbButton1Obj.caption = data.buttonCaptions[0]; mbButton1Obj.caption = data.buttonCaptions[0];
mbButton1Obj.onPress = function () { popGuiPage(); if (codes[0]) codes[0](); } mbButton1Obj.onPress = function () { Engine.PopGuiPage(); if (codes[0]) codes[0](); }
mbButton1Obj.hidden = false; mbButton1Obj.hidden = false;
} }
if (data.buttonCaptions.length >= 2) if (data.buttonCaptions.length >= 2)
{ {
mbButton2Obj.caption = data.buttonCaptions[1]; mbButton2Obj.caption = data.buttonCaptions[1];
mbButton2Obj.onPress = function () { popGuiPage(); if (codes[1]) codes[1](); } mbButton2Obj.onPress = function () { Engine.PopGuiPage(); if (codes[1]) codes[1](); }
mbButton2Obj.hidden = false; mbButton2Obj.hidden = false;
} }
if (data.buttonCaptions.length >= 3) if (data.buttonCaptions.length >= 3)
{ {
mbButton3Obj.caption = data.buttonCaptions[2]; mbButton3Obj.caption = data.buttonCaptions[2];
mbButton3Obj.onPress = function () { popGuiPage(); if (codes[2]) codes[2](); } mbButton3Obj.onPress = function () { Engine.PopGuiPage(); if (codes[2]) codes[2](); }
mbButton3Obj.hidden = false; mbButton3Obj.hidden = false;
} }

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<page>
<include>common/setup.xml</include>
<include>common/styles.xml</include>
<include>common/sprite1.xml</include>
<include>common/init.xml</include>
<include>session_new/session.xml</include>
<include>common/global.xml</include>
</page>

View File

@ -71,7 +71,7 @@ function endSession (closeType)
cancelInterval(); cancelInterval();
// Swap GUIs to display main menu. // Swap GUIs to display main menu.
switchGuiPage("page_pregame.xml"); Engine.SwitchGuiPage("page_pregame.xml");
break; break;
case ("exit"): case ("exit"):
// If the player has chosen to shutdown and immediately return to operating system, // If the player has chosen to shutdown and immediately return to operating system,

View File

@ -0,0 +1,72 @@
const SDL_BUTTON_LEFT = 1;
const SDL_BUTTON_MIDDLE = 2;
const SDL_BUTTON_RIGHT = 3;
// TODO: these constants should be defined somewhere else instead, in
// case any other code wants to use them too
var INPUT_NORMAL = 0;
var INPUT_DRAGGING = 1;
var inputState = INPUT_NORMAL;
function handleInputBeforeGui(ev)
{
return false;
}
/*
Selection methods: (not all currently implemented)
- Left-click on entity to select (always chooses the 'closest' one if the mouse is over several).
Includes non-controllable units (e.g. trees, enemy units).
- Double-left-click to select entity plus all of the same type on the screen.
- Triple-left-click to select entity plus all of the same type in the world.
- Left-click-and-drag to select all in region. Only includes controllable units.
- Left-click on empty space to deselect all.
- Hotkeys to select various groups.
- Shift plus left-click on entity to toggle selection of that unit. Only includes controllable.
- Shift plus any other selection method above, to add them to current selection.
*/
function handleInputAfterGui(ev)
{
switch (inputState)
{
case INPUT_NORMAL:
switch (ev.type)
{
case "mousebuttondown":
if (ev.button == SDL_BUTTON_LEFT)
{
var ents = Engine.PickEntitiesAtPoint(ev.x, ev.y);
if (!ents.length)
{
resetEntitySelection();
return true;
}
resetEntitySelection();
addEntitySelection([ents[0]]);
Engine.PostNetworkCommand({"type": "spin", "entities": [ents[0]]});
return true;
}
else if (ev.button == SDL_BUTTON_RIGHT)
{
var ents = getEntitySelection();
if (ents.length)
{
var target = Engine.GetTerrainAtPoint(ev.x, ev.y);
Engine.PostNetworkCommand({"type": "walk", "entities": ents, "x": target.x, "z": target.z});
return true;
}
}
}
break;
}
return false;
}

View File

@ -0,0 +1,46 @@
var g_Selection = {}; // { id: 1, id: 1, ... } for each selected entity ID 'id'
var g_ActiveSelectionColour = { r:1, g:1, b:1, a:1 };
var g_InactiveSelectionColour = { r:0, g:0, b:0, a:0 };
function toggleEntitySelection(ent)
{
if (g_Selection[ent])
{
Engine.SetEntitySelectionHighlight(ent, g_InactiveSelectionColour);
delete g_Selection[ent];
}
else
{
Engine.SetEntitySelectionHighlight(ent, g_ActiveSelectionColour);
g_Selection[ent] = 1;
}
}
function addEntitySelection(ents)
{
for each (var ent in ents)
{
if (!g_Selection[ent])
{
Engine.SetEntitySelectionHighlight(ent, g_ActiveSelectionColour);
g_Selection[ent] = 1;
}
}
}
function resetEntitySelection()
{
for (var ent in g_Selection)
Engine.SetEntitySelectionHighlight(ent, g_InactiveSelectionColour);
g_Selection = {};
}
function getEntitySelection()
{
var ents = [];
for (var ent in g_Selection)
ents.push(ent);
return ents;
}

View File

@ -0,0 +1,22 @@
function init()
{
updateDebug();
}
function onSimulationUpdate()
{
updateDebug();
}
function updateDebug()
{
var debug = getGUIObjectByName("debug");
var simState = Engine.GetSimulationState();
var text = "Simulation:\n" + uneval(simState);
text += "\n\n";
for (var ent in g_Selection)
{
text += "Entity "+ent+":\n" + uneval(Engine.GetEntityState(ent)) + "\n";
}
debug.caption = text;
}

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<objects>
<!--
<script file="gui/common/functions_utility.js" />
<script file="gui/common/functions_utility_list.js" />
<script file="gui/common/functions_utility_object.js" />
<script file="gui/common/functions_utility_coord.js" />
<script file="gui/common/functions_utility_music.js" />
<script file="gui/common/functions_utility_animation.js" />
-->
<script file="gui/common/functions_global_object.js" />
<!--
<script file="gui/common/functions_page_pregame.js" />
<script file="gui/common/functions_page_pregame_multiplayer.js" />
<script file="gui/common/functions_page_pregame_setup.js" />
<script file="gui/common/functions_page_pregame_load.js" />
<script file="gui/common/functions_page_session.js"/>
<script file="gui/common/functions_page_session_status_pane.js" />
<script file="gui/common/functions_page_session_status_commands.js" />
<script file="gui/common/functions_page_session_manual.js" />
<script file="gui/common/functions_sim_player.js"/>
<script file="gui/common/functions_sim_entity.js"/>
-->
<script file="gui/session_new/session.js"/>
<script file="gui/session_new/selection.js"/>
<script file="gui/session_new/input.js"/>
<object name="sn" hotkey="session.gui.toggle">
<action on="Load">
initSession();
</action>
<action on="SimulationUpdate">
onSimulationUpdate();
</action>
<action on="Press">
this.hidden = !this.hidden;
</action>
<!-- Exit hotkey -->
<object name="leave" hotkey="leave">
<action on="Press"><![CDATA[
messageBox(400, 200, "Do you really want to quit?", "Confirmation", 0,
["Yes", "No!"], [confirmLeave, null]);
]]></action>
</object>
<!-- Minimap -->
<object name="minimap">
<object name="minimapDisplay"
style="snObject"
type="minimap"
size="100%-138 100%-138 100%-6 100%-6"
/>
<object name="minimapBorder"
style="snMiniMapBorder"
type="image"
size="100%-172 100%-172 100% 100%"
/>
</object>
<!-- Debug text -->
<object name="debug" type="text" size="0 0 50% 100%" ghost="true" textcolor="yellow" font="console">[default debug text]</object>
</object>
</objects>

View File

@ -0,0 +1,31 @@
function GuiInterface() {}
GuiInterface.prototype.Init = function() {};
GuiInterface.prototype.GetSimulationState = function(player)
{
// print("GetSimulationState "+player+"\n");
return { test: "simulation state" };
};
GuiInterface.prototype.GetEntityState = function(player, ent)
{
// print("GetEntityState "+player+" "+ent+"\n");
var cmpPosition = Engine.QueryInterface(ent, IID_Position);
var ret = {
position: cmpPosition.GetPosition()
};
return ret;
};
GuiInterface.prototype.SetSelectionHighlight = function(ent, colour)
{
var cmpSelectable = Engine.QueryInterface(ent, IID_Selectable);
cmpSelectable.SetSelectionHighlight(colour);
};
Engine.RegisterComponentType(IID_GuiInterface, "GuiInterface", GuiInterface);

View File

@ -0,0 +1,32 @@
function MotionBallScripted() {}
MotionBallScripted.prototype.Init = function() {
this.speedX = 0;
this.speedZ = 0;
};
MotionBallScripted.prototype.OnUpdate = function(msg) {
var dt = msg.turnLength;
var cmpPos = Engine.QueryInterface(this.entity, IID_Position);
var cmpTerrain = Engine.QueryInterface(SYSTEM_ENTITY, IID_Terrain);
var pos = cmpPos.GetPosition();
var normal = cmpTerrain.CalcNormal(pos.x, pos.z);
var g = 10;
var forceX = normal.x * g;
var forceZ = normal.z * g;
this.speedX += forceX * dt;
this.speedZ += forceZ * dt;
var drag = 0.5; // fractional decay per second
this.speedX *= Math.pow(drag, dt);
this.speedZ *= Math.pow(drag, dt);
cmpPos.MoveTo(pos.x + this.speedX * dt, pos.z + this.speedZ * dt);
};
Engine.RegisterComponentType(IID_Motion, "MotionBallScripted", MotionBallScripted);

View File

@ -0,0 +1,38 @@
var g_ComponentTypes = {};
var g_Components = {};
// Emulate some engine functions:
Engine.RegisterComponentType = function(iid, name, ctor)
{
TS_ASSERT(!g_ComponentTypes[name]);
g_ComponentTypes[name] = { iid: iid, ctor: ctor };
}
Engine.QueryInterface = function(ent, iid)
{
if (g_Components[ent] && g_Components[ent][iid])
return g_Components[ent][iid];
return null;
}
// TODO:
// Engine.RegisterGlobal
// Engine.PostMessage
// Engine.BroadcastMessage
global.AddMock = function(ent, iid, mock)
{
if (!g_Components[ent])
g_Components[ent] = {};
g_Components[ent][iid] = mock;
}
global.ConstructComponent = function(ent, name, template)
{
var cmp = new g_ComponentTypes[name].ctor();
cmp.entity = ent;
cmp.template = template;
cmp.Init();
return cmp;
}

View File

@ -0,0 +1,14 @@
Engine.LoadComponentScript("GuiInterface.js");
var cmp = ConstructComponent(SYSTEM_ENTITY, "GuiInterface");
TS_ASSERT_UNEVAL_EQUALS(cmp.GetSimulationState(), { test: "simulation state" });
AddMock(10, IID_Position, {
GetPosition: function() {
return {x:1, y:2, z:3};
},
});
var state = cmp.GetEntityState(-1, 10);
TS_ASSERT_UNEVAL_EQUALS(state, { position: {x:1, y:2, z:3} });

View File

@ -0,0 +1,30 @@
function ProcessCommand(player, cmd)
{
// print("command: " + player + " " + uneval(cmd) + "\n");
switch (cmd.type)
{
case "spin":
for each (var ent in cmd.entities)
{
var pos = Engine.QueryInterface(ent, IID_Position);
if (! pos)
continue;
pos.SetYRotation(pos.GetRotation().y + 1);
}
break;
case "walk":
for each (var ent in cmd.entities)
{
var motion = Engine.QueryInterface(ent, IID_UnitMotion);
if (! motion)
continue;
motion.MoveToPoint(cmd.x, cmd.z);
}
break;
default:
print("Ignoring unrecognised command type '" + cmd.type + "'\n");
}
}
Engine.RegisterGlobal("ProcessCommand", ProcessCommand);

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_foundation">
<VisualActor>
<Actor>structures/fndn_1x1.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_foundation">
<VisualActor>
<Actor>structures/fndn_2x2.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_foundation">
<VisualActor>
<Actor>structures/fndn_3x3.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_foundation">
<VisualActor>
<Actor>structures/fndn_3x6.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_foundation">
<VisualActor>
<Actor>structures/fndn_4x4.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_foundation">
<VisualActor>
<Actor>structures/fndn_5x5.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_foundation">
<VisualActor>
<Actor>structures/fndn_6x6.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_foundation">
<VisualActor>
<Actor>structures/plot_field_found.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_foundation">
<VisualActor>
<Actor>structures/fndn_theatron.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_hunt_aggressive">
<VisualActor>
<Actor>fauna/bear.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_hunt_aggressive">
<VisualActor>
<Actor>fauna/boar.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_hunt_passive">
<VisualActor>
<Actor>fauna/chicken.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_hunt_skittish">
<VisualActor>
<Actor>fauna/deer.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_hunt_aggressive">
<VisualActor>
<Actor>fauna/elephant.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_hunt_aggressive">
<VisualActor>
<Actor>fauna/elephant_african_bush.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_hunt_aggressive">
<VisualActor>
<Actor>fauna/elephant_african_baby.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_hunt_aggressive">
<VisualActor>
<Actor>fauna/elephant_african_forest.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_hunt_skittish">
<VisualActor>
<Actor>fauna/gazelle.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_herd_passive">
<VisualActor>
<Actor>fauna/goat.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_wild_violent">
<VisualActor>
<Actor>fauna/lion.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_herd_passive">
<VisualActor>
<Actor>fauna/muskox.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_herd_passive">
<VisualActor>
<Actor>fauna/pig1.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_hunt_skittish">
<VisualActor>
<Actor>fauna/rabbit1.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_herd_passive">
<VisualActor>
<Actor>fauna/sheep1.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_wild_violent">
<VisualActor>
<Actor>fauna/tiger.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_hunt_defensive">
<VisualActor>
<Actor>fauna/walrus.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_wild_aggressive">
<VisualActor>
<Actor>fauna/wolf.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_wild_aggressive">
<VisualActor>
<Actor>fauna/wolf_snow.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_hunt_skittish">
<VisualActor>
<Actor>fauna/zebra.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_flora_bush_berry">
<VisualActor>
<Actor>props/flora/foliagebush.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_flora_tree">
<VisualActor>
<Actor>props/flora/bush_tempe_a.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_flora_tree">
<VisualActor>
<Actor>flora/trees/aleppo_pine.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_flora_tree">
<VisualActor>
<Actor>flora/trees/baobab.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_flora_tree">
<VisualActor>
<Actor>flora/trees/carob.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_flora_tree">
<VisualActor>
<Actor>flora/trees/palm_date.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_flora_tree">
<VisualActor>
<Actor>flora/trees/european_beech.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_flora_tree">
<VisualActor>
<Actor>flora/trees/palm_medit_fan_palm.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_flora_tree">
<VisualActor>
<Actor>flora/trees/oak.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_flora_tree">
<VisualActor>
<Actor>flora/trees/oak_large.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_flora_tree">
<VisualActor>
<Actor>flora/trees/pine.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_flora_tree">
<VisualActor>
<Actor>flora/trees/pine_w.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_flora_tree">
<VisualActor>
<Actor>flora/trees/poplar.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_flora_tree">
<VisualActor>
<Actor>flora/trees/lumbardypoplar.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_flora_tree">
<VisualActor>
<Actor>flora/trees/palm_senegal_date.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_geo_mineral">
<VisualActor>
<Actor>geology/metalmine_alpine.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_geo_mineral">
<VisualActor>
<Actor>geology/metalmine_desert_small.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_geo_mineral">
<VisualActor>
<Actor>geology/metalmine_granite_greek.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_geo_mineral">
<VisualActor>
<Actor>geology/metalmine_mediterranean.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_geo_mineral">
<VisualActor>
<Actor>geology/metalmine_granite_temperate.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_geo_mineral">
<VisualActor>
<Actor>geology/metalmine_tropic.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_geo_rock">
<VisualActor>
<Actor>geology/stonemine_alpine_a.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_geo_rock">
<VisualActor>
<Actor>geology/stonemine_desert_small.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_geo_rock">
<VisualActor>
<Actor>geology/stonemine_granite_greek.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_geo_rock">
<VisualActor>
<Actor>geology/light.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_geo_rock">
<VisualActor>
<Actor>geology/stonemine_mediterranean.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_geo_rock">
<VisualActor>
<Actor>geology/stonemine_savanna_small.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_geo_rock">
<VisualActor>
<Actor>geology/stonemine_granite.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_gaia_geo_rock">
<VisualActor>
<Actor>geology/stonemine_tropic.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_structure_gaia_settlement">
<VisualActor>
<Actor>structures/wrld_settlement_1.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_super_infantry">
<VisualActor>
<Actor>temp/mace_su1_hypaspist.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_structure_military_barracks">
<VisualActor>
<Actor>structures/celts/barracks.xml</Actor>
</VisualActor>
</Entity>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_structure_civic_civil_centre">
<VisualActor>
<Actor>structures/celts/civil_centre.xml</Actor>
</VisualActor>
</Entity>

Some files were not shown because too many files have changed in this diff Show More