fix variable shadowing in some scripts

alut-include-path
Maikel de Vries 2017-02-13 19:04:27 +01:00
parent 1594acd3ed
commit 60f3e206cc
4 changed files with 27 additions and 28 deletions

View File

@ -109,7 +109,7 @@ public func ExecuteIdle(effect fx)
// Turns around the AI such that it looks at its target.
public func ExecuteLookAtTarget(effect fx)
{
// Set direction to look at target, we can assume this is instantanuous.
// Set direction to look at target, we can assume this is instantaneous.
if (fx.target->GetX() > fx.Target->GetX())
fx.Target->SetDir(DIR_Right);
else

View File

@ -351,55 +351,55 @@ public func GetRopeConnectPosition(int index, bool right, bool end, int angle, i
right = !right;
if (!end)
{
var start = [0, 0];
var ladder_start = [0, 0];
if (!right)
{
if (index >= 2)
{
start = [lib_rope_particles[index-1].x, lib_rope_particles[index-1].y];
start[0] += -Cos(oldangle, Ropeladder_Segment_LeftXOffset * MirrorSegments);
start[1] += -Sin(oldangle, Ropeladder_Segment_LeftXOffset * MirrorSegments);
ladder_start = [lib_rope_particles[index-1].x, lib_rope_particles[index-1].y];
ladder_start[0] += -Cos(oldangle, Ropeladder_Segment_LeftXOffset * MirrorSegments);
ladder_start[1] += -Sin(oldangle, Ropeladder_Segment_LeftXOffset * MirrorSegments);
}
else
{
start = [GetX() * Ladder_Precision, GetY() * Ladder_Precision];
start[0] += -Cos(GetR(), 188) + Sin(GetR(), 113);
start[1] += -Sin(GetR(), 188) - Cos(GetR(), 113);
ladder_start = [GetX() * Ladder_Precision, GetY() * Ladder_Precision];
ladder_start[0] += -Cos(GetR(), 188) + Sin(GetR(), 113);
ladder_start[1] += -Sin(GetR(), 188) - Cos(GetR(), 113);
}
}
else
{
if (index >= 2)
{
start = [lib_rope_particles[index-1].x, lib_rope_particles[index-1].y];
start[0] += -Cos(oldangle, Ropeladder_Segment_RightXOffset * MirrorSegments);
start[1] += -Sin(oldangle, Ropeladder_Segment_RightXOffset * MirrorSegments);
ladder_start = [lib_rope_particles[index-1].x, lib_rope_particles[index-1].y];
ladder_start[0] += -Cos(oldangle, Ropeladder_Segment_RightXOffset * MirrorSegments);
ladder_start[1] += -Sin(oldangle, Ropeladder_Segment_RightXOffset * MirrorSegments);
}
else
{
start = [GetX() * Ladder_Precision, GetY() * Ladder_Precision];
start[0] += Cos(GetR(), 188) + Sin(GetR(), 113);
start[1] += Sin(GetR(), 188) - Cos(GetR(), 113);
ladder_start = [GetX() * Ladder_Precision, GetY() * Ladder_Precision];
ladder_start[0] += Cos(GetR(), 188) + Sin(GetR(), 113);
ladder_start[1] += Sin(GetR(), 188) - Cos(GetR(), 113);
}
}
return start;
return ladder_start;
}
else
{
var end = [0, 0];
var ladder_end = [0, 0];
if (!right)
{
end = [lib_rope_particles[index].x, lib_rope_particles[index].y];
end[0] += -Cos(angle, Ropeladder_Segment_LeftXOffset * MirrorSegments);
end[1] += -Sin(angle, Ropeladder_Segment_LeftXOffset * MirrorSegments);
ladder_end = [lib_rope_particles[index].x, lib_rope_particles[index].y];
ladder_end[0] += -Cos(angle, Ropeladder_Segment_LeftXOffset * MirrorSegments);
ladder_end[1] += -Sin(angle, Ropeladder_Segment_LeftXOffset * MirrorSegments);
}
else
{
end = [lib_rope_particles[index].x, lib_rope_particles[index].y];
end[0] += -Cos(angle, Ropeladder_Segment_RightXOffset * MirrorSegments);
end[1] += -Sin(angle, Ropeladder_Segment_RightXOffset * MirrorSegments);
ladder_end = [lib_rope_particles[index].x, lib_rope_particles[index].y];
ladder_end[0] += -Cos(angle, Ropeladder_Segment_RightXOffset * MirrorSegments);
ladder_end[1] += -Sin(angle, Ropeladder_Segment_RightXOffset * MirrorSegments);
}
return end;
return ladder_end;
}
}

View File

@ -156,13 +156,12 @@ public func SetSeedOffset(int v)
@plant_id plant to check for whether it's already too crowded. Default to GetID().
@return true iff seeding should occur
*/
public func CheckSeedChance(int offx, int offy, proplist plant_id)
public func CheckSeedChance(int offx, int offy, id plant_id)
{
// Find number of plants in seed area.
// Ignored confinement - that's only used for actual placement
var size = this->SeedArea();
var amount = this->SeedAmount();
var plant_id;
var plant_cnt = ObjectCount(Find_ID(plant_id ?? GetID()), Find_InRect(offx - size / 2, offy - size / 2, size, size));
// Increase seed chance by number of missing plants to reach maximum amount
// Note the chance will become negative if the maximum has been reached, in which case the random check will never succeed.

View File

@ -79,10 +79,10 @@ global func ExtractLiquidAmount(int x, int y, int amount, bool distant_first)
var density = GetMaterialVal("Density", "Material", mat);
if (density < C4M_Liquid || density >= C4M_Solid)
return nil;
var amount = ExtractMaterialAmount(x, y, mat, amount, distant_first);
if (amount <= 0)
var extracted_amount = ExtractMaterialAmount(x, y, mat, amount, distant_first);
if (extracted_amount <= 0)
return nil;
return [mat, amount];
return [mat, extracted_amount];
}
/** Removes a material pixel from the specified location, if the material is flammable