From 131b1135404bdc443ed30de43bf1e0f3bd71973d Mon Sep 17 00:00:00 2001 From: ImpalerWrG Date: Thu, 19 Feb 2015 20:14:11 -0500 Subject: [PATCH] DataType files and PathingRenderer.java classes for prior updates --- planning/Craft Products.txt | 82 +++++++++ src/Data/Types/AnimationGroupData.java | 41 +++++ src/Data/Types/AnimationTypeData.java | 42 +++++ src/Data/Types/BuildingData.java | 41 +++++ src/Data/Types/FontData.java | 41 +++++ src/Data/Types/MaterialClassData.java | 41 +++++ src/Data/Types/MaterialData.java | 41 +++++ src/Data/Types/ModelData.java | 41 +++++ src/Data/Types/SurfaceTypeData.java | 41 +++++ src/Data/Types/TextureData.java | 41 +++++ src/Data/Types/TextureGridData.java | 41 +++++ src/Data/Types/TextureSheetData.java | 41 +++++ src/Data/Types/TreeData.java | 41 +++++ src/Renderer/PathingRenderer.java | 219 +++++++++++++++++++++++++ 14 files changed, 794 insertions(+) create mode 100644 planning/Craft Products.txt create mode 100644 src/Data/Types/AnimationGroupData.java create mode 100644 src/Data/Types/AnimationTypeData.java create mode 100644 src/Data/Types/BuildingData.java create mode 100644 src/Data/Types/FontData.java create mode 100644 src/Data/Types/MaterialClassData.java create mode 100644 src/Data/Types/MaterialData.java create mode 100644 src/Data/Types/ModelData.java create mode 100644 src/Data/Types/SurfaceTypeData.java create mode 100644 src/Data/Types/TextureData.java create mode 100644 src/Data/Types/TextureGridData.java create mode 100644 src/Data/Types/TextureSheetData.java create mode 100644 src/Data/Types/TreeData.java create mode 100644 src/Renderer/PathingRenderer.java diff --git a/planning/Craft Products.txt b/planning/Craft Products.txt new file mode 100644 index 0000000..13111e1 --- /dev/null +++ b/planning/Craft Products.txt @@ -0,0 +1,82 @@ + + +Clothing Sets + +Cheap - made with a small amount of plant fiber and very quick to make, the basic default starting clothing +Work - made with half plant fiber, half leather and more total material then cheap cloths, wears out more slowly and is preferable when doing work, may prevent minor work injuries +Warm - made with cloth and fur (obtained from fur animals) more total material then cheap clothing, negates or mitigates negative effects of cold allowing dwarfs on the surface in cold climates and winter to be more happy and productive +Formal - Made with half silk and half plant fiber, more total material and work time then cheap clothing, ingresses the happiness gain from a party or weeding event. Most dwarfs will desire these once basic needs are met. +Fancy - Made mostly of silk, even higher material and time required over fancy, Nobles from Mayor level up are unhappy if not waring these, particularly wealthy dwarfs will want these too. +Royal - Large amounts of silk and some additional fur, no plant fiber, high production time, Highest level nobles will demand these + +Weapons + +Club +Spear +Bow +Ax +Pick +Sword +Knife + + + + +Ladder +Pot +Nail +Lock +Torch +Rope +Backpack +Bed +Table +Chair +Door +Hatch +Chest +glass bottle +bucket +workbench +Scafolding +Oil Lamp +Candelobra +Mirror +Brazier +Paper +Paint +Cabinet +Millstone +Sharpening stone + + + + + + +Skill enhancing clothing/items - used for promoting? + +spike shooes /crampon +archer glove +smith apron +hand saw +Compass +Lantern +Fishing rod +Fishing net +Holy Symbol + + +Promotion Equipment - used to specialize a dwarf down the profession tree + +Cloth vestments - Worshipper +Book/Papper, quil - Thinker +Helm/Armor - Fighter +Tools - Crafter +Pick Malot ? - Builder +??? - Laborer +Basket, cloak - Gatherer + +Medicine + +Tonic - general use for mild sickness, boyd part specific, Heart tonic, liver tonic, kidney tonic \ No newline at end of file diff --git a/src/Data/Types/AnimationGroupData.java b/src/Data/Types/AnimationGroupData.java new file mode 100644 index 0000000..209d351 --- /dev/null +++ b/src/Data/Types/AnimationGroupData.java @@ -0,0 +1,41 @@ +/* Copyright 2010 Kenneth 'Impaler' Ferland + +This file is part of Khazad. + +Khazad is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Khazad is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Khazad. If not, see */ + +package Data.Types; + +import Data.DataBase; +import Data.DataLibrary; +import nu.xom.Element; + +/** + * + * @author Impaler + */ +public class AnimationGroupData extends DataBase { + + public AnimationGroupData() { + + } + + public boolean LoadData(Element ColorEntry, DataLibrary Library) { + return true; + } + + public boolean PostProcessing() { + return true; + } +} diff --git a/src/Data/Types/AnimationTypeData.java b/src/Data/Types/AnimationTypeData.java new file mode 100644 index 0000000..51926c7 --- /dev/null +++ b/src/Data/Types/AnimationTypeData.java @@ -0,0 +1,42 @@ +/* Copyright 2010 Kenneth 'Impaler' Ferland + +This file is part of Khazad. + +Khazad is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Khazad is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Khazad. If not, see */ + +package Data.Types; + +import Data.DataBase; +import Data.DataLibrary; +import Data.DataManager; +import nu.xom.Element; + +/** + * + * @author Impaler + */ +public class AnimationTypeData extends DataBase { + + public AnimationTypeData() { + + } + + public boolean LoadData(Element ColorEntry, DataLibrary Library) { + return true; + } + + public boolean PostProcessing() { + return true; + } +} diff --git a/src/Data/Types/BuildingData.java b/src/Data/Types/BuildingData.java new file mode 100644 index 0000000..ad02e4b --- /dev/null +++ b/src/Data/Types/BuildingData.java @@ -0,0 +1,41 @@ +/* Copyright 2010 Kenneth 'Impaler' Ferland + +This file is part of Khazad. + +Khazad is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Khazad is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Khazad. If not, see */ + +package Data.Types; + +import Data.DataBase; +import Data.DataLibrary; +import nu.xom.Element; + +/** + * + * @author Impaler + */ +public class BuildingData extends DataBase { + + public BuildingData() { + + } + + public boolean LoadData(Element ColorEntry, DataLibrary Library) { + return true; + } + + public boolean PostProcessing() { + return true; + } +} diff --git a/src/Data/Types/FontData.java b/src/Data/Types/FontData.java new file mode 100644 index 0000000..91d42cc --- /dev/null +++ b/src/Data/Types/FontData.java @@ -0,0 +1,41 @@ +/* Copyright 2010 Kenneth 'Impaler' Ferland + +This file is part of Khazad. + +Khazad is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Khazad is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Khazad. If not, see */ + +package Data.Types; + +import Data.DataBase; +import Data.DataLibrary; +import nu.xom.Element; + +/** + * + * @author Impaler + */ +public class FontData extends DataBase { + + public FontData() { + + } + + public boolean LoadData(Element ColorEntry, DataLibrary Library) { + return true; + } + + public boolean PostProcessing() { + return true; + } +} diff --git a/src/Data/Types/MaterialClassData.java b/src/Data/Types/MaterialClassData.java new file mode 100644 index 0000000..3dbc844 --- /dev/null +++ b/src/Data/Types/MaterialClassData.java @@ -0,0 +1,41 @@ +/* Copyright 2010 Kenneth 'Impaler' Ferland + +This file is part of Khazad. + +Khazad is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Khazad is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Khazad. If not, see */ + +package Data.Types; + +import Data.DataBase; +import Data.DataLibrary; +import nu.xom.Element; + +/** + * + * @author Impaler + */ +public class MaterialClassData extends DataBase { + + public MaterialClassData() { + + } + + public boolean LoadData(Element ColorEntry, DataLibrary Library) { + return true; + } + + public boolean PostProcessing() { + return true; + } +} diff --git a/src/Data/Types/MaterialData.java b/src/Data/Types/MaterialData.java new file mode 100644 index 0000000..b751382 --- /dev/null +++ b/src/Data/Types/MaterialData.java @@ -0,0 +1,41 @@ +/* Copyright 2010 Kenneth 'Impaler' Ferland + +This file is part of Khazad. + +Khazad is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Khazad is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Khazad. If not, see */ + +package Data.Types; + +import Data.DataBase; +import Data.DataLibrary; +import nu.xom.Element; + +/** + * + * @author Impaler + */ +public class MaterialData extends DataBase { + + public MaterialData() { + + } + + public boolean LoadData(Element ColorEntry, DataLibrary Library) { + return true; + } + + public boolean PostProcessing() { + return true; + } +} diff --git a/src/Data/Types/ModelData.java b/src/Data/Types/ModelData.java new file mode 100644 index 0000000..61cdff1 --- /dev/null +++ b/src/Data/Types/ModelData.java @@ -0,0 +1,41 @@ +/* Copyright 2010 Kenneth 'Impaler' Ferland + +This file is part of Khazad. + +Khazad is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Khazad is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Khazad. If not, see */ + +package Data.Types; + +import Data.DataBase; +import Data.DataLibrary; +import nu.xom.Element; + +/** + * + * @author Impaler + */ +public class ModelData extends DataBase { + + public ModelData() { + + } + + public boolean LoadData(Element ColorEntry, DataLibrary Library) { + return true; + } + + public boolean PostProcessing() { + return true; + } +} diff --git a/src/Data/Types/SurfaceTypeData.java b/src/Data/Types/SurfaceTypeData.java new file mode 100644 index 0000000..2cabebf --- /dev/null +++ b/src/Data/Types/SurfaceTypeData.java @@ -0,0 +1,41 @@ +/* Copyright 2010 Kenneth 'Impaler' Ferland + +This file is part of Khazad. + +Khazad is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Khazad is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Khazad. If not, see */ + +package Data.Types; + +import Data.DataBase; +import Data.DataLibrary; +import nu.xom.Element; + +/** + * + * @author Impaler + */ +public class SurfaceTypeData extends DataBase { + + public SurfaceTypeData() { + + } + + public boolean LoadData(Element ColorEntry, DataLibrary Library) { + return true; + } + + public boolean PostProcessing() { + return true; + } +} diff --git a/src/Data/Types/TextureData.java b/src/Data/Types/TextureData.java new file mode 100644 index 0000000..fbf3da3 --- /dev/null +++ b/src/Data/Types/TextureData.java @@ -0,0 +1,41 @@ +/* Copyright 2010 Kenneth 'Impaler' Ferland + +This file is part of Khazad. + +Khazad is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Khazad is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Khazad. If not, see */ + +package Data.Types; + +import Data.DataBase; +import Data.DataLibrary; +import nu.xom.Element; + +/** + * + * @author Impaler + */ +public class TextureData extends DataBase { + + public TextureData() { + + } + + public boolean LoadData(Element ColorEntry, DataLibrary Library) { + return true; + } + + public boolean PostProcessing() { + return true; + } +} diff --git a/src/Data/Types/TextureGridData.java b/src/Data/Types/TextureGridData.java new file mode 100644 index 0000000..299fb31 --- /dev/null +++ b/src/Data/Types/TextureGridData.java @@ -0,0 +1,41 @@ +/* Copyright 2010 Kenneth 'Impaler' Ferland + +This file is part of Khazad. + +Khazad is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Khazad is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Khazad. If not, see */ + +package Data.Types; + +import Data.DataBase; +import Data.DataLibrary; +import nu.xom.Element; + +/** + * + * @author Impaler + */ +public class TextureGridData extends DataBase { + + public TextureGridData() { + + } + + public boolean LoadData(Element ColorEntry, DataLibrary Library) { + return true; + } + + public boolean PostProcessing() { + return true; + } +} diff --git a/src/Data/Types/TextureSheetData.java b/src/Data/Types/TextureSheetData.java new file mode 100644 index 0000000..c2591e4 --- /dev/null +++ b/src/Data/Types/TextureSheetData.java @@ -0,0 +1,41 @@ +/* Copyright 2010 Kenneth 'Impaler' Ferland + +This file is part of Khazad. + +Khazad is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Khazad is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Khazad. If not, see */ + +package Data.Types; + +import Data.DataBase; +import Data.DataLibrary; +import nu.xom.Element; + +/** + * + * @author Impaler + */ +public class TextureSheetData extends DataBase { + + public TextureSheetData() { + + } + + public boolean LoadData(Element ColorEntry, DataLibrary Library) { + return true; + } + + public boolean PostProcessing() { + return true; + } +} diff --git a/src/Data/Types/TreeData.java b/src/Data/Types/TreeData.java new file mode 100644 index 0000000..98bf506 --- /dev/null +++ b/src/Data/Types/TreeData.java @@ -0,0 +1,41 @@ +/* Copyright 2010 Kenneth 'Impaler' Ferland + +This file is part of Khazad. + +Khazad is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Khazad is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Khazad. If not, see */ + +package Data.Types; + +import Data.DataBase; +import Data.DataLibrary; +import nu.xom.Element; + +/** + * + * @author Impaler + */ +public class TreeData extends DataBase { + + public TreeData() { + + } + + public boolean LoadData(Element ColorEntry, DataLibrary Library) { + return true; + } + + public boolean PostProcessing() { + return true; + } +} diff --git a/src/Renderer/PathingRenderer.java b/src/Renderer/PathingRenderer.java new file mode 100644 index 0000000..57a120f --- /dev/null +++ b/src/Renderer/PathingRenderer.java @@ -0,0 +1,219 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package Renderer; + +import Game.Game; + +import Map.Axis; +import Map.Cell; +import Map.CellCoordinate; +import Map.Direction; +import Map.GameMap; +import Map.MapCoordinate; + +import PathFinding.PathFinding; +import PathFinding.MovementModality; + +import com.jme3.app.Application; +import com.jme3.app.SimpleApplication; +import com.jme3.app.state.AbstractAppState; +import com.jme3.app.state.AppStateManager; +import com.jme3.asset.AssetManager; + +import com.jme3.input.KeyInput; +import com.jme3.input.controls.ActionListener; +import com.jme3.input.controls.KeyTrigger; +import com.jme3.input.InputManager; + +import com.jme3.material.Material; +import com.jme3.math.ColorRGBA; +import com.jme3.math.Vector3f; + +import com.jme3.scene.Spatial; +import com.jme3.scene.Geometry; +import com.jme3.scene.Mesh; +import com.jme3.scene.Node; +import com.jme3.scene.VertexBuffer; +import com.jme3.util.BufferUtils; + +import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; +import java.util.BitSet; +import java.util.ArrayList; + +import jme3tools.optimize.GeometryBatchFactory; + + +/** + * + * @author Impaler + */ +public class PathingRenderer extends AbstractAppState implements ActionListener { + + SimpleApplication app = null; + AppStateManager state = null; + AssetManager assetmanager = null; + + Game game; + PathFinding Pathing; + Node PathingNode; + + HashMap cells; + HashMap ZoneMaterials; + + boolean DisplayToggle = false; + + Vector3f [] vertices; + + @Override + public void initialize(AppStateManager stateManager, Application app) { + super.initialize(stateManager, app); + this.app = (SimpleApplication) app; + this.state = stateManager; + this.assetmanager = app.getAssetManager(); + + this.vertices = new Vector3f[Direction.ANGULAR_DIRECTIONS.length]; + + for (int i = 0; i < Direction.ANGULAR_DIRECTIONS.length; i++) { + Direction dir = Direction.ANGULAR_DIRECTIONS[i]; + vertices[i] = new Vector3f(dir.ValueonAxis(Axis.AXIS_X) * MapCoordinate.HALFCUBE, dir.ValueonAxis(Axis.AXIS_Y) * MapCoordinate.HALFCUBE, dir.ValueonAxis(Axis.AXIS_Z) * MapCoordinate.HALFCUBE); + } + registerWithInput(app.getInputManager()); + } + + public void attachToGame(Game TargetGame) { + this.game = TargetGame; + + PathingNode = new Node(); + this.app.getRootNode().attachChild(PathingNode); + + this.Pathing = PathFinding.getSinglton(); + ZoneMaterials = new HashMap(); + } + + public void onAction(String name, boolean keyPressed, float tpf) { + if (this.isEnabled()) { + if (name.equals("PathingRenderToggle") && keyPressed) { + DisplayToggle = !DisplayToggle; + } + } + } + + public void registerWithInput(InputManager inputManager) { + String[] inputs = {"PathingRenderToggle"}; + + inputManager.addMapping("PathingRenderToggle", new KeyTrigger(KeyInput.KEY_P)); + inputManager.addListener(this, inputs); + } + + public Node BuildRendering(Cell TargetCell) { + Mesh EdgeWires = new Mesh(); + EdgeWires.setMode(Mesh.Mode.Lines); + EdgeWires.setLineWidth(5); + + Node PathRenderingNode = new Node(); + MovementModality Mod = new MovementModality(MovementModality.MovementType.WALK_MOVEMENT, 1, 1); + + CellCoordinate CellCoords = TargetCell.getCellCoordinates(); + + for (int x = 0; x < MapCoordinate.CELLEDGESIZE; x++) { + for (int y = 0; y < MapCoordinate.CELLEDGESIZE; y++) { + + MapCoordinate Coords = new MapCoordinate(CellCoords, x, y); + BitSet Connectivity = Pathing.getDirectionFlags(Coords, Mod); + + int Zone = Pathing.getConnectivityZone(Coords, Mod); + Material mat = ZoneMaterials.get(Zone); + if (mat == null) { + mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); + mat.setColor("Color", ColorRGBA.randomColor()); + ZoneMaterials.put(Zone, mat); + } + + if (Connectivity.cardinality() > 0) { + ArrayList Indexes = new ArrayList(); + for (int i = 0; i < Direction.ANGULAR_DIRECTIONS.length; i++) { + if (Pathing.getEdgeCost(Coords, Direction.ANGULAR_DIRECTIONS[i], Mod) != -1) { + Indexes.add(0); + Indexes.add(i); + } + } + + int [] indexes = new int[Indexes.size()]; + for (int i = 0; i < Indexes.size(); i++) { + indexes[i] = Indexes.get(i).intValue(); + } + + EdgeWires.setBuffer(VertexBuffer.Type.Position, 3, BufferUtils.createFloatBuffer(vertices)); + EdgeWires.setBuffer(VertexBuffer.Type.Index, 3, BufferUtils.createIntBuffer(indexes)); + EdgeWires.updateBound(); + + Geometry Wires = new Geometry("Connection Wires", EdgeWires); + Wires.setLocalTranslation(new Vector3f(x, y, 0)); + Wires.setMaterial(mat); + PathRenderingNode.attachChild(Wires); + } + } + } + + GeometryBatchFactory.optimize(PathRenderingNode, true); + if (PathRenderingNode.getQuantity() > 0) { + Spatial ConnectionRendering = PathRenderingNode.getChild(0); + PathRenderingNode.setName("Connection Rendering" + CellCoords.toString()); + return PathRenderingNode; + } else { + return null; + } + } + + public void RebuildDirtyCells(ConcurrentHashMap cells) { + for (Cell target : cells.values()) { + CellCoordinate Coords = target.getCellCoordinates(); + + TerrainRenderer Terrain = state.getState(TerrainRenderer.class); + Node CellNode = Terrain.getCellNodeLight(Coords); + Spatial ConnectivityNode = CellNode.getChild("Connection Rendering" + Coords.toString()); + + if (target.isPathingRenderingDirty()) { + Node NewConnectivity = BuildRendering(target); + if (ConnectivityNode != null) + CellNode.detachChild(ConnectivityNode); + if (NewConnectivity != null) { + CellNode.attachChild(NewConnectivity); + } + target.setDirtyPathingRendering(false); + } + + if (ConnectivityNode != null) { + ConnectivityNode.setCullHint(Spatial.CullHint.Never); + } + } + } + + void HideConnectivityRendering(ConcurrentHashMap cells) { + for (Cell target : cells.values()) { + CellCoordinate Coords = target.getCellCoordinates(); + TerrainRenderer Terrain = state.getState(TerrainRenderer.class); + Node CellNode = Terrain.getCellNodeLight(Coords); + Spatial ConnectivityNode = CellNode.getChild("Connection Rendering" + Coords.toString()); + + if (ConnectivityNode != null) { + ConnectivityNode.setCullHint(Spatial.CullHint.Always); + } + } + } + + @Override + public void update(float tpf) { + if (state.getState(Game.class) != null) { + GameMap map = this.game.getMap(); + if (DisplayToggle) { + RebuildDirtyCells(map.getCellMap()); + } else { + HideConnectivityRendering(map.getCellMap()); + } + } + } +}