summaryrefslogtreecommitdiff
path: root/src/entity.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/entity.c')
-rw-r--r--src/entity.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/entity.c b/src/entity.c
index 8076a86..1180c1c 100644
--- a/src/entity.c
+++ b/src/entity.c
@@ -220,6 +220,20 @@ i32 entity_propertyo_default(Entity *this, const char *property, i32 def) {
return _propertyi_default(this, property, def, "object");
}
+f32 entity_propertyf(Entity *this, const char *property, f32 def) {
+ assert(this != nullptr);
+ assert(this->t2c != nullptr);
+ assert(property != nullptr);
+ rfor(i, 0u, this->t2c->numproperties) {
+ const auto e = &this->t2c->properties[i];
+ if (strcasecmp(e->name, property) == 0) {
+ assert(strcmp(e->type, "float") == 0);
+ return e->valuenumber;
+ }
+ }
+ return def;
+}
+
bool entity_propertyb(Entity *this, const char *property) {
assert(this != nullptr);
assert(this->t2c != nullptr);