Randomized Creature Generation
Adds a random organism generator that is accessible through the editor control panel. This generator gives the user to generate an entire world of random organisms for selection to act upon.
This commit is contained in:
@@ -122,21 +122,7 @@ 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.add_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);
|
||||
}
|
||||
|
||||
if (new_org.isClear(this.mouse_c, this.mouse_r)){
|
||||
this.env.addOrganism(new_org);
|
||||
new_org.species.addPop();
|
||||
}
|
||||
this.dropOrganism(this.org_to_clone, this.mouse_c, this.mouse_r);
|
||||
}
|
||||
break;
|
||||
case Modes.Drag:
|
||||
@@ -151,6 +137,26 @@ class EnvironmentController extends CanvasController{
|
||||
}
|
||||
}
|
||||
|
||||
dropOrganism(organism, col, row) {
|
||||
|
||||
// close the organism and drop it in the world
|
||||
var new_org = new Organism(col, row, this.env, organism);
|
||||
if (this.add_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);
|
||||
}
|
||||
|
||||
if (new_org.isClear(this.mouse_c, this.mouse_r)){
|
||||
this.env.addOrganism(new_org);
|
||||
new_org.species.addPop();
|
||||
}
|
||||
}
|
||||
|
||||
dropCellType(col, row, state, killBlocking=false) {
|
||||
for (var loc of Neighbors.allSelf){
|
||||
var c=col + loc[0];
|
||||
|
||||
Reference in New Issue
Block a user