From e514aa733fb286d9810662c4501c2fcfc597afd3 Mon Sep 17 00:00:00 2001 From: "Weston Rye (Demod)" Date: Tue, 13 Jun 2017 23:40:11 -0400 Subject: [PATCH] Added programmable speaker --- .../render/ProgrammableSpeakerRendering.java | 21 +++++++++++++++++++ .../fbsr/render/TypeRendererFactory.java | 1 + 2 files changed, 22 insertions(+) create mode 100644 FactorioBlueprintStringRenderer/src/com/demod/fbsr/render/ProgrammableSpeakerRendering.java diff --git a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/render/ProgrammableSpeakerRendering.java b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/render/ProgrammableSpeakerRendering.java new file mode 100644 index 0000000..b8c437e --- /dev/null +++ b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/render/ProgrammableSpeakerRendering.java @@ -0,0 +1,21 @@ +package com.demod.fbsr.render; + +import java.util.List; +import java.util.function.Consumer; + +import com.demod.factorio.DataTable; +import com.demod.factorio.prototype.EntityPrototype; +import com.demod.fbsr.BlueprintEntity; +import com.demod.fbsr.RenderUtils; +import com.demod.fbsr.Renderer; +import com.demod.fbsr.Renderer.Layer; +import com.demod.fbsr.WorldMap; + +public class ProgrammableSpeakerRendering extends TypeRendererFactory { + @Override + public void createRenderers(Consumer register, WorldMap map, DataTable dataTable, BlueprintEntity entity, + EntityPrototype prototype) { + List sprites = RenderUtils.getSpritesFromAnimation(prototype.lua().get("sprite")); + register.accept(RenderUtils.spriteRenderer(Layer.ENTITY3, sprites, entity, prototype)); + } +} diff --git a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/render/TypeRendererFactory.java b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/render/TypeRendererFactory.java index 913a846..f5006d8 100644 --- a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/render/TypeRendererFactory.java +++ b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/render/TypeRendererFactory.java @@ -121,6 +121,7 @@ public class TypeRendererFactory { byType.put("pipe", new PipeRendering()); byType.put("pipe-to-ground", new PipeToGroundRendering()); byType.put("power-switch", new PowerSwitchRendering()); + byType.put("programmable-speaker", new ProgrammableSpeakerRendering()); byType.put("pump", new PumpRendering()); byType.put("radar", new RadarRendering()); byType.put("rail-chain-signal", new RailChainSignalRendering());