mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-07-13 07:04:33 +00:00
Initial commit
This commit is contained in:
commit
0c4253f743
22 changed files with 23038 additions and 0 deletions
88
SCtF/DeleteObjects.cs
Normal file
88
SCtF/DeleteObjects.cs
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
function getGroupObjectByName(%group, %name)
|
||||
{
|
||||
%numObjects = %group.getCount();
|
||||
|
||||
for(%i = 0; %i < %numObjects; %i++)
|
||||
{
|
||||
if (%group.getObject(%i).getName() $= %name)
|
||||
return %group.getObject(%i);
|
||||
}
|
||||
}
|
||||
|
||||
function deleteObjectsFromMapByType(%type)
|
||||
{
|
||||
%teamsGroup = getGroupObjectByName(MissionGroup, "Teams");
|
||||
if (!isObject(%teamsGroup))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
%team1Group = getGroupObjectByName(%teamsGroup, "Team1");
|
||||
if (!isObject(%team1Group))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
%team2Group = getGroupObjectByName(%teamsGroup, "Team2");
|
||||
if (!isObject(%team2Group))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
%team1Base0Group = getGroupObjectByName(%team1Group, "Base0");
|
||||
if (!isObject(%team1Base0Group))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
%team2Base0Group = getGroupObjectByName(%team2Group, "Base1");
|
||||
if (!isObject(%team2Base0Group))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
deleteObjectsFromGroupByType(%team1Base0Group, %type);
|
||||
deleteObjectsFromGroupByType(%team2Base0Group, %type);
|
||||
}
|
||||
|
||||
function deleteObjectsFromGroupByType(%group, %type)
|
||||
{
|
||||
%noObjectsLeft = 0;
|
||||
|
||||
while (%noObjectsLeft == 0)
|
||||
{
|
||||
%i = 0;
|
||||
%noObjectsLeft = 1;
|
||||
%loop = 1;
|
||||
%numObjects = %group.getCount();
|
||||
|
||||
while ((%loop == 1) && (%i < %numObjects))
|
||||
{
|
||||
%obj = %group.getObject(%i);
|
||||
|
||||
if (%obj.getClassName() $= "SimGroup")
|
||||
deleteObjectsFromGroupByType(%obj, %type);
|
||||
|
||||
if (%obj.getClassName() $= %type)
|
||||
{
|
||||
%obj.delete();
|
||||
%loop = 0;
|
||||
%noObjectsLeft = 0;
|
||||
}
|
||||
else
|
||||
%i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function deleteNonSCtFObjectsFromMap()
|
||||
{
|
||||
deleteObjectsFromGroupByType(MissionGroup, "Turret");
|
||||
deleteObjectsFromGroupByType(MissionGroup, "StaticShape");
|
||||
deleteObjectsFromGroupByType(MissionGroup, "TSStatic");
|
||||
deleteObjectsFromGroupByType(MissionGroup, "ForceFieldBare");
|
||||
deleteObjectsFromGroupByType(MissionGroup, "FlyingVehicle");
|
||||
deleteObjectsFromGroupByType(MissionGroup, "WheeledVehicle");
|
||||
deleteObjectsFromGroupByType(MissionGroup, "Waypoint");
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue