mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-12 18:42:36 +01:00
Add tile element support
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "../common.h"
|
||||
#include "../ride/Ride.h"
|
||||
#include "../world/Map.h"
|
||||
#include "ScTile.hpp"
|
||||
#include "ScThing.hpp"
|
||||
|
||||
namespace OpenRCT2::Scripting
|
||||
@@ -40,6 +41,12 @@ namespace OpenRCT2::Scripting
|
||||
return MAX_SPRITES;
|
||||
}
|
||||
|
||||
std::shared_ptr<ScTile> getTile(sint32 x, sint32 y)
|
||||
{
|
||||
auto firstElement = map_get_first_element_at(x, y);
|
||||
return std::make_shared<ScTile>(firstElement);
|
||||
}
|
||||
|
||||
std::shared_ptr<ScThing> getThing(sint32 id)
|
||||
{
|
||||
if (id >= 0 && id < MAX_SPRITES)
|
||||
@@ -58,6 +65,7 @@ namespace OpenRCT2::Scripting
|
||||
dukglue_register_property(ctx, &ScMap::size_get, nullptr, "size");
|
||||
dukglue_register_property(ctx, &ScMap::rides_get, nullptr, "rides");
|
||||
dukglue_register_property(ctx, &ScMap::things_get, nullptr, "things");
|
||||
dukglue_register_method(ctx, &ScMap::getTile, "getTile");
|
||||
dukglue_register_method(ctx, &ScMap::getThing, "getThing");
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user