1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
-- Humongous proxy class
-- Created by Tom J Nowell 2010
-- Shard AI
require "hooks"
require "class"
require "aibase"
if Spring ~= nil then
require "spring_lua/unit"
require "spring_lua/game"
require "spring_lua/map"
else
require "spring_native/unit"
require "spring_native/game"
require "spring_native/map"
end
function shard_include( file )
if type(file) ~= 'string' then
return nil
end
local ok, mod = pcall( require, game:GameName().."/"..file )
if ok then
return mod
else
require( file )
end
end
--}
--[[
{,
IUnit/ engine unit objects
int ID()
int Team()
std::string Name()
bool IsAlive()
bool IsCloaked()
void Forget() // makes the interface forget about this unit and cleanup
bool Forgotten() // for interface/debugging use
IUnitType* Type() -- not implemented, use game:GetTypeByName
bool CanMove()
bool CanDeploy()
bool CanBuild()
bool IsBeingBuilt()
bool CanAssistBuilding(IUnit* unit)
bool CanMoveWhenDeployed()
bool CanFireWhenDeployed()
bool CanBuildWhenDeployed()
bool CanBuildWhenNotDeployed()
void Stop()
void Move(Position p)
void MoveAndFire(Position p)
bool Build(IUnitType* t)
bool Build(std::string typeName)
bool Build(std::string typeName, Position p)
bool Build(IUnitType* t, Position p)
bool AreaReclaim(Position p, double radius)
bool Reclaim(IMapFeature* mapFeature)
bool Reclaim(IUnit* unit)
bool Attack(IUnit* unit)
bool Repair(IUnit* unit)
bool MorphInto(IUnitType* t)
Position GetPosition()
float GetHealth()
float GetMaxHealth()
int WeaponCount()
float MaxWeaponsRange()
bool CanBuild(IUnitType* t)
SResourceTransfer GetResourceUsage(int idx)
void ExecuteCustomCommand(int cmdId, std::vector<float> params_list, short options = 0, int timeOut = INT_MAX)
UnitType{
function Name() -- returns a string e.g. 'corcom'
function CanDeploy() -- returns boolean
function CanMoveWhenDeployed() -- returns boolean
function CanFireWhenDeployed() -- returns boolean
function CanBuildWhenDeployed() -- returns boolean
function CanBuildWhenNotDeployed() -- returns boolean
function Extractor() -- returns boolean
function GetMaxHealth() -- returns a float
function WeaponCount() -- returns integer
},
MapFeature {
function ID()
function Name()
function GetPosition()
},
Position {
x,y,z
},
}
return infos]]--
|