feat: Added ItemGround class
+ Added onPlayerTakeItem and onPlayerDropItem events
This commit is contained in:
32
src/classes/py/ItemGround.h
Normal file
32
src/classes/py/ItemGround.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef _PY_ITEMGROUND_H_
|
||||
#define _PY_ITEMGROUND_H_
|
||||
|
||||
#include <pybind11/embed.h>
|
||||
#include <classes/sq/ItemGround.h>
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
class PyItemGround
|
||||
{
|
||||
private:
|
||||
nonut::ItemGround *sqobj;
|
||||
|
||||
public:
|
||||
PyItemGround() { sqobj = new nonut::ItemGround(); };
|
||||
PyItemGround(SQObject obj) { sqobj = new nonut::ItemGround(obj); }
|
||||
|
||||
py::tuple getPosition() { return py::make_tuple(sqobj->getPosition().toTuple()); }
|
||||
py::tuple getRotation() { return py::make_tuple(sqobj->getRotation().toTuple()); }
|
||||
|
||||
nonut::Int getId() { return sqobj->id; }
|
||||
nonut::String getInstance() { return sqobj->instance; }
|
||||
nonut::Int getAmount() { return sqobj->amount; }
|
||||
nonut::String getWorld() { return sqobj->world; }
|
||||
nonut::Int getVirtualWorld() { return sqobj->virtualWorld; }
|
||||
|
||||
void setVirtualWorld(nonut::Int value) { sqobj->virtualWorld = value; }
|
||||
|
||||
void del() { delete sqobj; }
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -13,7 +13,6 @@ namespace nonut
|
||||
DamageDescription();
|
||||
explicit DamageDescription(SQObject object);
|
||||
|
||||
// Properties
|
||||
Property<Int> flags;
|
||||
Property<Int> damage;
|
||||
Property<String> item_instance;
|
||||
|
||||
34
src/classes/sq/ItemGround.cpp
Normal file
34
src/classes/sq/ItemGround.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#include <NoNut/core/CommonHeader.h>
|
||||
#include "ItemGround.h"
|
||||
|
||||
namespace nonut
|
||||
{
|
||||
ItemGround::ItemGround() :
|
||||
Class("ItemGround"),
|
||||
|
||||
METHOD_CTOR(getPosition),
|
||||
METHOD_CTOR(getRotation),
|
||||
|
||||
PROPERTY_CTOR(id),
|
||||
PROPERTY_CTOR(instance),
|
||||
PROPERTY_CTOR(amount),
|
||||
PROPERTY_CTOR(world),
|
||||
PROPERTY_CTOR(virtualWorld)
|
||||
{
|
||||
classCtor();
|
||||
}
|
||||
|
||||
ItemGround::ItemGround(SQObject object) :
|
||||
Class("ItemGround", object),
|
||||
|
||||
METHOD_CTOR(getPosition),
|
||||
METHOD_CTOR(getRotation),
|
||||
|
||||
PROPERTY_CTOR(id),
|
||||
PROPERTY_CTOR(instance),
|
||||
PROPERTY_CTOR(amount),
|
||||
PROPERTY_CTOR(world),
|
||||
PROPERTY_CTOR(virtualWorld)
|
||||
{
|
||||
}
|
||||
}
|
||||
28
src/classes/sq/ItemGround.h
Normal file
28
src/classes/sq/ItemGround.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef _ITEMGROUND_H
|
||||
#define _ITEMGROUND_H
|
||||
#include <string>
|
||||
|
||||
#include <NoNut/core/Class.h>
|
||||
#include <NoNut/core/CustomTypes.h>
|
||||
|
||||
namespace nonut
|
||||
{
|
||||
class ItemGround : public Class
|
||||
{
|
||||
public:
|
||||
ItemGround();
|
||||
explicit ItemGround(SQObject object);
|
||||
|
||||
Function<nonut::Position3d> getPosition;
|
||||
Function<nonut::Position3d> getRotation;
|
||||
|
||||
// Properties
|
||||
Property<Int> id;
|
||||
Property<String> instance;
|
||||
Property<Int> amount;
|
||||
Property<String> world;
|
||||
Property<Int> virtualWorld;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user