Skip to content

Commit

Permalink
Created new unfinished elements
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwijuice56 committed Dec 1, 2023
1 parent acc3465 commit a5b841f
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 3 deletions.
7 changes: 6 additions & 1 deletion extension/elements/all_elements.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@
#include "elements/build/invisirock.h"
#include "elements/life/metal_slime.h"
#include "elements/custom_element.h"
#include "elements/chemical/silver.h"
#include "elements/chemical/molten_silver.h"
#include "elements/chemical/lead.h"

class AllElements {
public:
Expand Down Expand Up @@ -279,7 +282,9 @@ class AllElements {
elements->at(130) = new Turtle();
elements->at(131) = new Invisirock();
elements->at(132) = new MetalSlime();

elements->at(133) = new Silver();
elements->at(134) = new MoltenSilver();
elements->at(135) = new Lead();

for (int i = 2048; i <= 4096; i++) {
elements->at(i) = new CustomElementParticle();
Expand Down
2 changes: 0 additions & 2 deletions extension/elements/chemical/gold.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef GOLD_H
#define GOLD_H



#include "../element.h"

class Gold: public Element {
Expand Down
51 changes: 51 additions & 0 deletions extension/elements/chemical/lead.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#ifndef LEAD_H
#define LEAD_H

#include "../element.h"

class Lead: public Element {
public:
const double PLASMA = 1.0 / 16;
const double MELT = 1.0 / 32;
const double TRANSMUTE = 1.0 / 2;

void process(SandSimulation *sim, int row, int col) override {
if (sim->randf() < PLASMA && (sim->touch_count(row, col, 38) > 0 || sim->touch_count(row, col, 40) > 0 || sim->touch_count(row, col, 115) > 0)) {
sim->grow(row + 1, col, 135, 38);
sim->grow(row - 1, col, 135, 38);
sim->grow(row, col - 1, 135, 38);
sim->grow(row, col + 1, 135, 38);
return;
} else if (sim -> randf() < MELT && (sim->touch_count(row, col, 20) + sim->touch_count(row, col, 24) > 0)) {
sim->set_cell(row, col, 20);
} else if (sim->randf() < TRANSMUTE && sim->touch_count(row, col, 23) > 0) {
sim->set_cell(row, col, 51);
}
}

double get_density() override {
return 90.0;
}

double get_explode_resistance() override {
return 0.64;
}

double get_acid_resistance() override {
return 0.92;
}

int get_state() override {
return 0;
}

int get_temperature() override {
return 0;
}

int get_toxicity() override {
return 1;
}
};

#endif // LEAD_H
55 changes: 55 additions & 0 deletions extension/elements/chemical/molten_silver.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#ifndef MOLTEN_SILVER_H
#define MOLTEN_SILVER_H

#include "../element.h"
#include <stdlib.h>

class MoltenSilver: public Element {
public:
const double MELT = 1.0 / 80;
const double DOWN_BLOCK = 1.0 / 16;
const double DOWN = 1.0 / 1.5;
const double COOL = 1.0 / 128;
const double REG_COOL = 1.0 / 1900;

void process(SandSimulation *sim, int row, int col) override {
// Conductivity
if (sim->randf() < MELT && (sim->touch_count(row, col, 38) > 0 || sim->touch_count(row, col, 40) > 0 || sim->touch_count(row, col, 115) > 0)) {
sim->set_cell(row, col, 38);
return;
}

if (sim->randf() < COOL && (sim->is_cold(row, col) || sim->touch_count(row, col, 0) > 0) || sim->randf() < REG_COOL) {
sim->set_cell(row, col, 133);
return;
}

sim->liquid_process(row, col, 3);
}

double get_density() override {
return 64.0;
}

double get_explode_resistance() override {
return 0.90;
}

double get_acid_resistance() override {
return 0.999;
}

int get_state() override {
return 1;
}

int get_temperature() override {
return 1;
}

int get_toxicity() override {
return 0;
}
};

#endif // MOLTEN_SILVER_H
48 changes: 48 additions & 0 deletions extension/elements/chemical/silver.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#ifndef SILVER_H
#define SILVER_H

#include "../element.h"

class GoSilverld: public Element {
public:
const double PLASMA = 1.0 / 8;
const double MELT = 1.0 / 32;
const double EXPLODE = 1.0 / 90;
void process(SandSimulation *sim, int row, int col) override {
if (sim->randf() < PLASMA && (sim->touch_count(row, col, 38) > 0 || sim->touch_count(row, col, 40) > 0 || sim->touch_count(row, col, 115) > 0)) {
sim->grow(row + 1, col, 133, 38);
sim->grow(row - 1, col, 133, 38);
sim->grow(row, col - 1, 133, 38);
sim->grow(row, col + 1, 133, 38);
return;
} else if (sim -> randf() < MELT && (sim->touch_count(row, col, 20) + sim->touch_count(row, col, 24) > 0)) {
sim->set_cell(row, col, 134);
}
}

double get_density() override {
return 64.0;
}

double get_explode_resistance() override {
return 0.48;
}

double get_acid_resistance() override {
return 0.98;
}

int get_state() override {
return 0;
}

int get_temperature() override {
return 0;
}

int get_toxicity() override {
return 0;
}
};

#endif // SILVER_H
1 change: 1 addition & 0 deletions game/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ limits/debugger/max_errors_per_second=1

[rendering]

renderer/rendering_method="mobile"
renderer/rendering_method.mobile="gl_compatibility"
textures/vram_compression/import_etc2_astc=true
shader_compiler/shader_cache/strip_debug.release=false
Expand Down

0 comments on commit a5b841f

Please sign in to comment.