Skip to content

Commit

Permalink
Thrive chunk improvements and GUI changes (Revolutionary-Games#779)
Browse files Browse the repository at this point in the history
* Added sapwned in chunks of detritus to abyss, seafloor and mesopelagic

* Added some new properties for chunks (damages, and deleteOnTouch (for bubbles and toxins))

* renamed the iron material and everything associated with it to engulfableMaterial so that it makes more sense

* added damage on touch component and such

* ice chunks now damage you properly added stuff so we can have several chunks that damage you , going to move toxins to the new system next

* reduced damage ice chunks do, Rolled floating toxins into new chunk system, added marine snow in the hydrothermal vent, toxins are more prevalent in the cave biome, and iron is more common in the cave biome.

* Flagell no longer automatically turn off until you actually legitimately have no energy left

* fixed typo

* Made some more changes to make things make more sense, theres still cases wher eyou are generating just enouh atp every millisecond to stay alive but shouldnt that be allowed?

* flagella now cost 7.1 ATP per second

* osmoregulation now happens before movement and ATP damage

* Added nicks new tooltips and cleane dup his tooltip code aswell, anf fixed a few bugs with it

* fixed some minor issues

* fixed clang issues
  • Loading branch information
Untrustedlife authored and hhyyrylainen committed Apr 24, 2019
1 parent 7a26352 commit bd5712f
Show file tree
Hide file tree
Showing 17 changed files with 916 additions and 202 deletions.
314 changes: 312 additions & 2 deletions scripts/SimulationParameters/MicrobeStage/Biomes.json

Large diffs are not rendered by default.

327 changes: 239 additions & 88 deletions scripts/gui/thrive_gui.html

Large diffs are not rendered by default.

128 changes: 118 additions & 10 deletions scripts/gui/thrive_style.css
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ video {
.tooltiptext .compoundIcon {
position: relative;
display: inline-block;
top: 5px;
top: 4px;
left: 1px;
}

Expand Down Expand Up @@ -1190,30 +1190,54 @@ video {
background-image: url("../../Textures/gui/bevel/CytoplasmIcon.png");
}

/* Tooltip text */
.tooltiptext {
/* TOOLTIP ENTRIES */

/* The following few entries are for elements regarding tooltips. */

/* Used to place the headers as a second, transparent background tooltip on top of the actual text containing tooltip. This way the headers can be center aligned while the rest of the tooltip is left aligned. */

.tooltipheader {
visibility: hidden;
width: 320px;
width: 400px;
height: 30%;
right: 5%;
top: 10%;
font-size: 10pt;
background-color: rgba(0, 139, 139, 0.5);
background-color: rgba(0, 89, 89, 0);
color: #fff;
text-align: center-left;
text-align: center;
border-radius: 25px;
padding: 5px 0;
padding: 20px 20px 20px 20px;
position: fixed;
z-index: 1;
font-size: 190%;
}

.OrganelleListItem:hover .tooltipheader {
visibility: visible;
}

/* Regular tooltip text aside from the header. */

.tooltiptext {
visibility: hidden;
width: 400px;
height: auto;
right: 5%;
top: 10%;
background-color: rgba(0, 89, 89, 0.75);
border-radius: 25px;
padding: 20px 20px 20px 20px;
position: fixed;
z-index: 1;
color: #d3d3d3;
text-align: left;
font-size: 190%;
}

.OrganelleListItem:hover .tooltiptext {
visibility: visible;
}


#PlastidIcon {
position: relative;
left: calc(50% - 30px);
Expand Down Expand Up @@ -1262,6 +1286,12 @@ video {
background-image: url("../../Textures/gui/bevel/VacuoleIcon.png");
}

/* Used to place the vacuole's icon inside tooltips as an icon for storage. */

#VacuoleTooltipIcon {
background-image: url("../../Textures/gui/bevel/VacuoleIcon.png");
}

#ToxinVacuoleIcon {
position: relative;
left: calc(50% - 30px);
Expand Down Expand Up @@ -1299,6 +1329,12 @@ video {
background-image: url("../../Textures/gui/bevel/FlagellumIcon.png");
}

/* Used to place the flagellum's icon inside tooltips as an icon for storage. */

#FlagellumTooltipIcon {
background-image: url("../../Textures/gui/bevel/FlagellumIcon.png");
}

#MetabolosomeIcon {
position: relative;
left: calc(50% - 30px);
Expand All @@ -1317,7 +1353,6 @@ video {
background-image: url("../../Textures/gui/bevel/NitrogenaseIcon.png");
}


#ChromatophorIcon {
position: relative;
left: calc(50% - 30px);
Expand Down Expand Up @@ -1362,3 +1397,76 @@ video {
background-size: contain;
background-image: url("../../Textures/gui/bevel/CiliaIcon.png");
}

/* Used in formulas in tooltips. */

#WhiteArrow {
background-image: url("../../Textures/gui/bevel/WhiteArrow.png");
}

