Fixed many more location bugs.

This commit is contained in:
PrisonCamp
2015-02-18 23:27:34 -08:00
parent ea4787a8a2
commit af96886b93
25 changed files with 69 additions and 69 deletions
@@ -3077,7 +3077,7 @@ trigger OnGiveItem (obj_id item, obj_id giver)
location locGoodLocation = locations.getGoodLocationAroundLocationAvoidCollidables(currentLoc, searchSize, searchSize, searchSize, searchSize, false, false, 6.0f);
if(locGoodLocation==null)
{
locGoodLocation = currentLoc;
locGoodLocation = (location)currentLoc.clone();
}
int mobCount = rand(1, 3);
@@ -48,7 +48,7 @@ trigger OnObjectMenuSelect(obj_id player, int item)
droidName = "@" + droidName;
//use current location as default
location holoOneLocation = startLocation;
location holoOneLocation = (location)startLocation.clone();
boolean goodLocation = false;
//loop 10 times looking for a good location in a circle around the droid
@@ -83,7 +83,7 @@ trigger OnObjectMenuSelect(obj_id player, int item)
setName(holo_01, droidName);
//start finding location for hologram 2
location holoTwoLocation = startLocation;
location holoTwoLocation = (location)startLocation.clone();
goodLocation = false;
//loop 10 times looking for a suitable location
@@ -276,7 +276,7 @@ messageHandler moveDancingDroidNewLocation()
if(utils.hasScriptVar(self, "music.stillPlaying"))
{
location moveToLoc = startLocation;
location moveToLoc = (location)startLocation.clone();
boolean goodLocation = false;
for(int i = 0; i < 10; ++i)
{
@@ -383,7 +383,7 @@ messageHandler callLambdaSupport()
location tmp = utils.getRandomLocationInRing(there, 5f, 10f);
if ( tmp != null )
there = tmp;
there = (location)tmp.clone();
if ( there != null )
gcw.spawnViaLambdaPerGeo(there, d);
@@ -106,7 +106,7 @@ messageHandler spawnEscortsAndCeleb()
{
int type = getIntObjVar(self, "event.gcwraids.cheerleader_type");
location here = getLocation(self);
location celebSpot = here;
location celebSpot = (location)here.clone();
celebSpot.z -= 12;
obj_id celeb = create.object(CELEB[type], celebSpot);
@@ -390,4 +390,4 @@ messageHandler escortDied()
}
return SCRIPT_CONTINUE;
}
}
@@ -1007,7 +1007,7 @@ commandHandler cmdDefuseMinefield()
pvpSetFactionEnemyFlag(target, mFac);
location here = getLocation(target);
location there = locs[idx];
location there = (location)locs[idx].clone();
float travel = getDistance(here, there);
location minefield = getLocation(self);
@@ -451,7 +451,7 @@ messageHandler handleReelIn()
/*LOG("fishing","handleReelIn: setting location scriptvar to " + updatedLoc.toString());
utils.setScriptVar(self, minigame.SCRIPTVAR_LOCATION, updatedLoc);*/
location markerLoc = updatedLoc;
location markerLoc = (location)updatedLoc.clone();
markerLoc.y = getWaterTableHeight(markerLoc);
setLocation(marker, markerLoc);
@@ -601,4 +601,4 @@ messageHandler handleCleanupSplash()
destroyObject(splash);
return SCRIPT_CONTINUE;
}
}
@@ -115,7 +115,7 @@ location calculateNearestGroupMission(obj_id self)
{
// no nearestGroupMission, start with the first mission
// in the locations list
nearestGroupMission = missionLocations[0];
nearestGroupMission = (location)missionLocations[0].clone();
}
else
{
@@ -139,7 +139,7 @@ location calculateNearestGroupMission(obj_id self)
for(missionLocationIndex = 0; missionLocationIndex < missionLocations.length; ++missionLocationIndex)
{
// initialize the location under consideration
location currentLocation = missionLocations[missionLocationIndex];
location currentLocation = (location)missionLocations[missionLocationIndex].clone();
// verify that the mission being considered is on the same
// planet as the group member
@@ -189,13 +189,13 @@ location calculateNearestGroupMission(obj_id self)
// this location has the most votes(so far)
if(votes > mostVotes)
{
nearestGroupMission = missionLocations[locationIndex.intValue()];
nearestGroupMission = (location)missionLocations[locationIndex.intValue()].clone();
mostVotes = votes;
}
}
// update the nearest group mission waypoint for everyone in the group
result = nearestGroupMission;
result = (location)nearestGroupMission.clone();
scriptVars.put("nearestGroupMission", nearestGroupMission);
}
else
@@ -256,7 +256,7 @@ messageHandler missionLocationResponse()
location nearestGroupMission = scriptVars.getLocation("nearestGroupMission");
if(nearestGroupMission == null)
{
nearestGroupMission = missionLocation[0];
nearestGroupMission = (location)missionLocation[0].clone();
scriptVars.put("nearestGroupMission", nearestGroupMission);
}
}
@@ -40,7 +40,7 @@ messageHandler handleFireworkLaunch()
location here = getLocation(self);
location there = utils.getRandomLocationInRing(here, 0.5f, 1f);
if ( there == null )
there = here;
there = (location)here.clone();
params.put("loc", there);
@@ -171,7 +171,7 @@ messageHandler specialMessage()
debug.debugAllMsg("DEBUG", self, "#############creating special message and location############");
location parrotLoc = getLocation(parrot);
location desiredLoc = parrotLoc;
location desiredLoc = (location)parrotLoc.clone();
desiredLoc = findSpotNear(parrot, parrotLoc, LOOT_RADIUS_MAX);
for(int i=0; i < 5 && !isValidLocation(desiredLoc, SPECIAL_LOC_RADIUS); ++i)
@@ -270,7 +270,7 @@ void turnOn(obj_id self, obj_id player, string type)
// TRY AND MAKE THE CREATURES NOT SPAWN RIGHT ON THE EMITTER
for(int i = 0; i < 50; i++)
{
newLoc = myLoc;
newLoc = (location)myLoc.clone();
newLoc = utils.getRandomAwayLocation(newLoc, 1f, 1.5f);
@@ -278,7 +278,7 @@ void turnOn(obj_id self, obj_id player, string type)
if(isValidInteriorLocation(newLoc))
break;
else if(i == 49)
newLoc = myLoc;
newLoc = (location)myLoc.clone();
}
obj_id pet = createObject(template, newLoc);
@@ -977,4 +977,4 @@ messageHandler OnPack()
if(isTurnedOn(self))
turnOff(self, player);
return SCRIPT_CONTINUE;
}
}
@@ -2702,7 +2702,7 @@ location getFactionStartLocation(obj_id master_object, string faction)
return null;
location[] start_locations = getLocationArrayObjVar(master_object, VAR_START_LOCATIONS);
location loc = start_locations[idx];
location loc = (location)start_locations[idx].clone();
// If all three coordinates are 0, then the starting location was not specified.
if (loc.x == 0.0f && loc.y == 0.0f && loc.z == 0.0f)
@@ -3783,7 +3783,7 @@ void createBattlefieldObjects(obj_id master_object, int idx)
location[] start_locations = getLocationArrayObjVar(master_object, VAR_START_LOCATIONS);
if(start_locations != null && start_locations.length > 0) { // Zero length array check
start_locations[jidx] = faction_start;
start_locations[jidx] = (location)faction_start.clone();
setObjVar(master_object, VAR_START_LOCATIONS, start_locations);
}
}
@@ -911,7 +911,7 @@ void initializeAdvancedCamp(obj_id deed, obj_id camp, obj_id player, location lo
{
if(ovl.getFloatObjVar(modules[i]) != 0.0f)
{
location tempLoc = loc;
location tempLoc = (location)loc.clone();
location nodeLoc = getAdvancedCampNodeLocation(camp, tempLoc, nodeCount);
int nodeYaw = getAdvancedCampNodeYaw(camp, nodeCount);
@@ -1227,7 +1227,7 @@ void setCloneInfo(int city_id, location cityCloneLoc, location cityCloneRespawn,
void updateLocation(int city_id, location new_loc)
{
obj_id cityHall = cityGetCityHall(city_id);
location cityLoc = new_loc;
location cityLoc = (location)new_loc.clone();
citySetLocation(city_id, new_loc);
}
@@ -516,8 +516,8 @@ Vector getAvailableCloningFacilities(obj_id player)
{
playerFacility = idList[i];
playerFacilityName = nameList[i];
playerFacilityLoc = locList[i];
playerFacilitySpawnLoc = respawnList[i];
playerFacilityLoc = (location)locList[i].clone();
playerFacilitySpawnLoc = (location)respawnList[i].clone();
playerCityDist = dist;
}
break;
@@ -556,8 +556,8 @@ Vector getAvailableCloningFacilities(obj_id player)
{
factionFacility = idList[i];
factionFacilityName = nameList[i];
factionFacilityLoc = locList[i];
factionFacilitySpawnLoc = respawnList[i];
factionFacilityLoc = (location)locList[i].clone();
factionFacilitySpawnLoc = (location)respawnList[i].clone();
factionFacilityDist = dist;
}
}
@@ -569,8 +569,8 @@ Vector getAvailableCloningFacilities(obj_id player)
{
factionFacility = idList[i];
factionFacilityName = nameList[i];
factionFacilityLoc = locList[i];
factionFacilitySpawnLoc = respawnList[i];
factionFacilityLoc = (location)locList[i].clone();
factionFacilitySpawnLoc = (location)respawnList[i].clone();
factionFacilityDist = dist;
}
}
@@ -587,8 +587,8 @@ Vector getAvailableCloningFacilities(obj_id player)
{
pvpAdvancedFacility = idList[i];
pvpAdvancedFacilityName = nameList[i];
pvpAdvancedFacilityLoc = locList[i];
pvpAdvancedFacilitySpawnLoc = respawnList[i];
pvpAdvancedFacilityLoc = (location)locList[i].clone();
pvpAdvancedFacilitySpawnLoc = (location)respawnList[i].clone();
pvpAdvancedFacilityDist = dist;
}
@@ -606,8 +606,8 @@ Vector getAvailableCloningFacilities(obj_id player)
{
pvpAdvancedFacility = idList[i];
pvpAdvancedFacilityName = nameList[i];
pvpAdvancedFacilityLoc = locList[i];
pvpAdvancedFacilitySpawnLoc = respawnList[i];
pvpAdvancedFacilityLoc = (location)locList[i].clone();
pvpAdvancedFacilitySpawnLoc = (location)respawnList[i].clone();
pvpAdvancedFacilityDist = dist;
}
@@ -617,8 +617,8 @@ Vector getAvailableCloningFacilities(obj_id player)
{
playerCamp = idList[i];
playerCampName = nameList[i];
playerCampLoc = locList[i];
playerCampSpawnLoc = respawnList[i];
playerCampLoc = (location)locList[i].clone();
playerCampSpawnLoc = (location)respawnList[i].clone();
playerCampDist = dist;
}
@@ -71,7 +71,7 @@ obj_id staticObject( string objectName, location spawnLocation )
return creature;
}
/* -----------------12/5/2002 2:49PM-----------------
/* ----------------------------------
* creates an object from template, creature datatable or npc datatable
*
* @param objectName the templatename, creature or NPC type to create
@@ -242,7 +242,7 @@ obj_id themeParkObject( string objectName, float xOffset, float zOffset )
}
/* -----------------12/11/2002 3:31PM----------------
/* ---------------------------------
* Used to create an NPC of a specified species or from a specific species-list
*
* @params creatureName the name of the creature to spawn
@@ -948,7 +948,7 @@ location getRandom2DLocationAroundLocation(obj_id player, float relativeOffsetX,
if(!isValidQuestSpawnPoint(player, newLocation, onAFloor, inACell))
{
//absolute failure to find a good point, use the original location
newLocation = playerLocation;
newLocation = (location)playerLocation.clone();
}
}
}
@@ -998,7 +998,7 @@ boolean isValidQuestSpawnPoint(obj_id player, location newLocation, boolean onAF
*/
location getRandom2DLocationInRing(location startLocation, float minimumRadius, float maximumRadius)
{
location newLocation = startLocation;
location newLocation = (location)startLocation.clone();
float deltaX = rand(minimumRadius, maximumRadius);
if(rand(1,2) == 2)
deltaX = -deltaX;
@@ -685,7 +685,7 @@ boolean isLocationFishable(location loc)
{
if ( loc != null )
{
location testLoc = loc;
location testLoc = (location)loc.clone();
testLoc.y = getHeightAtLocation(loc.x, loc.z);
return isBelowWater(testLoc); //temp hack
}
@@ -6899,7 +6899,7 @@ location transformDeltaWorldCoord(location here, float dx, float dz, float yaw)
float[] xz = transformDeltaWorldCoord(dx, dz, rotation);
if ( xz != null & xz.length == 2 )
{
location there = here;
location there = (location)here.clone();
there.x += xz[0];
there.z += xz[1];
@@ -7536,13 +7536,13 @@ obj_id createStructureSign(obj_id structure, float sYaw)
}
}
location spawn = there;
location spawn = (location)there.clone();
if ( sYaw != 0f )
{
location newspawn = transformDeltaWorldCoord(here, x, z, sYaw);
newspawn.y = there.y;
spawn = newspawn;
spawn = (location)newspawn.clone();
//LOG("structureSign","createStructureSign: spawn = " + spawn.toString());
}
@@ -524,7 +524,7 @@ location rotateLocationXZ(location locOrigin, location locPoint, float fltAngle)
float fltC = (float)Math.cos(fltRadians);
float fltS = (float) Math.sin(fltRadians);
location locNewOffset = locOrigin;
location locNewOffset = (location)locOrigin.clone();
locNewOffset.x += (dx * fltC) + (dz * fltS);
locNewOffset.y = locPoint.y;
@@ -1170,7 +1170,7 @@ location rotateSavedBlueprintDataXZ(location locOrigin, location locPoint, float
float fltC = (float)Math.cos(fltRadians);
float fltS = (float) Math.sin(fltRadians);
location locNewOffset = locOrigin;
location locNewOffset = (location)locOrigin.clone();
locNewOffset.x += -(dx * fltC) + (dz * fltS);
locNewOffset.y = locPoint.y;
@@ -161,7 +161,7 @@ obj_id createTargetDummy(obj_id controller, obj_id player)
location controllerLocation = getLocation(controller);
location awayLoc = utils.getRandomAwayLocation(controllerLocation, 1.f, 2.f);
if((awayLoc.cell != null) || isIdValid(awayLoc.cell))
awayLoc = controllerLocation;
awayLoc = (location)controllerLocation.clone();
if(!permittedToCallTargetDummy(player, awayLoc))
return obj_id.NULL_ID;
@@ -194,7 +194,7 @@ obj_id recreateTargetDummy(obj_id controller, obj_id player)
if(getTargetDummyCreatureType(controller).equals("tcg_target_dummy"))
{
float controllerYaw = getYaw(controller);
location offsetLoc = where;
location offsetLoc = (location)where.clone();
offsetLoc.x += 2f;
location pathToLoc = utils.rotatePointXZ(where, offsetLoc, controllerYaw);
pathTo(targetDummyObj, pathToLoc);
@@ -306,7 +306,7 @@ obj_id[] spawnRadial(obj_id target)
}
else
{
spawnLoc = goodLoc;
spawnLoc = (location)goodLoc.clone();
}
if ( spawnLoc.cell == obj_id.NULL_ID )
@@ -466,7 +466,7 @@ obj_id[] spawnDatatableOffset(obj_id target)
float dz = fltZ[i];
float yaw =fltYaw[i];
location here = myLoc;
location here = (location)myLoc.clone();
here = player_structure.transformDeltaWorldCoord(here, dx, dz, tYaw);
@@ -659,7 +659,7 @@ void spawnDatatableOffsetQueued(obj_id target, int intIndex)
float dz = fltZ[i];
float yaw =fltYaw[i];
location here = myLoc;
location here = (location)myLoc.clone();
here = player_structure.transformDeltaWorldCoord(here, dx, dz, tYaw);
@@ -678,7 +678,7 @@ void spawnDatatableOffsetQueued(obj_id target, int intIndex)
float dz = fltZ[i];
float yaw =fltYaw[i];
location here = myLoc;
location here = (location)myLoc.clone();
here = player_structure.transformDeltaWorldCoord(here, dx, dz, tYaw);
@@ -697,7 +697,7 @@ void spawnDatatableOffsetQueued(obj_id target, int intIndex)
float dz = fltZ[i];
float yaw =fltYaw[i];
location here = myLoc;
location here = (location)myLoc.clone();
here = player_structure.transformDeltaWorldCoord(here, dx, dz, tYaw);
child = createObject(tpf, here);
@@ -714,7 +714,7 @@ void spawnDatatableOffsetQueued(obj_id target, int intIndex)
float dy = fltY[i];
float dz = fltZ[i];
float yaw =fltYaw[i];
location here = myLoc;
location here = (location)myLoc.clone();
here = player_structure.transformDeltaWorldCoord(here, dx, dz, tYaw);
child = createObject(tpf, here);
if(isIdValid(child))
@@ -732,7 +732,7 @@ void spawnDatatableOffsetQueued(obj_id target, int intIndex)
float dy = fltY[i];
float dz = fltZ[i];
float yaw =fltYaw[i];
location here = myLoc;
location here = (location)myLoc.clone();
here = player_structure.transformDeltaWorldCoord(here, dx, dz, tYaw);
child = createObject(tpf, here);
@@ -809,7 +809,7 @@ void spawnDatatableOffsetQueued(obj_id target, int intIndex)
float fltC = (float)Math.cos(fltRadians);
float fltS = (float)Math.sin(fltRadians);
location here = myLoc;
location here = (location)myLoc.clone();
here.x += (dx * fltC) - (dz * fltS);
here.y += dy;
@@ -190,10 +190,10 @@ float getDistance2D( location locTarget1, location locTarget2 )
if ( locTarget1 == null || locTarget2 == null)
return -1.00f;
location loc1 = locTarget1;
location loc1 = (location)locTarget1.clone();
loc1.y = 0f;
location loc2 = locTarget2;
location loc2 = (location)locTarget2.clone();
loc2.y = 0f;
return getDistance(loc1, loc2);
@@ -2707,7 +2707,7 @@ location getRandomLocationInRing(location locOrigin, float fltMinDistance, float
location rotatePointXZ(location locOrigin, float fltDistance, float fltAngle)
{
location locOffset = locOrigin;
location locOffset = (location)locOrigin.clone();
locOffset.x = locOrigin.x + fltDistance;
locOffset.z = locOrigin.z;
@@ -2723,7 +2723,7 @@ location rotatePointXZ(location locOrigin, location locPoint, float fltAngle)
float fltC = (float)Math.cos(fltRadians);
float fltS = (float) Math.sin(fltRadians);
location locNewOffset = locOrigin;
location locNewOffset = (location)locOrigin.clone();
locNewOffset.x += (dx * fltS) - (dz * fltC);
locNewOffset.y = locPoint.y;
locNewOffset.z += (dx * fltC) + (dz * fltS);
@@ -2739,7 +2739,7 @@ location rotatePointXZ(location locPoint, float fltAngle)
float fltC = (float) Math.cos(fltRadians);
float fltS = (float) Math.sin(fltRadians);
//LOG("player_spawner", "locPoint is "+locPoint);
location locNewPoint = locPoint;
location locNewPoint = (location)locPoint.clone();
locNewPoint.x += (locPoint.x * fltC) - (locPoint.z * fltS);
locNewPoint.z += (locPoint.x * fltS) + (locPoint.z * fltC);
@@ -85,25 +85,25 @@ messageHandler setupArea()
utils.setScriptVar(self, "shipsRemaining", 3);
location point1 = locSelf;
location point1 = (location)locSelf.clone();
point1.x += 200;
point1.y += 40;
obj_id objPoint1 = create.object("object/tangible/npe/npe_node.iff", point1);
utils.setScriptVar(self, "objPoint1", objPoint1);
location point2 = locSelf;
location point2 = (location)locSelf.clone();
point2.z += 200;
point2.y += 40;
obj_id objPoint2 = create.object("object/tangible/npe/npe_node.iff", point2);
utils.setScriptVar(self, "objPoint2", objPoint2);
location point3 = locSelf;
location point3 = (location)locSelf.clone();
point3.x += -200;
point3.y += 40;
obj_id objPoint3 = create.object("object/tangible/npe/npe_node.iff", point3);
utils.setScriptVar(self, "objPoint3", objPoint3);
location point4 = locSelf;
location point4 = (location)locSelf.clone();
point4.z += -200;
point4.y += 40;
obj_id objPoint4 = create.object("object/tangible/npe/npe_node.iff", point4);
@@ -753,7 +753,7 @@ void startDelayedAttack(obj_id attacker, obj_id target, obj_id objWeapon, string
}
else if(eggPosition == 3) // LOCATION
{
where = actionData.targetLoc;
where = (location)actionData.targetLoc.clone();
}
@@ -1184,7 +1184,7 @@ boolean doCombatPreCheck(combat_data actionData, attacker_data attackerData, wea
}
else
{
location where = actionData.targetLoc;
location where = (location)actionData.targetLoc.clone();
where.y += 0.5f; // gotta raise the loc, or canSee will fail as it will collide with the terrain at that location. woohoo.
cansee = canSee(attackerData.id, where);
//sendSystemMessageTestingOnly(obj_id.getObjId(10014554), "CanSee 1");
@@ -1327,7 +1327,7 @@ obj_id[] getCombatDefenders(obj_id self, obj_id target, weapon_data weaponData,
{
if(weaponData.weaponType == WEAPON_TYPE_DIRECTIONAL)
{
location where = actionData.targetLoc;
location where = (location)actionData.targetLoc.clone();
// Width is an angle to the sides of your target; IE: 20 degree width is a total of 40 degrees.
defenders = pvpGetTargetsInCone(self, self, where, length, width);
@@ -1168,7 +1168,7 @@ location getMapLocation(obj_id map, obj_id player)
}
else
{
treasureLoc = storedLoc;
treasureLoc = (location)storedLoc.clone();
}
return treasureLoc;
}