Remove or use unused variables in Objects, System

master
Nicolas Hake 2018-07-24 14:19:26 +02:00
parent 5ef52f2450
commit 4c5dfac952
18 changed files with 18 additions and 32 deletions

View File

@ -672,8 +672,6 @@ func FxIntScaleTimer(target, number, time)
}
this.dist = dist;
SetAnimationPosition(number.animation_id, Anim_Const(GetAnimationLength("ScaleTop")*dist/800));
// The animation's graphics has to be shifet a bit to adjust to the clonk movement
var pos = GetAnimationPosition(number.animation_id);
SetScaleRotation(0, 0, 0, 0, 0, true);
// Check if corner scale help is needed
if (CheckScaleTopHelper())

View File

@ -81,12 +81,12 @@ func InitializeEnvironments()
AddEnvironment(underwater, 1400);
// City: Clonk is surrounded by buildings
var city = this.env_city = new Environment
this.env_city = new Environment
{
Name = "City",
CheckPlayer = this.EnvCheck_City,
};
//AddEnvironment(city, 1200); - no music/sound for now
//AddEnvironment(this.env_city, 1200); - no music/sound for now
// Lava: Lava material is nearby
var lava = this.env_lava = new Environment

View File

@ -356,7 +356,7 @@ private func InitializeMaterial(int plr)
// So e.g. each clonk can get one shovel
for (var idlist_entry in starting_material)
{
var best_target = nil, target_score, clonk;
var best_target = nil, target_score;
var obj = EditorBase->CreateItemPlusParameter(idlist_entry, GetX(), GetY() + GetDefHeight() / 2, plr);
if (!obj || !obj.Collectible) continue;
var id = idlist_entry.id;

View File

@ -28,7 +28,6 @@ public func ShowWealth()
if (GetType(this) == C4V_Def)
{
GUI_Controller_Wealth_shown = true; // for players joining later
var plr;
for (var i=0; i<GetPlayerCount(C4PT_User); ++i)
{
var plr = GetPlayerByIndex(i, C4PT_User);
@ -49,7 +48,6 @@ public func HideWealth()
if (GetType(this) == C4V_Def)
{
GUI_Controller_Wealth_shown = false; // for players joining later
var plr;
for (var i=0; i<GetPlayerCount(C4PT_User); ++i)
{
var plr = GetPlayerByIndex(i, C4PT_User);

View File

@ -92,7 +92,6 @@ public func Reset()
{
// Definition call: Reset for all players
RemoveAll(Find_ID(GetGUIControllerID()));
var plr;
for (var i=0; i<GetPlayerCount(C4PT_User); ++i)
{
var plr = GetPlayerByIndex(i, C4PT_User);

View File

@ -408,7 +408,7 @@ func OpenMenuForObject(object obj, int slot, bool forced)
};
// Allow the menu to be closed with a clickable button.
var close_button = GuiAddCloseButton(root_menu, this, "Close");
GuiAddCloseButton(root_menu, this, "Close");
// Special setup for a minimized menu.
if (this.minimized)
@ -877,9 +877,9 @@ func OnMenuEntrySelected(proplist menu_info, int entry_index, int player)
var callback_target;
if (!(callback_target = info.menu.callback_target)) return;
if (!info.menu.callback) return; // The menu can actually decide to handle user interaction itself and not provide a callback.
var result = callback_target->Call(info.menu.callback, info.entry.symbol, info.entry.extra_data, cursor);
callback_target->Call(info.menu.callback, info.entry.symbol, info.entry.extra_data, cursor);
// todo: trigger refresh for special value of result?
// todo: trigger refresh for special value of callback result?
}
private func OnContentsSelection(symbol, extra_data)

View File

@ -1057,7 +1057,10 @@ private func EvalAct_CastObjects(proplist props, proplist context)
var mean_angle = EvaluateValue("Integer", props.MeanAngle, context);
var angle_deviation = EvaluateValue("Integer", props.AngleDeviation, context);
var position = EvaluatePosition(props.Position, context);
context.last_casted_objects = CastObjects(create_id, amount, speed, position[0], position[1], mean_angle, angle_deviation);
var objects = CastObjects(create_id, amount, speed, position[0], position[1], mean_angle, angle_deviation);
for (var obj in objects)
obj->SetOwner(owner);
context.last_casted_objects = objects;
}
private func EvalAct_CastParticles(proplist props, proplist context)
@ -1071,7 +1074,6 @@ private func EvalAct_CastParticles(proplist props, proplist context)
if (lifetime <= 0) return;
var position = EvaluatePosition(props.Position, context);
var color = (EvaluateValue("Color", props.Color, context) ?? 0xffffff) | 0xff000000;
var blit_mode = props.BlitMode;
var fadeout = props.FadeOut;
var gravity = EvaluateValue("Integer", props.Gravity, context);
var collision_func = props.CollisionFunc;

View File

@ -25,8 +25,7 @@ func OnBurnDown()
};
var r = GetR();
var size = GetCon() * 110 / 100;
for(var cnt = 0; cnt < 5; ++cnt)
{
var distance = 3;
@ -58,4 +57,4 @@ local BlastIncinerate = 5;
local ContactIncinerate = 1;
local Plane = 460;
// Coal burns for about 7 seconds
local BurnDownTime = 245;
local BurnDownTime = 245;

View File

@ -179,7 +179,6 @@ func Place(object clonk, int x, int y, bool box)
// and puts the offset to the wall into "xo, yo" - looking from the clonk
func GetWall(int angle)
{
var dist = 12;
for (var dist = 12; dist < 18; dist++)
{
var x = Sin(angle, dist);
@ -264,4 +263,4 @@ local Description = "$Description$";
local Collectible = true;
local BlastIncinerate = 1;
local ContactIncinerate = 1;
local Components = {Coal = 1, Firestone = 1};
local Components = {Coal = 1, Firestone = 1};

View File

@ -45,7 +45,6 @@ protected func ControlUse(object clonk, x, y)
func ReadyToBeUsed(proplist data)
{
var clonk = data.clonk;
return !GetEffect("IntReload", this);
}

View File

@ -26,7 +26,6 @@ public func BurstIntoAshes()
};
var r = GetR();
var size = GetCon() * 110 / 100;
for(var cnt = 0; cnt < 5; ++cnt)
{
@ -77,4 +76,4 @@ local Name = "$Name$";
local Description = "$Description$";
local BlastIncinerate = 1;
local ContactIncinerate = 1;
local Plane = 390;
local Plane = 390;

View File

@ -276,7 +276,6 @@ public func DoLength(int dolength)
last_length = GetLastLength();
}
var i = 0;
while (last_length > LIB_ROPE_SegmentLength * LIB_ROPE_Precision * 3 / 2)
{
lib_rope_particle_count++;

View File

@ -968,10 +968,6 @@ private func ConvertToLiquid(object obj)
if (liquid)
{
liquid->Enter(this);
for (var item in FindObjects(Find_Container(this)))
{
//Log("* %v %s", item, item->GetName());
}
obj->RemoveObject();
}
}

View File

@ -218,8 +218,7 @@ public func FruitFills(int branch, int time, bool fullgrown)
if (fullgrown)
SetAnimationPosition(branches[branch].grow_animation, Anim_Const(GetAnimationLength("grow", branches[branch].attach_slot)), branches[branch].attach_slot);
else
SetAnimationPosition(branches[branch].grow_animation, Anim_Linear(GetAnimationPosition(branches[branch].grow_animation,
branches[branch].attach_slot),
SetAnimationPosition(branches[branch].grow_animation, Anim_Linear(pos,
0,
GetAnimationLength("grow", branches[branch].attach_slot),
time,

View File

@ -14,7 +14,7 @@ func Place(int amount, proplist area, proplist settings)
var spot = FindLocation(Loc_Material("Water"), Loc_Wall(CNAT_Bottom), loc_area);
if (!spot) continue;
var f = CreateObjectAbove(this, spot.x, spot.y, NO_OWNER);
CreateObjectAbove(this, spot.x, spot.y, NO_OWNER);
--amount;
}
return true;

View File

@ -167,7 +167,7 @@ global func DrawParticleLine(string particle, int x0, int y0, int x1, int y1, in
// Create particles.
while (i >= 0)
{
var i1, i2, b;
var i1, i2;
i2 = i * 256 / prtnum;
i1 = 256 - i2;

View File

@ -156,7 +156,6 @@ global func GetSurfaceVector(int x, int y)
{
var normal = [0, 0];
var fac = 1;
for(var fac = 1; fac <= 4; fac *= 2)
{
if(GBackSolid(x + fac, y)) --normal[0];

View File

@ -569,7 +569,7 @@ global func GetBitmaskNameByValue(v, prefix)
{
// Compose bitmask of names of individual bits
// e.g. GetBitmaskNameByValue(3, "C4D_") == "C4D_StaticBack|C4D_Structure"
var s, n=0;
var s;
for (var i=0; i<31 && v; ++i)
{
var v2 = 1<<i;