Separated anatomy from org / made species tracker
This commit is contained in:
@@ -199,6 +199,7 @@ class ControlPanel {
|
||||
case "drop-org":
|
||||
self.setMode(Modes.Clone);
|
||||
self.env_controller.org_to_clone = self.engine.organism_editor.getCopyOfOrg();
|
||||
self.env_controller.make_new_species = true;
|
||||
break;
|
||||
case "drag-view":
|
||||
self.setMode(Modes.Drag);
|
||||
|
||||
@@ -26,7 +26,7 @@ class EditorController extends CanvasController{
|
||||
mouseUp(){}
|
||||
|
||||
getCurLocalCell(){
|
||||
return this.env.organism.getLocalCell(this.mouse_c-this.env.organism.c, this.mouse_r-this.env.organism.r);
|
||||
return this.env.organism.anatomy.getLocalCell(this.mouse_c-this.env.organism.c, this.mouse_r-this.env.organism.r);
|
||||
}
|
||||
|
||||
editOrganism() {
|
||||
@@ -49,7 +49,7 @@ class EditorController extends CanvasController{
|
||||
}
|
||||
|
||||
updateDetails() {
|
||||
$('.cell-count').text("Cell count: "+this.env.organism.cells.length);
|
||||
$('.cell-count').text("Cell count: "+this.env.organism.anatomy.cells.length);
|
||||
}
|
||||
|
||||
defineCellTypeSelection() {
|
||||
@@ -111,7 +111,7 @@ class EditorController extends CanvasController{
|
||||
this.clearDetailsPanel();
|
||||
var org = this.env.organism;
|
||||
|
||||
$('.cell-count').text("Cell count: "+org.cells.length);
|
||||
$('.cell-count').text("Cell count: "+org.anatomy.cells.length);
|
||||
$('#move-range').text("Move Range: "+org.move_range);
|
||||
$('#mutation-rate').text("Mutation Rate: "+org.mutability);
|
||||
if (Hyperparams.useGlobalMutability) {
|
||||
@@ -134,7 +134,7 @@ class EditorController extends CanvasController{
|
||||
this.clearDetailsPanel();
|
||||
var org = this.env.organism;
|
||||
|
||||
$('.cell-count').text("Cell count: "+org.cells.length);
|
||||
$('.cell-count').text("Cell count: "+org.anatomy.cells.length);
|
||||
if (this.setMoveRangeVisibility()){
|
||||
$('#move-range-edit').val(org.move_range);
|
||||
}
|
||||
@@ -149,7 +149,7 @@ class EditorController extends CanvasController{
|
||||
|
||||
setBrainPanelVisibility() {
|
||||
var org = this.env.organism;
|
||||
if (org.has_eyes && org.is_mover) {
|
||||
if (org.anatomy.has_eyes && org.anatomy.is_mover) {
|
||||
$('.brain-details').css('display', 'block');
|
||||
return true;
|
||||
}
|
||||
@@ -175,7 +175,7 @@ class EditorController extends CanvasController{
|
||||
|
||||
setMoveRangeVisibility() {
|
||||
var org = this.env.organism;
|
||||
if (org.is_mover) {
|
||||
if (org.anatomy.is_mover) {
|
||||
$('#move-range-cont').css('display', 'block');
|
||||
$('#move-range').css('display', 'block');
|
||||
return true;
|
||||
|
||||
@@ -3,12 +3,15 @@ const Organism = require('../Organism/Organism');
|
||||
const Modes = require("./ControlModes");
|
||||
const CellStates = require("../Organism/Cell/CellStates");
|
||||
const Neighbors = require("../Grid/Neighbors");
|
||||
const FossilRecord = require("../Stats/FossilRecord");
|
||||
|
||||
class EnvironmentController extends CanvasController{
|
||||
constructor(env, canvas) {
|
||||
super(env, canvas);
|
||||
this.mode = Modes.Drag;
|
||||
this.org_to_clone = null;
|
||||
this.species_to_clone = null;
|
||||
this.make_new_species = false;
|
||||
this.defineZoomControls();
|
||||
this.scale = 1;
|
||||
}
|
||||
@@ -118,6 +121,14 @@ class EnvironmentController extends CanvasController{
|
||||
case Modes.Clone:
|
||||
if (this.org_to_clone != null){
|
||||
var new_org = new Organism(this.mouse_c, this.mouse_r, this.env, this.org_to_clone);
|
||||
if (this.make_new_species){
|
||||
this.species_to_clone = FossilRecord.addSpecies(new_org, null)
|
||||
this.make_new_species = false;
|
||||
}
|
||||
else {
|
||||
new_org.species = this.species_to_clone;
|
||||
this.species_to_clone.addPop();
|
||||
}
|
||||
if (new_org.isClear(this.mouse_c, this.mouse_r)){
|
||||
this.env.addOrganism(new_org)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user