upping the examples!

sdl
Marcus 2021-05-09 23:23:18 -04:00
parent 16c4133bf6
commit 1a1a0c0c62
2 changed files with 24 additions and 2 deletions

View File

@ -3,10 +3,17 @@ namespace places;
required link world;
link[] roads;
member fertility;
member nitrogen;
restore {
this.fertility ??= Math.floor(Math.random() * 100);
this.nitrogen ??= Math.floor(Math.random() * 50);
}
takeNitrogen (requested) {
// give as much nutrients as we can!
const given = Math.max(this.nitrogen, requested);
this.nitrogen -= given;
return given;
}
ping {

15
test/tree.v 100644
View File

@ -0,0 +1,15 @@
namespace structures;
member alive;
member age;
required link land;
restore {
alive ??= true;
age ??= 0;
}
tick (days) {
}