#TemperatureIcon {
background-image: url("../../Textures/gui/bevel/Temperature.png");
}

#LightIcon {
background-image: url("../../Textures/gui/bevel/Light.png");
}

#PressureIcon {
background-image: url("../../Textures/gui/bevel/Pressure.png");
}

/* Used for the headers of tooltips. */

.thead {
color: white;
font-size: 150%;
font-weight: 1000;
text-align: center;
}

/* Used everytime an input or output is mentioned in the initial blurb of the tooltip. */

.tkey {
color: white;
font-size: 100%;
font-weight: 1000;
}

/* Used for formula names in tooltips. */

.tgold {
color: #ffd700;
font-size: 100%;
font-weight: 1000;
}

/* Used for highlighting beneficial values. */

.tbonus {
color: #0f0;
font-size: 100%;
font-weight: 1000;
}

/* Used for highlighting deleterious values. */

.tmalus {
color: #ff4d4d;
font-size: 100%;
font-weight: 1000;
}

/* Used for the regular text in the initial blurb. */

.tbody {
color: #d3d3d3;
font-size: 100%;
}

/* Used for the scientific description text in the final blurb. */

.tdesc {
color: #d3d3d3;
font-size: 85%;
}
28 changes: 20 additions & 8 deletions scripts/microbe_stage/biome.as
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,10 @@ ObjectID createChunk(CellStageWorld@ world, uint chunkId, Float3 pos)
for(uint i = 0; i < chunkCompounds.length(); ++i){
auto compoundId = SimulationParameters::compoundRegistry().getTypeData(chunkCompounds[i]).id;
//LOG_INFO("got here:");
if(SimulationParameters::compoundRegistry().getTypeData(compoundId).isCloud){
// And register new
const double amount = chunk.getCompound(chunkCompounds[i]).amount;
//LOG_INFO("amount:"+amount);
bag.setCompound(compoundId,amount);
}
// And register new
const double amount = chunk.getCompound(chunkCompounds[i]).amount;
//LOG_INFO("amount:"+amount);
bag.setCompound(compoundId,amount);
}

auto model = world.Create_Model(chunkEntity, renderNode.Node, mesh);
Expand All @@ -126,12 +124,26 @@ ObjectID createChunk(CellStageWorld@ world, uint chunkId, Float3 pos)

// Rigid Body
auto rigidBody = world.Create_Physics(chunkEntity, position);

//chunk properties
if (chunk.damages > 0.0f || chunk.deleteOnTouch){
auto damager = world.Create_DamageOnTouchComponent(chunkEntity);
damager.setDamage(chunk.damages);
damager.setDeletes(chunk.deleteOnTouch);
//Damage
auto body = rigidBody.CreatePhysicsBody(world.GetPhysicalWorld(),
world.GetPhysicalWorld().CreateSphere(radius),mass,
world.GetPhysicalMaterial("chunkDamageMaterial"));

body.ConstraintMovementAxises();
}
else {
auto body = rigidBody.CreatePhysicsBody(world.GetPhysicalWorld(),
world.GetPhysicalWorld().CreateSphere(radius),mass,
//engulfable
world.GetPhysicalMaterial("iron"));

world.GetPhysicalMaterial("engulfableMaterial"));
body.ConstraintMovementAxises();
}

rigidBody.JumpTo(position);

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 @@ -98,7 +98,7 @@ const auto DEFAULT_HEALTH = 100;
const auto REGENERATION_RATE = 1.0f;

// Movement stuff
const auto FLAGELLA_ENERGY_COST = 7.0f;
const auto FLAGELLA_ENERGY_COST = 7.1f;
const auto FLAGELLA_BASE_FORCE = 0.7f;
const auto CELL_BASE_THRUST = 1.6f;
// is set by this and modified by applyCellMovement like the player later
Expand Down
36 changes: 18 additions & 18 deletions scripts/microbe_stage/microbe.as
Original file line number Diff line number Diff line change
Expand Up @@ -377,21 +377,6 @@ class MicrobeSystem : ScriptSystem{
MicrobeOperations::applyMembraneColour(world, microbeEntity);
}
}

