forked from Mirrors/openclonk
Failsafe barrel names
parent
6f7152eba6
commit
fb397618df
|
@ -19,6 +19,18 @@ public func IsLiquidContainerForMaterial(string liquid_name)
|
|||
return density < 50 && density >= 25;
|
||||
}
|
||||
|
||||
|
||||
|
||||
local LiquidNames = {
|
||||
Acid = "$MaterialAcid$",
|
||||
DuroLava = "$MaterialDuroLava$",
|
||||
Firefluid = "$MaterialFirefluid$",
|
||||
Lava = "$MaterialLava$",
|
||||
Oil = "$MaterialOil$",
|
||||
Water = "$MaterialWater$",
|
||||
};
|
||||
|
||||
|
||||
local Name = "$Name$";
|
||||
local Description = "$Description$";
|
||||
local ContactIncinerate = 0;
|
|
@ -108,28 +108,25 @@ private func UpdateLiquidContainer()
|
|||
if (LiquidContainerIsEmpty())
|
||||
{
|
||||
SetColor(RGB(0, 0, 0));
|
||||
this.Name = this.Prototype.Name;
|
||||
//Value. Base value is 10.
|
||||
SetProperty("Value", 10); // TODO: this is a bug! The value is shared by barrel (value:12) and metal barrel (value:16)!
|
||||
}
|
||||
else
|
||||
{
|
||||
var liquid_name, color;
|
||||
var color;
|
||||
var material = Material(GetLiquidType());
|
||||
if (material >= 0)
|
||||
{
|
||||
var liquid_name = Translate(Format("Material%s", GetLiquidType()));
|
||||
var tex = GetMaterialVal("TextureOverlay", "Material", material);
|
||||
color = GetAverageTextureColor(tex);
|
||||
}
|
||||
else
|
||||
{
|
||||
liquid_name = GetLiquidType();
|
||||
color = RGB(0, 0, 0);
|
||||
}
|
||||
SetColor(color);
|
||||
this.Name = Format("%s $NameWith$ %s", this.Prototype.Name, liquid_name);
|
||||
}
|
||||
this.Name = GetNameForBarrel(GetLiquidType());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -252,7 +249,19 @@ func OnFuelRemoved(int amount)
|
|||
return true;
|
||||
}
|
||||
|
||||
func GetNameForBarrel(string liquid)
|
||||
{
|
||||
if (liquid == nil) return this.Prototype.Name;
|
||||
|
||||
var liquid_name = LiquidNames[liquid] ?? "$MaterialUnknown$";
|
||||
var name = Format("%s $NameWith$ %s", this.Prototype.Name, liquid_name);
|
||||
return name;
|
||||
}
|
||||
|
||||
local LiquidNames = {
|
||||
Oil = "$MaterialOil$",
|
||||
Water = "$MaterialWater$",
|
||||
};
|
||||
|
||||
public func Definition(proplist def)
|
||||
{
|
||||
|
|
|
@ -2,4 +2,5 @@ Name=Holzfass
|
|||
Description=Behälter zum Transport von Flüssigkeiten.
|
||||
NameWith=mit
|
||||
MaterialWater=Wasser
|
||||
MaterialOil=Öl
|
||||
MaterialOil=Öl
|
||||
MaterialUnknown=unbekanntem Inhalt
|
|
@ -2,4 +2,5 @@ Name=Wooden Barrel
|
|||
Description=Container for transporting liquids.
|
||||
NameWith=with
|
||||
MaterialWater=water
|
||||
MaterialOil=oil
|
||||
MaterialOil=oil
|
||||
MaterialUnknown=unkown content
|
Loading…
Reference in New Issue