Open source Star Ruler 2 source code!
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import cargo;
|
||||
|
||||
tidy class Cargo : CargoStorage, Component_Cargo {
|
||||
void getCargo() {
|
||||
yield(this);
|
||||
}
|
||||
|
||||
double get_cargoCapacity() {
|
||||
return capacity;
|
||||
}
|
||||
|
||||
double get_cargoStored() {
|
||||
return filled;
|
||||
}
|
||||
|
||||
double getCargoStored(uint typeId) {
|
||||
auto@ type = getCargoType(typeId);
|
||||
if(type is null)
|
||||
return -1.0;
|
||||
return get(type);
|
||||
}
|
||||
|
||||
uint get_cargoTypes() {
|
||||
if(types is null)
|
||||
return 0;
|
||||
return types.length;
|
||||
}
|
||||
|
||||
uint get_cargoType(uint index) {
|
||||
if(types is null)
|
||||
return uint(-1);
|
||||
if(index >= types.length)
|
||||
return uint(-1);
|
||||
return types[index].id;
|
||||
}
|
||||
|
||||
void readCargo(Message& msg) {
|
||||
msg >> this;
|
||||
}
|
||||
|
||||
void readCargoDelta(Message& msg) {
|
||||
readCargo(msg);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user