microbeComponent.compoundCollectionTimer =
microbeComponent.compoundCollectionTimer + logicTime;

while(microbeComponent.compoundCollectionTimer >
EXCESS_COMPOUND_COLLECTION_INTERVAL)
{
// For every COMPOUND_DISTRIBUTION_INTERVAL passed
microbeComponent.compoundCollectionTimer =
microbeComponent.compoundCollectionTimer -
EXCESS_COMPOUND_COLLECTION_INTERVAL;
MicrobeOperations::purgeCompounds(world, microbeEntity);
atpDamage(microbeEntity);
}

// Handle hitpoints
if((microbeComponent.hitpoints < microbeComponent.maxHitpoints))
{
Expand Down Expand Up @@ -511,10 +496,25 @@ class MicrobeSystem : ScriptSystem{
MicrobeOperations::takeCompound(world, microbeEntity,
SimulationParameters::compoundRegistry().getTypeId("atp"), atpAmount);
}
compoundAbsorberComponent.setAbsorbtionCapacity(microbeComponent.capacity);

microbeComponent.compoundCollectionTimer =
microbeComponent.compoundCollectionTimer + logicTime;

//Moved this to right before atpDamage
applyCellMovement(components, logicTime);

compoundAbsorberComponent.setAbsorbtionCapacity(microbeComponent.capacity);
while(microbeComponent.compoundCollectionTimer >
EXCESS_COMPOUND_COLLECTION_INTERVAL)
{
// For every COMPOUND_DISTRIBUTION_INTERVAL passed
atpDamage(microbeEntity);

microbeComponent.compoundCollectionTimer =
microbeComponent.compoundCollectionTimer -
EXCESS_COMPOUND_COLLECTION_INTERVAL;
MicrobeOperations::purgeCompounds(world, microbeEntity);
}

if(microbeComponent.hitpoints != microbeComponent.previousHitpoints)
membraneComponent.setHealthFraction(microbeComponent.hitpoints / microbeComponent.maxHitpoints);
Expand Down Expand Up @@ -601,7 +601,7 @@ class MicrobeSystem : ScriptSystem{
// Rotate the 'thrust' based on our orientation
// Halve speed if out of ATP
if (MicrobeOperations::getCompoundAmount(world, microbeEntity,
SimulationParameters::compoundRegistry().getTypeId("atp")) <= 1.0){
SimulationParameters::compoundRegistry().getTypeId("atp")) <= 0.0f){
microbeComponent.queuedMovementForce += pos._Orientation.RotateVector(
microbeComponent.movementDirection * (CELL_BASE_THRUST/2.0f) *
microbeComponent.movementFactor);
Expand Down Expand Up @@ -928,7 +928,7 @@ class MicrobeSystem : ScriptSystem{
world.GetScriptComponentHolder("MicrobeComponent").Find(microbeEntity));

if(MicrobeOperations::getCompoundAmount(world, microbeEntity,
SimulationParameters::compoundRegistry().getTypeId("atp")) < 1.0f)
SimulationParameters::compoundRegistry().getTypeId("atp")) <= 0.0f)
{
// TODO: put this on a GUI notification.
// if(microbeComponent.isPlayerMicrobe and not this.playerAlreadyShownAtpDamage){
Expand Down
2 changes: 1 addition & 1 deletion scripts/microbe_stage/microbe_operations.as
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ void kill(CellStageWorld@ world, ObjectID microbeEntity)
auto body = rigidBody.CreatePhysicsBody(world.GetPhysicalWorld(),
world.GetPhysicalWorld().CreateSphere(1), 10,
//engulfable
world.GetPhysicalMaterial("iron"));
world.GetPhysicalMaterial("engulfableMaterial"));
body.ConstraintMovementAxises();
rigidBody.JumpTo(chunkPosition);
auto venter = world.Create_CompoundVenterComponent(chunkEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class MovementOrganelle : OrganelleComponent{
microbeEntity, SimulationParameters::compoundRegistry().getTypeId("atp"),
energy);

if(availableEnergy < energy){
if(availableEnergy <= 0.0f){
forceMagnitude = sign(forceMagnitude) * availableEnergy * 1000.f /
milliseconds;
this.movingTail = false;
Expand Down
Loading

0 comments on commit bd5712f

Please sign in to comment.