mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-25 01:06:04 +02:00
pavg0 / pavg1 properties can be set through the console and prop
This commit is contained in:
@@ -74,6 +74,12 @@ int CommandInterface::GetPropertyOffset(std::string key_, FormatType & format)
|
||||
} else if (strcmp(key, "dcolor")==0){
|
||||
offset = offsetof(Particle, dcolour);
|
||||
format = FormatInt;
|
||||
} else if (!strcmp(key, "pavg0")){
|
||||
offset = offsetof(Particle, pavg[0]);
|
||||
format = FormatFloat;
|
||||
} else if (!strcmp(key, "pavg1")){
|
||||
offset = offsetof(Particle, pavg[1]);
|
||||
format = FormatFloat;
|
||||
} else {
|
||||
offset = -1;
|
||||
}
|
||||
|
@@ -146,6 +146,12 @@ int luacon_particle_getproperty(const char * key, int * format)
|
||||
} else if (!strcmp(key, "dcolor")) {
|
||||
offset = offsetof(Particle, dcolour);
|
||||
*format = 0;
|
||||
} else if (!strcmp(key, "pavg0")) {
|
||||
offset = offsetof(Particle, pavg[0]);
|
||||
*format = 1;
|
||||
} else if (!strcmp(key, "pavg1")) {
|
||||
offset = offsetof(Particle, pavg[1]);
|
||||
*format = 1;
|
||||
} else {
|
||||
offset = -1;
|
||||
}
|
||||
|
@@ -16,5 +16,7 @@ std::vector<StructProperty> Particle::GetProperties()
|
||||
properties.push_back(StructProperty("tmp", StructProperty::Integer, offsetof(Particle, tmp)));
|
||||
properties.push_back(StructProperty("tmp2", StructProperty::Integer, offsetof(Particle, tmp2)));
|
||||
properties.push_back(StructProperty("dcolour", StructProperty::UInteger, offsetof(Particle, dcolour)));
|
||||
properties.push_back(StructProperty("pavg0", StructProperty::Float, offsetof(Particle, pavg[0])));
|
||||
properties.push_back(StructProperty("pavg1", StructProperty::Float, offsetof(Particle, pavg[1])));
|
||||
return properties;
|
||||
}
|
||||
|
Reference in New Issue
Block a user