diff --git a/core/src/com/riiablo/engine/Engine.java b/core/src/com/riiablo/engine/Engine.java index a64cc247..9b289385 100644 --- a/core/src/com/riiablo/engine/Engine.java +++ b/core/src/com/riiablo/engine/Engine.java @@ -138,16 +138,28 @@ public class Engine extends PooledEngine { name = base.Name.equalsIgnoreCase("dummy") ? base.Description : Riiablo.string.lookup(base.Name); } + boolean draw = base.Draw; + TypeComponent typeComponent = createComponent(TypeComponent.class); typeComponent.type = TypeComponent.Type.OBJ; - CofComponent cofComponent = createComponent(CofComponent.class); - cofComponent.token = base.Token; - cofComponent.mode = Object.MODE_NU; - cofComponent.wclass = CofComponent.WEAPON_HTH; - Arrays.fill(cofComponent.component, CofComponent.COMPONENT_NULL); + CofComponent cofComponent; + if (draw) { + cofComponent = createComponent(CofComponent.class); + cofComponent.token = base.Token; + cofComponent.mode = Object.MODE_NU; + cofComponent.wclass = CofComponent.WEAPON_HTH; + Arrays.fill(cofComponent.component, CofComponent.COMPONENT_NULL); + } else { + cofComponent = null; + } - AnimationComponent animationComponent = createComponent(AnimationComponent.class); + AnimationComponent animationComponent; + if (draw) { + animationComponent = createComponent(AnimationComponent.class); + } else { + animationComponent = null; + } BBoxComponent boxComponent = createComponent(BBoxComponent.class); @@ -171,8 +183,8 @@ public class Engine extends PooledEngine { Entity entity = createEntity(base.Description); entity.add(typeComponent); - entity.add(cofComponent); - entity.add(animationComponent); + if (draw) entity.add(cofComponent); + if (draw) entity.add(animationComponent); entity.add(boxComponent); entity.add(positionComponent); entity.add(mapComponent); @@ -182,6 +194,8 @@ public class Engine extends PooledEngine { labelComponent.actor.setUserObject(entity); + if (!draw) entity.flags |= Flags.INVISIBLE; + return entity; } diff --git a/core/src/com/riiablo/engine/Flags.java b/core/src/com/riiablo/engine/Flags.java index 471aec19..c0b65ffe 100644 --- a/core/src/com/riiablo/engine/Flags.java +++ b/core/src/com/riiablo/engine/Flags.java @@ -5,6 +5,7 @@ public final class Flags { public static final int DEBUG = 1 << 0; public static final int SELECTABLE = 1 << 1; public static final int SELECTED = 1 << 2; + public static final int INVISIBLE = 1 << 3; public static String toString(int bits) { StringBuilder builder = new StringBuilder(); @@ -14,6 +15,7 @@ public final class Flags { if ((bits & DEBUG) == DEBUG) builder.append("DEBUG").append("|"); if ((bits & SELECTABLE) == SELECTABLE) builder.append("SELECTABLE").append("|"); if ((bits & SELECTED) == SELECTED) builder.append("SELECTED").append("|"); + if ((bits & INVISIBLE) == INVISIBLE) builder.append("INVISIBLE").append("|"); if (builder.length() > 0) builder.setLength(builder.length() - 1); } return builder.toString();