use of main.entity.obj.Obj in project Eidolons by IDemiurge.
the class LE_TreePlanPanel method blockAdded.
public void blockAdded(MapBlock b) {
DefaultMutableTreeNode blockNode = new DefaultMutableTreeNode(b);
for (Obj o : b.getObjects()) {
blockNode.add(new DefaultMutableTreeNode(o));
}
DefaultMutableTreeNode node = getZoneNodeForBlock(b);
node.insert(blockNode, node.getChildCount() - 1);
return;
}
use of main.entity.obj.Obj in project Eidolons by IDemiurge.
the class LE_TreePlanPanel method initTree.
public void initTree() {
root = new DefaultMutableTreeNode(plan.getDungeon().getName() + " plan");
for (MapZone z : plan.getZones()) {
DefaultMutableTreeNode node = new DefaultMutableTreeNode(z);
root.add(node);
for (MapBlock b : plan.getBlocks()) {
if (b.getType() == BLOCK_TYPE.CORRIDOR) {
// TODO
continue;
}
DefaultMutableTreeNode blockNode = new DefaultMutableTreeNode(b);
node.add(blockNode);
if (b.getObjects() != null) {
for (Obj o : b.getObjects()) {
blockNode.add(new DefaultMutableTreeNode(o));
b.getConnectedBlocks();
}
}
}
root.add(node);
}
setTree(new JTree(root));
tree.setOpaque(false);
tree.setSize(new Dimension(VISUALS.PLAN_PANEL_FRAME.getWidth() - 50, 20 * 32));
getTree().setLargeModel(true);
try {
getTree().setUI(this);
} catch (Exception e) {
// new Thread (
// getTree().setUI(this); ).start()
main.system.ExceptionMaster.printStackTrace(e);
}
getTree().getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
getTree().setCellRenderer(this);
getTree().addTreeSelectionListener(this);
}
use of main.entity.obj.Obj in project Eidolons by IDemiurge.
the class FilterMaster method getUnitsInRadius.
public static List<? extends Entity> getUnitsInRadius(Obj unit, int radius) {
Conditions conditions = new Conditions(ConditionMaster.getAliveFilterCondition(), ConditionMaster.getDistanceFilterCondition("SOURCE", radius, true));
Set<Obj> set = new Filter<Obj>(unit.getRef(), conditions, C_OBJ_TYPE.UNITS_CHARS).getObjects();
return new ArrayList<>(set);
}
use of main.entity.obj.Obj in project Eidolons by IDemiurge.
the class FilterMaster method getCellsInRadius.
public static Set<Obj> getCellsInRadius(Obj centerObj, Integer radius) {
Conditions conditions = new Conditions();
conditions.add(ConditionMaster.getDistanceFilterCondition("SOURCE", radius, true));
conditions.add(new NotCondition(new OccupiedCondition("MATCH")));
Set<Obj> set = new Filter<Obj>(centerObj.getRef(), conditions, DC_TYPE.TERRAIN).getObjects();
return set;
}
use of main.entity.obj.Obj in project Eidolons by IDemiurge.
the class PositionMaster method getClosestCoordinate.
public static Coordinates getClosestCoordinate(Coordinates source_coordinates, List<Obj> objects) {
int distance = Integer.MAX_VALUE;
Coordinates coordinates = null;
for (Obj obj : objects) {
if (distance > getDistance(source_coordinates, obj.getCoordinates())) {
distance = getDistance(source_coordinates, obj.getCoordinates());
coordinates = obj.getCoordinates();
}
}
return coordinates;
}
Aggregations