Mon Feb 22, 2021 6:06 am
Mon Feb 22, 2021 8:28 am
Class CTDExplosiveBarrel : ExplosiveBarrel replaces ExplosiveBarrel {
private array < Class<CTDExplosiveBarrel> > barrels; // <-- class type
const ddist = 14;
override void Tick() {
super.Tick();
if (GetAge() % 35 == 0) {
BlockThingsIterator itr = BlockThingsIterator.Create(self,ddist);
while (itr.next()) {
let obj = itr.thing;
if (obj == self)
continue;
if (!(obj is "CTDExplosiveBarrel"))
continue;
if (barrels.Find(obj) != barrels.Size())
continue;
if (distance3D(obj) > ddist)
continue;
barrels.Push(obj); // <-- actor type
}
console.printf("other barrels nearby: %d",barrels.Size());
}
}
}
Mon Feb 22, 2021 8:43 am
_mental_ wrote:It has nothing to do with voodoo dolls, the provided code should not compile at all. It's a bug in compiler's type checking. Variable of actor type must not be pushed to array of class types.
Mon Feb 22, 2021 9:56 am
Mon Feb 22, 2021 3:39 pm