fixed species/cell stats
This commit is contained in:
@@ -204,7 +204,6 @@ class ControlPanel {
|
||||
if (!env.reset(true, false)) return;
|
||||
let center = env.grid_map.getCenter();
|
||||
let org = this.editor_controller.env.getCopyOfOrg();
|
||||
this.env_controller.add_new_species = true;
|
||||
this.env_controller.dropOrganism(org, center[0], center[1])
|
||||
});
|
||||
$('#save-env').click( () => {
|
||||
@@ -464,8 +463,6 @@ class ControlPanel {
|
||||
|
||||
if (mode == Modes.Clone) {
|
||||
this.env_controller.org_to_clone = this.engine.organism_editor.getCopyOfOrg();
|
||||
this.env_controller.add_new_species = this.editor_controller.new_species;
|
||||
this.editor_controller.new_species = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ const Modes = require("./ControlModes");
|
||||
const CellStates = require("../Organism/Cell/CellStates");
|
||||
const Directions = require("../Organism/Directions");
|
||||
const Hyperparams = require("../Hyperparameters");
|
||||
const Species = require("../Stats/Species");
|
||||
|
||||
class EditorController extends CanvasController{
|
||||
constructor(env, canvas) {
|
||||
@@ -10,7 +11,6 @@ class EditorController extends CanvasController{
|
||||
this.mode = Modes.None;
|
||||
this.edit_cell_type = null;
|
||||
this.highlight_org = false;
|
||||
this.new_species = false;
|
||||
this.defineCellTypeSelection();
|
||||
this.defineEditorDetails();
|
||||
this.defineSaveLoad();
|
||||
@@ -46,7 +46,6 @@ class EditorController extends CanvasController{
|
||||
else if (this.right_click)
|
||||
this.env.removeCellFromOrg(this.mouse_c, this.mouse_r);
|
||||
|
||||
this.new_species = true;
|
||||
this.setBrainPanelVisibility();
|
||||
this.setMoveRangeVisibility();
|
||||
this.updateDetails();
|
||||
@@ -134,6 +133,9 @@ class EditorController extends CanvasController{
|
||||
this.refreshDetailsPanel();
|
||||
this.env.organism.updateGrid();
|
||||
this.env.renderFull();
|
||||
this.env.organism.species = new Species(this.env.organism.anatomy, null, 0);
|
||||
if (org.species_name)
|
||||
this.env.organism.species.name = org.species_name;
|
||||
if (this.mode === Modes.Clone)
|
||||
$('#drop-org').click();
|
||||
// have to clear the value so change() will be triggered if the same file is uploaded again
|
||||
|
||||
@@ -12,7 +12,6 @@ class EnvironmentController extends CanvasController{
|
||||
super(env, canvas);
|
||||
this.mode = Modes.FoodDrop;
|
||||
this.org_to_clone = null;
|
||||
this.add_new_species = false;
|
||||
this.defineZoomControls();
|
||||
this.scale = 1;
|
||||
}
|
||||
@@ -171,15 +170,15 @@ class EnvironmentController extends CanvasController{
|
||||
var new_org = new Organism(col, row, this.env, organism);
|
||||
|
||||
if (new_org.isClear(col, row)) {
|
||||
if (this.add_new_species){
|
||||
let new_species = !FossilRecord.speciesIsExtant(new_org.species.name);
|
||||
if (new_org.species.extinct) {
|
||||
FossilRecord.resurrect(new_org.species);
|
||||
}
|
||||
else if (new_species) {
|
||||
FossilRecord.addSpeciesObj(new_org.species);
|
||||
new_org.species.start_tick = this.env.total_ticks;
|
||||
this.add_new_species = false;
|
||||
new_org.species.population = 0;
|
||||
}
|
||||
else if (this.org_to_clone.species.extinct){
|
||||
FossilRecord.resurrect(this.org_to_clone.species);
|
||||
}
|
||||
|
||||
this.env.addOrganism(new_org);
|
||||
new_org.species.addPop();
|
||||
|
||||
Reference in New Issue
Block a user