Skip to content

Commit

Permalink
Large iron chunks now give out more iron ions(compound venter compone…
Browse files Browse the repository at this point in the history
…nt can be customized now), Player cells now start with 3 iron, its now .175 iron for 10 ATP for chemolithotrophy for balance reasons,

disabled log that was happening so often it caused lag

Labled parts of name mutator so its easier to understand.
  • Loading branch information
Untrustedlife authored and hhyyrylainen committed Feb 15, 2019
1 parent 571bdac commit ae6bd68
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@

"inputs": {
"carbondioxide": 0.09,
"iron": 0.5
"iron": 0.175
},

"outputs": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/microbe_stage/configs.as
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ const dictionary STARTER_MICROBES = {
{"phosphates", InitialCompound(0)},
{"hydrogensulfide", InitialCompound(0)},
{"oxytoxy", InitialCompound(0)},
{"iron", InitialCompound(0)}
{"iron", InitialCompound(3)}
},
{
OrganelleTemplatePlaced("cytoplasm", 0, 0, 0)
Expand Down
3 changes: 2 additions & 1 deletion scripts/microbe_stage/microbe_operations.as
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,8 @@ void playSoundWithDistance(CellStageWorld@ world, const string &in soundPath, Ob
"sound source");
}
} else {
LOG_ERROR("Failed to create sound player");
//this was happening so often it caused lag
//LOG_ERROR("Failed to create sound player");
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions scripts/microbe_stage/setup.as
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,8 @@ ObjectID createIron(CellStageWorld@ world, Float3 pos)
renderNode.Node.setPosition(pos);
string mesh="";
int ironSize = 1;
// 5 is the default
float ironAmount = 3.0f;
// There are four kinds
switch (GetEngine().GetRandom().GetNumber(0, 4))
{
Expand All @@ -650,11 +652,14 @@ ObjectID createIron(CellStageWorld@ world, Float3 pos)
case 4:
mesh="iron_05.mesh";
ironSize=10;
ironAmount=10.0f;
break;
}


world.Create_CompoundVenterComponent(ironEntity);
// So that larger iron chunks give out more compounds
world.GetComponent_CompoundVenterComponent(ironEntity).setVentAmount(ironAmount);
world.Create_CompoundBagComponent(ironEntity);
auto model = world.Create_Model(ironEntity, renderNode.Node, mesh);
// Need to set the tint
Expand Down
9 changes: 9 additions & 0 deletions scripts/microbe_stage/species_system.as
Original file line number Diff line number Diff line change
Expand Up @@ -89,49 +89,58 @@ string mutateWord(string name){
switch (GetEngine().GetRandom().GetNumber(0,5))
{
case 0:
//VC
newVowel = GetEngine().GetRandom().GetNumber(0,vowels.length()-1);
newConsonant = GetEngine().GetRandom().GetNumber(0,consonants.length()-1);
newSyllable= ""+vowels.substr(newVowel, 1)+consonants.substr(newConsonant, 1);
newName.insert(index, newSyllable);
break;
case 1:
//CV
newVowel = GetEngine().GetRandom().GetNumber(0,vowels.length()-1);
newConsonant = GetEngine().GetRandom().GetNumber(0,consonants.length()-1);
newSyllable = ""+consonants.substr(newConsonant, 1)+vowels.substr(newVowel, 1);
newName.insert(index, newSyllable);
break;
case 2:
//CC
newConsonant = GetEngine().GetRandom().GetNumber(0,consonants.length()-1);
newSyllable= ""+original+consonants.substr(newConsonant, 1);
newName.insert(index, newSyllable);
break;
case 3:
//CC
newConsonant = GetEngine().GetRandom().GetNumber(0,consonants.length()-1);
newSyllable = ""+consonants.substr(newConsonant, 1)+original;
newName.insert(index, newSyllable);
break;
case 4:
//CCV
newVowel = GetEngine().GetRandom().GetNumber(0,vowels.length()-1);
newConsonant = GetEngine().GetRandom().GetNumber(0,consonants.length()-1);
newSyllable = original+consonants.substr(newConsonant, 1)+vowels.substr(newVowel, 1);
newName.insert(index, newSyllable);
break;
case 5:
//VCC
newVowel = GetEngine().GetRandom().GetNumber(0,vowels.length()-1);
newConsonant = GetEngine().GetRandom().GetNumber(0,consonants.length()-1);
newSyllable = vowels.substr(newVowel, 1)+consonants.substr(newConsonant, 1)+original;
newName.insert(index, newSyllable);
break;
}
}
// If is vowel
else {
if(GetEngine().GetRandom().GetNumber(0,20) <= 10){
//CVV
int newConsonant = GetEngine().GetRandom().GetNumber(0,consonants.length()-1);
int newVowel = GetEngine().GetRandom().GetNumber(0,vowels.length()-1);
string newSyllable = ""+consonants.substr(newConsonant, 1)+vowels.substr(newVowel, 1)+original;
newName.insert(index, newSyllable);
}
else {
//VVC
int newConsonant = GetEngine().GetRandom().GetNumber(0,consonants.length()-1);
int newVowel = GetEngine().GetRandom().GetNumber(0,vowels.length()-1);
string newSyllable = ""+original+vowels.substr(newVowel, 1)+consonants.substr(newConsonant, 1);
Expand Down
18 changes: 15 additions & 3 deletions src/microbe_stage/compound_venter_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ void
CompoundVenterComponent& venter = std::get<1>(*value.second);
Leviathan::Position& position = std::get<2>(*value.second);
venter.ventCompound(position,
SimulationParameters::compoundRegistry.getTypeId("iron"), 5,
world);
SimulationParameters::compoundRegistry.getTypeId("iron"),
venter.ventAmount, world);
}
}
}
Expand All @@ -51,5 +51,17 @@ void
CellStageWorld& world)
{
world.GetCompoundCloudSystem().addCloud(
compound, amount * 1000, pos.Members._Position);
compound, amount * 1000.0f, pos.Members._Position);
}

