mirror of
https://github.com/Ragora/T2-BoL.git
synced 2026-07-12 23:14:58 +00:00
Brought up to date with the newest T2BoL I've located
This commit is contained in:
parent
8c96cba3e1
commit
accd31895e
287 changed files with 108557 additions and 107608 deletions
|
|
@ -1,238 +1,238 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// A lil sumthin by Alviss
|
||||
// For C&C
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Execution
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// This clears the building index's in one swoop
|
||||
function BuildingManagerInit()
|
||||
{
|
||||
if (isObject(BuildingManager))
|
||||
BuildingManager.Delete();
|
||||
|
||||
new ScriptObject(BuildingManager) {};
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
exec("scripts/Importer/BuildingDatablocks.cs");
|
||||
exec("scripts/Importer/BuildingGroups.cs");
|
||||
exec("scripts/Importer/Buildings/ConstructionYard.cs");
|
||||
exec("scripts/Importer/Converter.cs");
|
||||
|
||||
// adding the buildings
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function exebuild()
|
||||
{
|
||||
exec("scripts/functionality/Building.cs");
|
||||
}
|
||||
|
||||
|
||||
function LoadCCBuilding(%client, %building, %center)
|
||||
{
|
||||
%team = %client.team;
|
||||
|
||||
// This is used to keep duplicate buildings from joining the same group
|
||||
// So, like, we don't have 3 group's named PowerPlant.
|
||||
// EDIT: I realize it wouldn't matter now, but i'm too lazy to remove all my work
|
||||
BuildingManager.BuildingInc[%building, %team]++;
|
||||
|
||||
switch$(%building)
|
||||
{
|
||||
case "ConYard":
|
||||
Build_ConstructionYard(%client, %center, %team);
|
||||
|
||||
case "PowerPlant":
|
||||
Build_PowerPlant(%client, %center, %team);
|
||||
|
||||
}
|
||||
|
||||
// set a timer to unify the building
|
||||
NametoId("MissionCleanup/Buildings"@%team@"/"@%building @ BuildingManager.BuildingInc[%building, %team]).Schedule(2000, "UnifyBuildings");
|
||||
// it uses a timer because none of the objects have the required parameters set yet, plus it's a good idea
|
||||
// to wait until all the pieces are loaded.
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// CCMod Package
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
package CCMod
|
||||
{
|
||||
//------------------------------------------
|
||||
// echos and logs the exec call
|
||||
function exec(%target)
|
||||
{
|
||||
// LogEvent(%target);
|
||||
|
||||
//error("Count : " @ DatablockGroup.getCount());
|
||||
|
||||
parent::exec(%target);
|
||||
}
|
||||
|
||||
//------------------------------------------
|
||||
// So you don't get a lame red spam wall in the console.
|
||||
function setTargetSensorGroup(%target, %team)
|
||||
{
|
||||
if (%target <= 0)
|
||||
return;
|
||||
|
||||
parent::setTargetSensorGroup(%target, %team);
|
||||
}
|
||||
|
||||
//------------------------------------------
|
||||
// So you don't get a lame red spam wall in the console.
|
||||
function setTargetName(%target, %name)
|
||||
{
|
||||
if (%target <= 0)
|
||||
return;
|
||||
|
||||
parent::setTargetName(%target, %name);
|
||||
}
|
||||
//------------------------------------------
|
||||
// to capture the MCV when it deploys
|
||||
function StaticShapeData::OnAdd(%data, %obj)
|
||||
{
|
||||
// it's a building piece.
|
||||
if (StrStr(%data.GetName(), "BuildingBlock") != -1)
|
||||
{
|
||||
if (%obj.TheFloor && %obj.type $= "ConYard")
|
||||
{
|
||||
$CCGame::MCV[%obj.team] = %obj;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Parent::OnAdd(%data, %obj);
|
||||
}
|
||||
|
||||
//------------------------------------------
|
||||
// door functions
|
||||
function StaticShapeData::OnCollision(%data, %obj)
|
||||
{
|
||||
// DoorCode
|
||||
if (%obj.IsDoor)
|
||||
{
|
||||
%obj.ClosePosition = %obj.GetPosition();
|
||||
%obj.SetPosition("0 0 -100");
|
||||
|
||||
schedule(2000, 0, "eval", %obj@".SetPosition("@%obj@".ClosePosition);");
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------
|
||||
// captures incoming damage
|
||||
function StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType)
|
||||
{
|
||||
// it's a building piece.
|
||||
if (StrStr(%data.GetName(), "BuildingBlock") != -1)
|
||||
GrabBaseDamageCall(%data, %targetObject, %sourceObject, %position, %amount, %damageType);
|
||||
else
|
||||
parent::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType);
|
||||
}
|
||||
|
||||
//------------------------------------------
|
||||
// captures incoming destroyed call
|
||||
function StaticShapeData::onDestroyed(%this,%obj,%prevState)
|
||||
{
|
||||
$BuildingCount[%obj.type, %obj.team]--;
|
||||
$Power[%obj.team] -= $Power[%obj.team];
|
||||
CheckPowerGoodLevel(%obj.team);
|
||||
|
||||
// $TeamDeployedCount[%obj.team, AdvGuardTurretBasePack]--;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
if (!isActivePackage(CCMod))
|
||||
ActivatePackage(CCMod);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Support Functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function addToBuildingGroup(%object)
|
||||
{
|
||||
%TeamGroup = nameToID("Buildings"@%object.team);
|
||||
|
||||
if (%TeamGroup <= 0)
|
||||
{
|
||||
%TeamGroup = new SimGroup("Buildings"@%object.team);
|
||||
MissionCleanup.add(%TeamGroup);
|
||||
}
|
||||
|
||||
%index = BuildingManager.BuildingInc[%object.Type, %object.team];
|
||||
|
||||
%BuildingsGroup = nameToID("Buildings"@%object.team@"/"@%object.Type @ %index);
|
||||
|
||||
if ($CCTypeToName[%object.Type, %object.team] !$= %object.Type)
|
||||
{
|
||||
setTargetName(%object.target,addTaggedString($CCTypeToName[%object.Type, %object.team]));
|
||||
}
|
||||
|
||||
if (%BuildingsGroup <= 0)
|
||||
{
|
||||
%BuildingsGroup = new SimGroup(%object.Type @ %index);
|
||||
%TeamGroup.add(%BuildingsGroup);
|
||||
}
|
||||
|
||||
%BuildingsGroup.Index = %index;
|
||||
|
||||
%BuildingsGroup.add(%object);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function ShapeBase::SightObject(%player, %range)
|
||||
{
|
||||
if (%range $= "")
|
||||
%range = 100;
|
||||
|
||||
%pos = %player.getEyePoint();
|
||||
%vec = %player.getEyeVector();
|
||||
|
||||
%targetpos = vectoradd(%pos, vectorscale(%vec, %range));
|
||||
%ray = containerraycast(%pos, %targetpos, $typemasks::StaticShapeObjectType, %player);
|
||||
|
||||
return getword(%ray, 0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function ShapeBase::SightPos(%player, %range)
|
||||
{
|
||||
if (%range $= "")
|
||||
%range = 100;
|
||||
|
||||
%pos = %player.getEyePoint();
|
||||
%vec = %player.getEyeVector();
|
||||
|
||||
%targetpos = vectoradd(%pos, vectorscale(%vec, %range));
|
||||
%ray = containerraycast(%pos, %targetpos, $typemasks::StaticShapeObjectType | $typemasks::TerrainObjectType, %player);
|
||||
|
||||
return getwords(%ray, 1,3);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function ShapeBase::getEyePoint(%player)
|
||||
{
|
||||
%eyePt = getWords(%player.getEyeTransform(), 0, 2);
|
||||
return %eyePt;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function SimObject::setPosition(%obj, %pos)
|
||||
{
|
||||
%rot = getWords(%obj.getTransform(), 3, 6);
|
||||
%trans = %pos@" "@%rot;
|
||||
%obj.setTransform(%trans);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// A lil sumthin by Alviss
|
||||
// For C&C
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Execution
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// This clears the building index's in one swoop
|
||||
function BuildingManagerInit()
|
||||
{
|
||||
if (isObject(BuildingManager))
|
||||
BuildingManager.Delete();
|
||||
|
||||
new ScriptObject(BuildingManager) {};
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
exec("scripts/Importer/BuildingDatablocks.cs");
|
||||
exec("scripts/Importer/BuildingGroups.cs");
|
||||
exec("scripts/Importer/Buildings/ConstructionYard.cs");
|
||||
exec("scripts/Importer/Converter.cs");
|
||||
|
||||
// adding the buildings
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function exebuild()
|
||||
{
|
||||
exec("scripts/functionality/Building.cs");
|
||||
}
|
||||
|
||||
|
||||
function LoadCCBuilding(%client, %building, %center)
|
||||
{
|
||||
%team = %client.team;
|
||||
|
||||
// This is used to keep duplicate buildings from joining the same group
|
||||
// So, like, we don't have 3 group's named PowerPlant.
|
||||
// EDIT: I realize it wouldn't matter now, but i'm too lazy to remove all my work
|
||||
BuildingManager.BuildingInc[%building, %team]++;
|
||||
|
||||
switch$(%building)
|
||||
{
|
||||
case "ConYard":
|
||||
Build_ConstructionYard(%client, %center, %team);
|
||||
|
||||
case "PowerPlant":
|
||||
Build_PowerPlant(%client, %center, %team);
|
||||
|
||||
}
|
||||
|
||||
// set a timer to unify the building
|
||||
NametoId("MissionCleanup/Buildings"@%team@"/"@%building @ BuildingManager.BuildingInc[%building, %team]).Schedule(2000, "UnifyBuildings");
|
||||
// it uses a timer because none of the objects have the required parameters set yet, plus it's a good idea
|
||||
// to wait until all the pieces are loaded.
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// CCMod Package
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
package CCMod
|
||||
{
|
||||
//------------------------------------------
|
||||
// echos and logs the exec call
|
||||
function exec(%target)
|
||||
{
|
||||
// LogEvent(%target);
|
||||
|
||||
//error("Count : " @ DatablockGroup.getCount());
|
||||
|
||||
parent::exec(%target);
|
||||
}
|
||||
|
||||
//------------------------------------------
|
||||
// So you don't get a lame red spam wall in the console.
|
||||
function setTargetSensorGroup(%target, %team)
|
||||
{
|
||||
if (%target <= 0)
|
||||
return;
|
||||
|
||||
parent::setTargetSensorGroup(%target, %team);
|
||||
}
|
||||
|
||||
//------------------------------------------
|
||||
// So you don't get a lame red spam wall in the console.
|
||||
function setTargetName(%target, %name)
|
||||
{
|
||||
if (%target <= 0)
|
||||
return;
|
||||
|
||||
parent::setTargetName(%target, %name);
|
||||
}
|
||||
//------------------------------------------
|
||||
// to capture the MCV when it deploys
|
||||
function StaticShapeData::OnAdd(%data, %obj)
|
||||
{
|
||||
// it's a building piece.
|
||||
if (StrStr(%data.GetName(), "BuildingBlock") != -1)
|
||||
{
|
||||
if (%obj.TheFloor && %obj.type $= "ConYard")
|
||||
{
|
||||
$CCGame::MCV[%obj.team] = %obj;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Parent::OnAdd(%data, %obj);
|
||||
}
|
||||
|
||||
//------------------------------------------
|
||||
// door functions
|
||||
function StaticShapeData::OnCollision(%data, %obj)
|
||||
{
|
||||
// DoorCode
|
||||
if (%obj.IsDoor)
|
||||
{
|
||||
%obj.ClosePosition = %obj.GetPosition();
|
||||
%obj.SetPosition("0 0 -100");
|
||||
|
||||
schedule(2000, 0, "eval", %obj@".SetPosition("@%obj@".ClosePosition);");
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------
|
||||
// captures incoming damage
|
||||
function StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType)
|
||||
{
|
||||
// it's a building piece.
|
||||
if (StrStr(%data.GetName(), "BuildingBlock") != -1)
|
||||
GrabBaseDamageCall(%data, %targetObject, %sourceObject, %position, %amount, %damageType);
|
||||
else
|
||||
parent::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType);
|
||||
}
|
||||
|
||||
//------------------------------------------
|
||||
// captures incoming destroyed call
|
||||
function StaticShapeData::onDestroyed(%this,%obj,%prevState)
|
||||
{
|
||||
$BuildingCount[%obj.type, %obj.team]--;
|
||||
$Power[%obj.team] -= $Power[%obj.team];
|
||||
CheckPowerGoodLevel(%obj.team);
|
||||
|
||||
// $TeamDeployedCount[%obj.team, AdvGuardTurretBasePack]--;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
if (!isActivePackage(CCMod))
|
||||
ActivatePackage(CCMod);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Support Functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function addToBuildingGroup(%object)
|
||||
{
|
||||
%TeamGroup = nameToID("Buildings"@%object.team);
|
||||
|
||||
if (%TeamGroup <= 0)
|
||||
{
|
||||
%TeamGroup = new SimGroup("Buildings"@%object.team);
|
||||
MissionCleanup.add(%TeamGroup);
|
||||
}
|
||||
|
||||
%index = BuildingManager.BuildingInc[%object.Type, %object.team];
|
||||
|
||||
%BuildingsGroup = nameToID("Buildings"@%object.team@"/"@%object.Type @ %index);
|
||||
|
||||
if ($CCTypeToName[%object.Type, %object.team] !$= %object.Type)
|
||||
{
|
||||
setTargetName(%object.target,addTaggedString($CCTypeToName[%object.Type, %object.team]));
|
||||
}
|
||||
|
||||
if (%BuildingsGroup <= 0)
|
||||
{
|
||||
%BuildingsGroup = new SimGroup(%object.Type @ %index);
|
||||
%TeamGroup.add(%BuildingsGroup);
|
||||
}
|
||||
|
||||
%BuildingsGroup.Index = %index;
|
||||
|
||||
%BuildingsGroup.add(%object);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function ShapeBase::SightObject(%player, %range)
|
||||
{
|
||||
if (%range $= "")
|
||||
%range = 100;
|
||||
|
||||
%pos = %player.getEyePoint();
|
||||
%vec = %player.getEyeVector();
|
||||
|
||||
%targetpos = vectoradd(%pos, vectorscale(%vec, %range));
|
||||
%ray = containerraycast(%pos, %targetpos, $typemasks::StaticShapeObjectType, %player);
|
||||
|
||||
return getword(%ray, 0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function ShapeBase::SightPos(%player, %range)
|
||||
{
|
||||
if (%range $= "")
|
||||
%range = 100;
|
||||
|
||||
%pos = %player.getEyePoint();
|
||||
%vec = %player.getEyeVector();
|
||||
|
||||
%targetpos = vectoradd(%pos, vectorscale(%vec, %range));
|
||||
%ray = containerraycast(%pos, %targetpos, $typemasks::StaticShapeObjectType | $typemasks::TerrainObjectType, %player);
|
||||
|
||||
return getwords(%ray, 1,3);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function ShapeBase::getEyePoint(%player)
|
||||
{
|
||||
%eyePt = getWords(%player.getEyeTransform(), 0, 2);
|
||||
return %eyePt;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function SimObject::setPosition(%obj, %pos)
|
||||
{
|
||||
%rot = getWords(%obj.getTransform(), 3, 6);
|
||||
%trans = %pos@" "@%rot;
|
||||
%obj.setTransform(%trans);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,133 +1,133 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// A lil sumthin by Alviss
|
||||
|
||||
// Datablock script with all the building datablocks.
|
||||
//------------------------------------------------------------------------------
|
||||
// Datablock
|
||||
//------------------------------------------------------------------------------
|
||||
datablock StaticShapeData(BuildingBlock0) : StaticShapeDamageProfile
|
||||
{
|
||||
className = "BuildingPiece";
|
||||
shapeFile = "Pmiscf.dts";
|
||||
|
||||
maxDamage = 20;
|
||||
destroyedLevel = 20;
|
||||
disabledLevel = 19;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 240;
|
||||
maxEnergy = 50;
|
||||
rechargeRate = 0.25;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 3.0;
|
||||
expDamage = 0.1;
|
||||
expImpulse = 200.0;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Building Piece';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needsPower = false;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(BuildingBlock1) : BuildingBlock0
|
||||
{
|
||||
shapeFile = "smiscf.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(BuildingBlock2) : BuildingBlock0
|
||||
{
|
||||
shapeFile = "stackable2l.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(BuildingBlock3) : BuildingBlock0
|
||||
{
|
||||
shapeFile = "stackable2m.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(BuildingBlock4) : BuildingBlock0
|
||||
{
|
||||
shapeFile = "stackable3l.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(BuildingBlock5) : BuildingBlock0
|
||||
{
|
||||
shapeFile = "stackable4m.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(BuildingBlock6) : BuildingBlock0
|
||||
{
|
||||
shapeFile = "Xmiscf.dts";
|
||||
};
|
||||
|
||||
//--------------------
|
||||
// Hack to turn item names into the Type names
|
||||
// We won't need them once all the buildings are converted.
|
||||
//
|
||||
|
||||
// Words like, Deployable, BasePack, Turret
|
||||
// are all removed from the item name, and then referenced the this table.
|
||||
|
||||
//$CCItemToType[PowerPlant] = "PowerPlant";
|
||||
//$CCItemToType[Barracks] = "Barracks";
|
||||
//$CCItemToType[TiberiumRefinery] = "Tiberium";
|
||||
//$CCItemToType[CommCenter] = "CommCenter";
|
||||
//$CCItemToType[GTower] = "GuardTower";
|
||||
//$CCItemToType[WeaponsFactory] = "WarFact";
|
||||
//$CCItemToType[GunTurret] = "Gun"; // < lol
|
||||
//$CCItemToType[NPA] = "LaserBatt";
|
||||
//$CCItemToType[AdvPowerPlant] = "AdvPowerPlant";
|
||||
//$CCItemToType[EnrichGenerator] = "Enrich";
|
||||
//$CCItemToType[AdvGuard] = "AdvGuard";
|
||||
//$CCItemToType[AABat] = "AABat";
|
||||
//$CCItemToType[IonControl] = "IonControl";
|
||||
//$CCItemToType[Obelisk] = "Obelisk";
|
||||
//$CCItemToType[SAM] = "SAMSite";
|
||||
//$CCItemToType[TempOfNod] = "TempleOfNod";
|
||||
//$CCItemToType[PEC] = "ParticleEC";
|
||||
|
||||
$CCItemToType[PowerPlantDeployable] = "PowerPlant";
|
||||
$CCItemToType[BarracksDeployable] = "Barracks";
|
||||
$CCItemToType[TiberiumRefinery] = "Tiberium";
|
||||
$CCItemToType[CommCenterDeployable] = "CommCenter";
|
||||
$CCItemToType[GTowerTurretBasePack] = "GuardTower";
|
||||
$CCItemToType[WeaponsFactoryDeployable] = "WarFact";
|
||||
$CCItemToType[TurretBasePack] = "Gun"; // < lol
|
||||
$CCItemToType[NPATurretBasePack] = "LaserBatt";
|
||||
$CCItemToType[AdvPowerPlantDeployable] = "AdvPowerPlant";
|
||||
$CCItemToType[EnrichGeneratorDeployable] = "Enrich";
|
||||
$CCItemToType[AdvGuardTurretBasePack] = "AdvGuard";
|
||||
$CCItemToType[AABatTurretBasePack] = "AABat";
|
||||
$CCItemToType[IonControlDeployable] = "IonControl";
|
||||
$CCItemToType[ObeliskTurretBasePack] = "Obelisk";
|
||||
$CCItemToType[SAMTurretBasePack] = "SAMSite";
|
||||
$CCItemToType[TempleOfNod] = "TempleOfNod";
|
||||
$CCItemToType[PECTurretBasePack] = "ParticleEC";
|
||||
|
||||
$CCTypeToItem[PowerPlant] = "PowerPlantDeployable";
|
||||
$CCTypeToItem[Barracks] = "BarracksDeployable";
|
||||
$CCTypeToItem[Tiberium] = "TiberiumRefineryDeployable";
|
||||
$CCTypeToItem[CommCenter] = "CommCenterDeployable";
|
||||
$CCTypeToItem[GuardTower] = "GTowerTurretBasePack";
|
||||
$CCTypeToItem[WarFact] = "WeaponsFactoryDeployable";
|
||||
$CCTypeToItem[Gun] = "TurretBasePack"; // < lol
|
||||
$CCTypeToItem[LaserBatt] = "NPATurretBasePack";
|
||||
$CCTypeToItem[AdvPowerPlant] = "AdvPowerPlantDeployable";
|
||||
$CCTypeToItem[Enrich] = "EnrichGeneratorDeployable";
|
||||
$CCTypeToItem[AdvGuard] = "AdvGuardTurretBasePack";
|
||||
$CCTypeToItem[AABat] = "AABatTurretBasePack";
|
||||
$CCTypeToItem[IonControl] = "IonControlDeployable";
|
||||
$CCTypeToItem[Obelisk] = "ObeliskTurretBasePack";
|
||||
$CCTypeToItem[SAMSite] = "SAMTurretBasePack";
|
||||
$CCTypeToItem[TempOfNod] = "TempleOfNod";
|
||||
$CCTypeToItem[ParticleEC] = "PECTurretBasePack";
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// A lil sumthin by Alviss
|
||||
|
||||
// Datablock script with all the building datablocks.
|
||||
//------------------------------------------------------------------------------
|
||||
// Datablock
|
||||
//------------------------------------------------------------------------------
|
||||
datablock StaticShapeData(BuildingBlock0) : StaticShapeDamageProfile
|
||||
{
|
||||
className = "BuildingPiece";
|
||||
shapeFile = "Pmiscf.dts";
|
||||
|
||||
maxDamage = 20;
|
||||
destroyedLevel = 20;
|
||||
disabledLevel = 19;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 240;
|
||||
maxEnergy = 50;
|
||||
rechargeRate = 0.25;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 3.0;
|
||||
expDamage = 0.1;
|
||||
expImpulse = 200.0;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Building Piece';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needsPower = false;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(BuildingBlock1) : BuildingBlock0
|
||||
{
|
||||
shapeFile = "smiscf.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(BuildingBlock2) : BuildingBlock0
|
||||
{
|
||||
shapeFile = "stackable2l.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(BuildingBlock3) : BuildingBlock0
|
||||
{
|
||||
shapeFile = "stackable2m.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(BuildingBlock4) : BuildingBlock0
|
||||
{
|
||||
shapeFile = "stackable3l.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(BuildingBlock5) : BuildingBlock0
|
||||
{
|
||||
shapeFile = "stackable4m.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(BuildingBlock6) : BuildingBlock0
|
||||
{
|
||||
shapeFile = "Xmiscf.dts";
|
||||
};
|
||||
|
||||
//--------------------
|
||||
// Hack to turn item names into the Type names
|
||||
// We won't need them once all the buildings are converted.
|
||||
//
|
||||
|
||||
// Words like, Deployable, BasePack, Turret
|
||||
// are all removed from the item name, and then referenced the this table.
|
||||
|
||||
//$CCItemToType[PowerPlant] = "PowerPlant";
|
||||
//$CCItemToType[Barracks] = "Barracks";
|
||||
//$CCItemToType[TiberiumRefinery] = "Tiberium";
|
||||
//$CCItemToType[CommCenter] = "CommCenter";
|
||||
//$CCItemToType[GTower] = "GuardTower";
|
||||
//$CCItemToType[WeaponsFactory] = "WarFact";
|
||||
//$CCItemToType[GunTurret] = "Gun"; // < lol
|
||||
//$CCItemToType[NPA] = "LaserBatt";
|
||||
//$CCItemToType[AdvPowerPlant] = "AdvPowerPlant";
|
||||
//$CCItemToType[EnrichGenerator] = "Enrich";
|
||||
//$CCItemToType[AdvGuard] = "AdvGuard";
|
||||
//$CCItemToType[AABat] = "AABat";
|
||||
//$CCItemToType[IonControl] = "IonControl";
|
||||
//$CCItemToType[Obelisk] = "Obelisk";
|
||||
//$CCItemToType[SAM] = "SAMSite";
|
||||
//$CCItemToType[TempOfNod] = "TempleOfNod";
|
||||
//$CCItemToType[PEC] = "ParticleEC";
|
||||
|
||||
$CCItemToType[PowerPlantDeployable] = "PowerPlant";
|
||||
$CCItemToType[BarracksDeployable] = "Barracks";
|
||||
$CCItemToType[TiberiumRefinery] = "Tiberium";
|
||||
$CCItemToType[CommCenterDeployable] = "CommCenter";
|
||||
$CCItemToType[GTowerTurretBasePack] = "GuardTower";
|
||||
$CCItemToType[WeaponsFactoryDeployable] = "WarFact";
|
||||
$CCItemToType[TurretBasePack] = "Gun"; // < lol
|
||||
$CCItemToType[NPATurretBasePack] = "LaserBatt";
|
||||
$CCItemToType[AdvPowerPlantDeployable] = "AdvPowerPlant";
|
||||
$CCItemToType[EnrichGeneratorDeployable] = "Enrich";
|
||||
$CCItemToType[AdvGuardTurretBasePack] = "AdvGuard";
|
||||
$CCItemToType[AABatTurretBasePack] = "AABat";
|
||||
$CCItemToType[IonControlDeployable] = "IonControl";
|
||||
$CCItemToType[ObeliskTurretBasePack] = "Obelisk";
|
||||
$CCItemToType[SAMTurretBasePack] = "SAMSite";
|
||||
$CCItemToType[TempleOfNod] = "TempleOfNod";
|
||||
$CCItemToType[PECTurretBasePack] = "ParticleEC";
|
||||
|
||||
$CCTypeToItem[PowerPlant] = "PowerPlantDeployable";
|
||||
$CCTypeToItem[Barracks] = "BarracksDeployable";
|
||||
$CCTypeToItem[Tiberium] = "TiberiumRefineryDeployable";
|
||||
$CCTypeToItem[CommCenter] = "CommCenterDeployable";
|
||||
$CCTypeToItem[GuardTower] = "GTowerTurretBasePack";
|
||||
$CCTypeToItem[WarFact] = "WeaponsFactoryDeployable";
|
||||
$CCTypeToItem[Gun] = "TurretBasePack"; // < lol
|
||||
$CCTypeToItem[LaserBatt] = "NPATurretBasePack";
|
||||
$CCTypeToItem[AdvPowerPlant] = "AdvPowerPlantDeployable";
|
||||
$CCTypeToItem[Enrich] = "EnrichGeneratorDeployable";
|
||||
$CCTypeToItem[AdvGuard] = "AdvGuardTurretBasePack";
|
||||
$CCTypeToItem[AABat] = "AABatTurretBasePack";
|
||||
$CCTypeToItem[IonControl] = "IonControlDeployable";
|
||||
$CCTypeToItem[Obelisk] = "ObeliskTurretBasePack";
|
||||
$CCTypeToItem[SAMSite] = "SAMTurretBasePack";
|
||||
$CCTypeToItem[TempOfNod] = "TempleOfNod";
|
||||
$CCTypeToItem[ParticleEC] = "PECTurretBasePack";
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,153 +1,153 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// A lil sumthin by Alviss
|
||||
// For C&C
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
$CCBuildingHealth["ConYard"] = 750;
|
||||
$CCBuildingHealth["PowerPlant"] = 250;
|
||||
$CCBuildingHealth["AdvPowerPlant"] = 500;
|
||||
$CCBuildingHealth["Barracks"] = 300;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// SimGroup Functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function SimGroup::UnifyBuildings(%group)
|
||||
{
|
||||
// get the max health, have to remove the Index suffix
|
||||
%group.MaxHp = $CCBuildingHealth[ StrReplace(%group.getName(), %group.Index, "") ];
|
||||
|
||||
// give all the pieces the nameplate of the building
|
||||
for (%i = 0; %i < %group.GetCount(); %i++)
|
||||
{
|
||||
%obj = %group.GetObject(%i);
|
||||
|
||||
if (%obj.GetTarget() == -1)
|
||||
{
|
||||
// best function i've ever learned. :)
|
||||
%target = CreateTarget(%obj, "", "", "", "", %obj.team, "");
|
||||
%obj.SetTarget(%target);
|
||||
}
|
||||
|
||||
%name = $CCTypeToName[%obj.Type, %obj.Team];
|
||||
|
||||
setTargetName(%obj.getTarget(), AddTaggedString(%name));
|
||||
}
|
||||
|
||||
// let all the pieces know the change.
|
||||
%group.SetHealth(%group.MaxHp);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function SimGroup::SetHealth(%group, %Hp)
|
||||
{
|
||||
%group.Hp = %hp;
|
||||
|
||||
if (%hp <= 0)
|
||||
{
|
||||
%group.DestroyBuilding();
|
||||
return;
|
||||
}
|
||||
|
||||
%percent = %hp / %group.MaxHp;
|
||||
|
||||
echo(%percent);
|
||||
for (%i = 0; %i < %group.GetCount(); %i++)
|
||||
{
|
||||
%obj = %group.GetObject(%i);
|
||||
|
||||
%max = %obj.getDatablock().maxDamage;
|
||||
|
||||
%obj.SetDamageLevel( %max - (%percent * %max) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function SimGroup::DestroyBuilding(%group)
|
||||
{
|
||||
%type = StrReplace(%group.getName(), %group.Index, "");
|
||||
|
||||
for (%i = 0; %i < %group.GetCount(); %i++)
|
||||
{
|
||||
%obj = %group.GetObject(%i);
|
||||
%team = %obj.team;
|
||||
|
||||
// set the health to zero, so it explodes
|
||||
%obj.SetDamageLevel( 0 );
|
||||
schedule(1000, 0, Killit, %obj);
|
||||
}
|
||||
|
||||
$BuildingCount[%type, %team]--;
|
||||
|
||||
if (%type $= "ConYard")
|
||||
{
|
||||
Game.gameOver();
|
||||
CycleMissions();
|
||||
}
|
||||
|
||||
if (%type $= "PowerPlant")
|
||||
{
|
||||
$TeamDeployedCount[%team, $CCTypeToItem[%type]]--;
|
||||
$Power[%team] -= 250;
|
||||
CheckPowerLowLevel(%team);
|
||||
}
|
||||
if (%type $= "AdvPowerPlant")
|
||||
{
|
||||
$TeamDeployedCount[%team, $CCTypeToItem[%type]]--;
|
||||
$Power[%team] -= 500;
|
||||
CheckPowerLowLevel(%team);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// SimObject Functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// This function intercepts incoming damage calls and subtracts the dmg from the building MaxHp
|
||||
function GrabBaseDamageCall(%data, %targetObject, %sourceObject, %position, %amount, %damageType)
|
||||
{
|
||||
if (!$TeamDamage)
|
||||
{
|
||||
if (isObject(%sourceObject))
|
||||
{
|
||||
//see if the object is being shot by a friendly
|
||||
if(%sourceObject.getDataBlock().catagory $= "Vehicles")
|
||||
%attackerTeam = getVehicleAttackerTeam(%sourceObject);
|
||||
else
|
||||
%attackerTeam = %sourceObject.team;
|
||||
}
|
||||
|
||||
if (%attackerTeam == %targetObject.team)
|
||||
return;
|
||||
}
|
||||
|
||||
%damageScale = %data.damageScale[%damageType];
|
||||
if (%damageScale !$= "")
|
||||
%amount *= %damageScale;
|
||||
|
||||
if (%targetObject.getTarget() != -1)
|
||||
{
|
||||
%building = %targetObject.getGroup();
|
||||
|
||||
if (isObject(%building))
|
||||
{
|
||||
%building.SetHealth(%building.HP - %amount);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// A lil sumthin by Alviss
|
||||
// For C&C
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
$CCBuildingHealth["ConYard"] = 750;
|
||||
$CCBuildingHealth["PowerPlant"] = 250;
|
||||
$CCBuildingHealth["AdvPowerPlant"] = 500;
|
||||
$CCBuildingHealth["Barracks"] = 300;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// SimGroup Functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function SimGroup::UnifyBuildings(%group)
|
||||
{
|
||||
// get the max health, have to remove the Index suffix
|
||||
%group.MaxHp = $CCBuildingHealth[ StrReplace(%group.getName(), %group.Index, "") ];
|
||||
|
||||
// give all the pieces the nameplate of the building
|
||||
for (%i = 0; %i < %group.GetCount(); %i++)
|
||||
{
|
||||
%obj = %group.GetObject(%i);
|
||||
|
||||
if (%obj.GetTarget() == -1)
|
||||
{
|
||||
// best function i've ever learned. :)
|
||||
%target = CreateTarget(%obj, "", "", "", "", %obj.team, "");
|
||||
%obj.SetTarget(%target);
|
||||
}
|
||||
|
||||
%name = $CCTypeToName[%obj.Type, %obj.Team];
|
||||
|
||||
setTargetName(%obj.getTarget(), AddTaggedString(%name));
|
||||
}
|
||||
|
||||
// let all the pieces know the change.
|
||||
%group.SetHealth(%group.MaxHp);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function SimGroup::SetHealth(%group, %Hp)
|
||||
{
|
||||
%group.Hp = %hp;
|
||||
|
||||
if (%hp <= 0)
|
||||
{
|
||||
%group.DestroyBuilding();
|
||||
return;
|
||||
}
|
||||
|
||||
%percent = %hp / %group.MaxHp;
|
||||
|
||||
echo(%percent);
|
||||
for (%i = 0; %i < %group.GetCount(); %i++)
|
||||
{
|
||||
%obj = %group.GetObject(%i);
|
||||
|
||||
%max = %obj.getDatablock().maxDamage;
|
||||
|
||||
%obj.SetDamageLevel( %max - (%percent * %max) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function SimGroup::DestroyBuilding(%group)
|
||||
{
|
||||
%type = StrReplace(%group.getName(), %group.Index, "");
|
||||
|
||||
for (%i = 0; %i < %group.GetCount(); %i++)
|
||||
{
|
||||
%obj = %group.GetObject(%i);
|
||||
%team = %obj.team;
|
||||
|
||||
// set the health to zero, so it explodes
|
||||
%obj.SetDamageLevel( 0 );
|
||||
schedule(1000, 0, Killit, %obj);
|
||||
}
|
||||
|
||||
$BuildingCount[%type, %team]--;
|
||||
|
||||
if (%type $= "ConYard")
|
||||
{
|
||||
Game.gameOver();
|
||||
CycleMissions();
|
||||
}
|
||||
|
||||
if (%type $= "PowerPlant")
|
||||
{
|
||||
$TeamDeployedCount[%team, $CCTypeToItem[%type]]--;
|
||||
$Power[%team] -= 250;
|
||||
CheckPowerLowLevel(%team);
|
||||
}
|
||||
if (%type $= "AdvPowerPlant")
|
||||
{
|
||||
$TeamDeployedCount[%team, $CCTypeToItem[%type]]--;
|
||||
$Power[%team] -= 500;
|
||||
CheckPowerLowLevel(%team);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// SimObject Functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// This function intercepts incoming damage calls and subtracts the dmg from the building MaxHp
|
||||
function GrabBaseDamageCall(%data, %targetObject, %sourceObject, %position, %amount, %damageType)
|
||||
{
|
||||
if (!$TeamDamage)
|
||||
{
|
||||
if (isObject(%sourceObject))
|
||||
{
|
||||
//see if the object is being shot by a friendly
|
||||
if(%sourceObject.getDataBlock().catagory $= "Vehicles")
|
||||
%attackerTeam = getVehicleAttackerTeam(%sourceObject);
|
||||
else
|
||||
%attackerTeam = %sourceObject.team;
|
||||
}
|
||||
|
||||
if (%attackerTeam == %targetObject.team)
|
||||
return;
|
||||
}
|
||||
|
||||
%damageScale = %data.damageScale[%damageType];
|
||||
if (%damageScale !$= "")
|
||||
%amount *= %damageScale;
|
||||
|
||||
if (%targetObject.getTarget() != -1)
|
||||
{
|
||||
%building = %targetObject.getGroup();
|
||||
|
||||
if (isObject(%building))
|
||||
{
|
||||
%building.SetHealth(%building.HP - %amount);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,133 +1,133 @@
|
|||
//------------------------------
|
||||
// Construction Mod save file to C&C Building file converter script.
|
||||
// A lil sumthin by Alviss
|
||||
// 24/06/09
|
||||
//------------------------------
|
||||
|
||||
function ccConvertSave(%sender,%args)
|
||||
{
|
||||
// %name = "Conv_test";
|
||||
//%Fullname = "Convertion_test";
|
||||
|
||||
%name = GetWord(%args, 0);
|
||||
%fullname = GetWords(%args, 1);
|
||||
|
||||
%obj = %sender.player.SightObject(100);
|
||||
|
||||
// this is our flag to set as the bottom-most piece
|
||||
%obj.TheFloor = 1;
|
||||
|
||||
ConvertSave(%sender, %name, %Fullname, %obj);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------
|
||||
// function to convert all the pieces in a server into a new save format
|
||||
function ConvertSave(%client, %name, %Fullname, %floor)
|
||||
{
|
||||
// %floor is the bottom-msot piece
|
||||
|
||||
%start = %floor.getPosition();
|
||||
%tHeight = getTerrainHeight(%start);
|
||||
%start = GetWords(%start, 0, 1) SPC 0;
|
||||
|
||||
%nf = new fileobject() {};
|
||||
%nf.OpenforWrite(%Fullname@".cs");
|
||||
|
||||
%nf.WriteLine("//------------------------------------------------------------------------------");
|
||||
%nf.WriteLine("// Saved By "@%client.namebase);
|
||||
%nf.WriteLine("");
|
||||
|
||||
%dgroup = nametoId("deployables");
|
||||
|
||||
%nf.WriteLine("function Build_"@%Fullname@"(%client, %center, %team)");
|
||||
%nf.WriteLine("{");
|
||||
%nf.WriteLine(" if (%team $= \"\")");
|
||||
%nf.WriteLine(" %team = 1;");
|
||||
//%nf.WriteLine("schedule(2000, 0, \"eval\", \"$Building = "\"\"";\");");
|
||||
//%nf.WriteLine("%datablock = (%team == 1) ? \"BuildingBlock0\" : \"BuildingBlock6\";");
|
||||
|
||||
%nf.WriteLine("%offset = VectorSub(GetWords(%center, 0, 1) SPC GetWord(%center, 2), \""@%start@"\");");
|
||||
%nf.WriteLine("");
|
||||
|
||||
for (%i = 0; %i < %dgroup.GetCount(); %i++)
|
||||
{
|
||||
%obj = %dGroup.getObject(%i);
|
||||
|
||||
%db = %obj.getDataBlock().getname();
|
||||
|
||||
if (%obj.team == %client.team && %db !$= "")
|
||||
{
|
||||
// BD mod
|
||||
|
||||
%newline = "%building = new (StaticShape) () {datablock = "@%db@";";
|
||||
|
||||
// position mod
|
||||
|
||||
%pos = %obj.getPosition();
|
||||
|
||||
%z = GetWord(%pos, 2) - %tHeight;
|
||||
|
||||
%pos = GetWords(%pos, 0, 1) SPC %z;
|
||||
|
||||
%newline = %newline @ "Position = VectorAdd(\""@%pos@"\", %offset);";
|
||||
|
||||
// Rotation mod (modifed by Dark Dragon DX to fix rotation issue)
|
||||
|
||||
// %rot = %obj.getRotation();
|
||||
%rot = getWords(%obj.getTransform(), 3, 6);
|
||||
|
||||
// %newline = %newline @ "Rotation = \""@%rot@"\";";
|
||||
|
||||
// Scale mod
|
||||
|
||||
%Scale = %obj.Scale;
|
||||
|
||||
%newline = %newline @ "Scale = \""@%Scale@"\";";
|
||||
|
||||
// Floor mod
|
||||
|
||||
if (%obj.TheFloor)
|
||||
{
|
||||
%newline = %newline @ "TheFloor = \"true\";";
|
||||
|
||||
%obj.TheFloor = "";
|
||||
}
|
||||
|
||||
// type mod
|
||||
|
||||
%newline = %newline @ "Type = \""@%name@"\";";
|
||||
|
||||
// Team mod
|
||||
|
||||
%newline = %newline @ "team = %team;};";
|
||||
|
||||
// Unification
|
||||
|
||||
%newline = %newline @ "addToDeployGroup(%obj);";
|
||||
|
||||
// write
|
||||
|
||||
%nf.WriteLine(%newline);
|
||||
%nf.WriteLine("%building.setRotation(\x22"@%rot@"\x22);");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
%nf.WriteLine("}");
|
||||
%nf.Close();
|
||||
%nf.Delete();
|
||||
|
||||
}
|
||||
|
||||
$CC_ConvTable["DeployedSpine"] = "%datablock"; // white/black pads are team based
|
||||
$CC_ConvTable["DeployedSpine2"] = "%datablock"; // white/black pads are team based
|
||||
|
||||
$CC_ConvTable["DeployedSpine5"] = "\"BuildingBlock1\""; // brown pad
|
||||
|
||||
$CC_ConvTable["DeployedCrate8"] = "\"BuildingBlock5\""; // Recycle Unit
|
||||
$CC_ConvTable["DeployedCrate4"] = "\"BuildingBlock2\""; // Quantum Battery
|
||||
$CC_ConvTable["DeployedCrate3"] = "\"BuildingBlock3\""; // 4 tubes
|
||||
$CC_ConvTable["DeployedCrate7"] = "\"BuildingBlock4\""; // Mag Cooler
|
||||
$CC_ConvTable["DeployedCrate9"] = "\"BuildingBlock5\""; // Cylinder
|
||||
|
||||
//------------------------------
|
||||
// Construction Mod save file to C&C Building file converter script.
|
||||
// A lil sumthin by Alviss
|
||||
// 24/06/09
|
||||
//------------------------------
|
||||
|
||||
function ccConvertSave(%sender,%args)
|
||||
{
|
||||
// %name = "Conv_test";
|
||||
//%Fullname = "Convertion_test";
|
||||
|
||||
%name = GetWord(%args, 0);
|
||||
%fullname = GetWords(%args, 1);
|
||||
|
||||
%obj = %sender.player.SightObject(100);
|
||||
|
||||
// this is our flag to set as the bottom-most piece
|
||||
%obj.TheFloor = 1;
|
||||
|
||||
ConvertSave(%sender, %name, %Fullname, %obj);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------
|
||||
// function to convert all the pieces in a server into a new save format
|
||||
function ConvertSave(%client, %name, %Fullname, %floor)
|
||||
{
|
||||
// %floor is the bottom-msot piece
|
||||
|
||||
%start = %floor.getPosition();
|
||||
%tHeight = getTerrainHeight(%start);
|
||||
%start = GetWords(%start, 0, 1) SPC 0;
|
||||
|
||||
%nf = new fileobject() {};
|
||||
%nf.OpenforWrite(%Fullname@".cs");
|
||||
|
||||
%nf.WriteLine("//------------------------------------------------------------------------------");
|
||||
%nf.WriteLine("// Saved By "@%client.namebase);
|
||||
%nf.WriteLine("");
|
||||
|
||||
%dgroup = nametoId("deployables");
|
||||
|
||||
%nf.WriteLine("function Build_"@%Fullname@"(%client, %center, %team)");
|
||||
%nf.WriteLine("{");
|
||||
%nf.WriteLine(" if (%team $= \"\")");
|
||||
%nf.WriteLine(" %team = 1;");
|
||||
//%nf.WriteLine("schedule(2000, 0, \"eval\", \"$Building = "\"\"";\");");
|
||||
//%nf.WriteLine("%datablock = (%team == 1) ? \"BuildingBlock0\" : \"BuildingBlock6\";");
|
||||
|
||||
%nf.WriteLine("%offset = VectorSub(GetWords(%center, 0, 1) SPC GetWord(%center, 2), \""@%start@"\");");
|
||||
%nf.WriteLine("");
|
||||
|
||||
for (%i = 0; %i < %dgroup.GetCount(); %i++)
|
||||
{
|
||||
%obj = %dGroup.getObject(%i);
|
||||
|
||||
%db = %obj.getDataBlock().getname();
|
||||
|
||||
if (%obj.team == %client.team && %db !$= "")
|
||||
{
|
||||
// BD mod
|
||||
|
||||
%newline = "%building = new (StaticShape) () {datablock = "@%db@";";
|
||||
|
||||
// position mod
|
||||
|
||||
%pos = %obj.getPosition();
|
||||
|
||||
%z = GetWord(%pos, 2) - %tHeight;
|
||||
|
||||
%pos = GetWords(%pos, 0, 1) SPC %z;
|
||||
|
||||
%newline = %newline @ "Position = VectorAdd(\""@%pos@"\", %offset);";
|
||||
|
||||
// Rotation mod (modifed by Dark Dragon DX to fix rotation issue)
|
||||
|
||||
// %rot = %obj.getRotation();
|
||||
%rot = getWords(%obj.getTransform(), 3, 6);
|
||||
|
||||
// %newline = %newline @ "Rotation = \""@%rot@"\";";
|
||||
|
||||
// Scale mod
|
||||
|
||||
%Scale = %obj.Scale;
|
||||
|
||||
%newline = %newline @ "Scale = \""@%Scale@"\";";
|
||||
|
||||
// Floor mod
|
||||
|
||||
if (%obj.TheFloor)
|
||||
{
|
||||
%newline = %newline @ "TheFloor = \"true\";";
|
||||
|
||||
%obj.TheFloor = "";
|
||||
}
|
||||
|
||||
// type mod
|
||||
|
||||
%newline = %newline @ "Type = \""@%name@"\";";
|
||||
|
||||
// Team mod
|
||||
|
||||
%newline = %newline @ "team = %team;};";
|
||||
|
||||
// Unification
|
||||
|
||||
%newline = %newline @ "addToDeployGroup(%obj);";
|
||||
|
||||
// write
|
||||
|
||||
%nf.WriteLine(%newline);
|
||||
%nf.WriteLine("%building.setRotation(\x22"@%rot@"\x22);");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
%nf.WriteLine("}");
|
||||
%nf.Close();
|
||||
%nf.Delete();
|
||||
|
||||
}
|
||||
|
||||
$CC_ConvTable["DeployedSpine"] = "%datablock"; // white/black pads are team based
|
||||
$CC_ConvTable["DeployedSpine2"] = "%datablock"; // white/black pads are team based
|
||||
|
||||
$CC_ConvTable["DeployedSpine5"] = "\"BuildingBlock1\""; // brown pad
|
||||
|
||||
$CC_ConvTable["DeployedCrate8"] = "\"BuildingBlock5\""; // Recycle Unit
|
||||
$CC_ConvTable["DeployedCrate4"] = "\"BuildingBlock2\""; // Quantum Battery
|
||||
$CC_ConvTable["DeployedCrate3"] = "\"BuildingBlock3\""; // 4 tubes
|
||||
$CC_ConvTable["DeployedCrate7"] = "\"BuildingBlock4\""; // Mag Cooler
|
||||
$CC_ConvTable["DeployedCrate9"] = "\"BuildingBlock5\""; // Cylinder
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue