Fixed cores being replaceable

This commit is contained in:
Anuken
2021-03-05 14:00:53 -05:00
parent b82dca89b3
commit 4690aae197
6 changed files with 16 additions and 7 deletions

View File

@@ -123,6 +123,8 @@ public class Block extends UnlockableContent{
public boolean fillsTile = true;
/** whether this block can be replaced in all cases */
public boolean alwaysReplace = false;
/** if false, this block can never be replaced. */
public boolean replaceable = true;
/** The block group. Unless {@link #canReplace} is overriden, blocks in the same group can replace each other. */
public BlockGroup group = BlockGroup.none;
/** List of block flags. Used for AI indexing. */
@@ -410,7 +412,7 @@ public class Block extends UnlockableContent{
public boolean canReplace(Block other){
if(other.alwaysReplace) return true;
return (other != this || rotate) && this.group != BlockGroup.none && other.group == this.group &&
return other.replaceable && (other != this || rotate) && this.group != BlockGroup.none && other.group == this.group &&
(size == other.size || (size >= other.size && ((subclass != null && subclass == other.subclass) || group.anyReplace)));
}

View File

@@ -52,6 +52,7 @@ public class CoreBlock extends StorageBlock{
loopSoundVolume = 1f;
drawDisabled = false;
canOverdrive = false;
replaceable = false;
}
@Remote(called = Loc.server)