void
CompoundVenterComponent::setVentAmount(float amount)
{
this->ventAmount = amount;
}

float
CompoundVenterComponent::getVentAmount()
{
return this->ventAmount;
}
8 changes: 7 additions & 1 deletion src/microbe_stage/compound_venter_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CompoundVenterComponent : public Leviathan::Component {
CompoundVenterComponent();

float x, y;

float ventAmount = 5.0f;
REFERENCE_HANDLE_UNCOUNTED_TYPE(CompoundVenterComponent);

static constexpr auto TYPE =
Expand All @@ -32,6 +32,12 @@ class CompoundVenterComponent : public Leviathan::Component {
CompoundId ourCompound,
double amount,
CellStageWorld& world);

void
setVentAmount(float amount);

float
getVentAmount();
};

class CompoundVenterSystem
Expand Down
13 changes: 13 additions & 0 deletions src/scripting/script_initializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,19 @@ bool
engine, "CompoundVenterComponent", &CompoundVenterTYPEProxy))
return false;

if(engine->RegisterObjectMethod("CompoundVenterComponent",
"float getVentAmount()",
asMETHOD(CompoundVenterComponent, getVentAmount),
asCALL_THISCALL) < 0) {
ANGELSCRIPT_REGISTERFAIL;
}

if(engine->RegisterObjectMethod("CompoundVenterComponent",
"void setVentAmount(float amount)",
asMETHOD(CompoundVenterComponent, setVentAmount),
asCALL_THISCALL) < 0) {
ANGELSCRIPT_REGISTERFAIL;
}
// ------------------------------------ //
if(engine->RegisterObjectType(
"SpawnedComponent", 0, asOBJ_REF | asOBJ_NOCOUNT) < 0) {
Expand Down

0 comments on commit ae6bd68

Please sign in to comment.