feat: Added Daedalus class
+ sqParseTable moved to nonut::CustomTypes as SqDict + fix: Removed Python constructors for ItemGround and DamageDescription classes (so it's unable to make new objects in the scripts)
This commit is contained in:
@@ -108,4 +108,33 @@ namespace nonut
|
||||
GET_SLOT(y, Float);
|
||||
GET_SLOT(z, Float);
|
||||
}
|
||||
|
||||
void SqDict::convert(SQObject object)
|
||||
{
|
||||
Sqrat::Table tab = Sqrat::Table(object);
|
||||
Sqrat::Object::iterator tabIterator;
|
||||
int i = 0;
|
||||
|
||||
while (tab.Next(tabIterator))
|
||||
{
|
||||
HSQOBJECT key = tabIterator.getKey();
|
||||
HSQOBJECT value = tabIterator.getValue();
|
||||
|
||||
if (key._type != OT_STRING)
|
||||
continue;
|
||||
|
||||
if (value._type == OT_STRING)
|
||||
data[sq_objtostring(&key)] = sq_objtostring(&value);
|
||||
else if (value._type == OT_INTEGER)
|
||||
data[sq_objtostring(&key)] = sq_objtointeger(&value);
|
||||
else if (value._type == OT_FLOAT)
|
||||
data[sq_objtostring(&key)] = sq_objtofloat(&value);
|
||||
else if (value._type == OT_TABLE)
|
||||
{
|
||||
SqDict result = SqDict();
|
||||
result.convert(object);
|
||||
data[sq_objtostring(&key)] = result.data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
#define NONUT_G2O_SHARED_CUSTOM_TYPES_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <pybind11/embed.h>
|
||||
#include "Utils.h"
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
namespace nonut
|
||||
{
|
||||
struct GameTime : CustomType
|
||||
@@ -164,5 +166,11 @@ namespace nonut
|
||||
return std::make_tuple(name, x, y, z);
|
||||
}
|
||||
};
|
||||
|
||||
struct SqDict : CustomType
|
||||
{
|
||||
void convert(SQObject object) override;
|
||||
py::dict data{};
|
||||
};
|
||||
}
|
||||
#endif // NONUT_G2O_SHARED_CUSTOM_TYPES_H
|
||||
|
||||
Reference in New Issue
Block a user