forked from Mirrors/openclonk
Destroy single pixels of non-diggable material [ala]
parent
20558ef7e1
commit
4f1aa7c5cf
|
@ -2,4 +2,4 @@
|
|||
Name=Vehicle
|
||||
Density=100
|
||||
Friction=100
|
||||
|
||||
KeepSinglePixels=1
|
||||
|
|
|
@ -756,14 +756,16 @@ bool C4Landscape::CheckInstability(int32_t tx, int32_t ty, int32_t recursion_cou
|
|||
{
|
||||
int32_t mat=GetMat(tx,ty);
|
||||
if (MatValid(mat)) {
|
||||
if (::MaterialMap.Map[mat].Instable)
|
||||
const C4Material &material = MaterialMap.Map[mat];
|
||||
if (material.Instable)
|
||||
return ::MassMover.Create(tx,ty);
|
||||
// Get rid of single pixels
|
||||
else if (::MaterialMap.Map[mat].DigFree && recursion_count<10)
|
||||
else if (DensitySolid(material.Density) && !material.KeepSinglePixels && recursion_count<10)
|
||||
if ((!::GBackSolid(tx,ty+1)) + (!::GBackSolid(tx,ty-1)) + (!::GBackSolid(tx+1,ty)) + (!::GBackSolid(tx-1,ty)) >= 3)
|
||||
{
|
||||
if (!ClearPix(tx,ty)) return false;
|
||||
::PXS.Create(mat,itofix(tx),itofix(ty));
|
||||
// Diggable material drops; other material just gets removed
|
||||
if (material.DigFree) ::PXS.Create(mat,itofix(tx),itofix(ty));
|
||||
// check other pixels around this
|
||||
// Note this cannot lead to an endless recursion (unless you do funny stuff like e.g. set DigFree=1 in material Tunnel).
|
||||
// Check recursion anyway, because very large strips of single pixel width might cause sufficient recursion to crash
|
||||
|
|
|
@ -265,6 +265,7 @@ void C4MaterialCore::Clear()
|
|||
TempConvStrength = 0;
|
||||
MinHeightCount = 0;
|
||||
SplashRate=10;
|
||||
KeepSinglePixels=false;
|
||||
}
|
||||
|
||||
void C4MaterialCore::Default()
|
||||
|
@ -364,6 +365,7 @@ void C4MaterialCore::CompileFunc(StdCompiler *pComp)
|
|||
"BelowTempConvertTo", ""));
|
||||
pComp->Value(mkNamingAdapt(MinHeightCount, "MinHeightCount", 0));
|
||||
pComp->Value(mkNamingAdapt(SplashRate, "SplashRate", 10));
|
||||
pComp->Value(mkNamingAdapt(KeepSinglePixels, "KeepSinglePixels", false));
|
||||
pComp->NameEnd();
|
||||
// material reactions
|
||||
pComp->Value(mkNamingAdapt(mkSTLContainerAdapt(CustomReactionList),
|
||||
|
|
|
@ -178,6 +178,7 @@ public:
|
|||
int32_t TempConvStrength;
|
||||
int32_t MinHeightCount; // minimum material thickness in order for it to be counted
|
||||
int32_t SplashRate;
|
||||
bool KeepSinglePixels; // if true, single pixels are not destroyed (for vehicle)
|
||||
|
||||
void Clear();
|
||||
void Default();
|
||||
|
|
Loading…
Reference in New Issue