Outpost Universe Forums

Projects & Development => Outpost 2 Programming & Development => Topic started by: Eddy-B on May 01, 2005, 12:02:40 PM

Title: Added outpost functionality
Post by: Eddy-B on May 01, 2005, 12:02:40 PM
By now, you've probably all figured out i've implemented Hooman's findings -i should mention i did do a lot of work towards this, but i got Hooman to thank for helping me in the right direction- anyway: i've implemented those findings into a shared library: op2extra.zip (http://forum.outpostuniverse.net/index.php?act=Attach&type=post&id=32247). It includes a new Unit structure for use with the extended unit-functions, which i've dubbed IUnit (I as in "Internal", since it uses the internal OP2-unit structure, rather then the one exported). It is derived from the exported Unit class, and as so inherits ALL the Unit's members.
To add to this: it uses some of the hacks that we (Hooman and i) found to issue commandPackets right into the core of the outpost game engine. Some remarks about this are in place here:Added IUnit methods:
Code: [Select]
void Doze(MAP_RECT region);  // use with RoboDozer only
void Dock();       // to be used when a unit in on a docking pad
void DockGarage();     // to be used when a unit in on a docking pad of a garage
void Build(LOCATION location); // use when there's a kit inside a convec, or when this is a miner/geocon
void Produce(enum map_id itemToProduce,enum map_id weaponType);
void TransferCargo(short bay); // to be used when a unit in on a docking pad
void LoadCargo();      // to be used when a unit in on a docking pad
void UnloadCargo();     // to be used when a unit in on a docking pad
void DumpCargo();
void Research(short techID,short numScientists); // use only with labs
void TrainScientists(short numTrained);    // use only with university
void Salvage(MAP_RECT region,IUnit gorf);
void Poof();
void Repair(IUnit target);   // use with convec or repait vehicle
void Reprogram(IUnit target);  // use with spider only
void Dismantle(IUnit target);  // use with convec

command_type GetBusy();    // returns what this unit is doing (0=not busy)
void GetFactoryCargo(int bay, enum map_id &unitType, enum map_id &weaponType);
void GetCargo(map_id &cargoType,map_id &weaponType); // works for convecs
int GetTruckCargo(Truck_Cargo &cargoType);    // returns amount of cargo
int GetDamage();      // 0=no damage

bool IsInRect(MAP_RECT rect);  // returns true if the unit is in the rect

Some remarks:
There is a difference between Build and Produce: Build is to be used on a vehicle that can build something, like a convec, geocon or miner: you only supply the location where the new building has to be built. Produce can be used on buildings that produce either units or kits; eg. SF, VF, Aracnid F, Consumer F and SpacePort

TransferCargo hasn't been tested yet, so i honestly don't know if it should be used on the building or the vehicle. Either way: the unit MUST be already on the pad! Same goes for LoadCargo and UnloadCargo.

Poof() will make the unit exit the gamemap at the nearest exit point - the unit will first move to the side of the map, then "poof". Be advised, somehow, this will cause a graphics bug - the game doesnt repaint its DC after the unit poofs!

Repair/Reprogram/Dismantle all use the same internal structure - but i've included them seperately.

Then, i've added some other methods, that i've used before (succesfully i might add):Have fun !

Next addition to this library: events!!   YES - i WILL get it to work (MAJOR hack required though  :blush: )