mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-29 03:46:50 +01:00
- reskate.entities.blueprints lists the game's object blueprints (meshes only if asked), and reskate.entities.bounds gives a blueprint's box, so a mod can pick a prop by list or at random - Attached objects take upright, turn and ground (a floor found within reach below), the "root" joint, and a 6th options argument with solid; spawned props' bodies are found and ghosted - reskate.skater.hide, reskate.world.pick, and skater.get gives right and switch - reskate.console.command takes an optional 4th table of subcommands; the console lookup suggests plugin commands word by word, and plugin commands lists the subcommands - objbody: a test command for finding which body setter takes a prop out of collision
85 lines
4.7 KiB
C++
85 lines
4.7 KiB
C++
#pragma once
|
|
#include "Engine/Game/World/park_editor.h"
|
|
#include "Extension/Objects/object_placements.h"
|
|
#include <array>
|
|
#include <optional>
|
|
#include <string>
|
|
|
|
namespace dingosdk {
|
|
ParkEditorModel local_park_editor();
|
|
// Whether a menu shows the park list (the park editor, or World > Build). Listing the Mods folder
|
|
// walks the disk, so local_park_editor rescans it only while one does.
|
|
void set_park_mod_list_visible(bool visible) noexcept;
|
|
// Whether the local player may place objects under the lobby host's policy.
|
|
// Gates the park editor and the game's own native create/copy requests. Reset
|
|
// on disconnect; existing placed objects remain in the world.
|
|
void set_lobby_object_placement_allowed(bool enabled);
|
|
bool lobby_object_placement_allowed() noexcept;
|
|
// Whether objects may be resized in this session (a dedicated server can turn object scaling off;
|
|
// its roles that may always build are exempt). Off, a saved object's scale is kept in the layout
|
|
// but it is not resized in the world, and the world's 1x is never saved over it. On outside a session.
|
|
void set_lobby_object_scaling_allowed(bool enabled) noexcept;
|
|
bool lobby_object_scaling_allowed() noexcept;
|
|
// The session's limit on this player's objects (object_placement.h), 0 for none: the host's
|
|
// own game and a server admin's are given none. Adding an object is refused at the limit.
|
|
void set_lobby_object_limit(unsigned limit) noexcept;
|
|
unsigned lobby_object_limit() noexcept;
|
|
// Objects this player has on the current map, and whether one more would pass the limit.
|
|
std::size_t lobby_object_count();
|
|
bool lobby_object_limit_reached();
|
|
inline constexpr char object_limit_notice[] = "You have placed as many objects as this session allows each player.";
|
|
bool queue_local_park_surface(const EditorSurfaceRequest &);
|
|
bool queue_local_park_preview(const EditorPreviewRequest &);
|
|
bool queue_local_park_selection(const EditorSelectionRequest &);
|
|
bool queue_local_park_paste(const EditorPasteRequest &);
|
|
bool queue_local_park_object_set(const EditorObjectSetRequest &);
|
|
bool queue_local_park_delete(const EditorDeleteRequest &);
|
|
void tick_local_park_editor() noexcept;
|
|
// The world raycast, and the object it meets (reskate.world.pick; world_pick.cpp): where, its root
|
|
// entity (0 for none), its pose as the placements runtime reads it (scale xyz, -, rotation xyzw,
|
|
// position xyz, -), and the world object blueprint it was made from, when that is known.
|
|
struct WorldPick {
|
|
std::array<float, 3> at{};
|
|
std::uint64_t entity{};
|
|
std::optional<std::array<float, 12>> pose;
|
|
std::string blueprint;
|
|
};
|
|
std::optional<WorldPick> local_world_pick(const std::array<float, 3> &from, const std::array<float, 3> &to);
|
|
// Gives world_entities the physics world (its objects made not solid, and those standing on the floor).
|
|
void register_world_physics() noexcept;
|
|
struct WorldRayHit {
|
|
bool cast{}, hit{};
|
|
std::array<float, 3> at{};
|
|
std::uint64_t when{}; // GetTickCount64 of the cast
|
|
bool available{}; // Native client collision API and world were ready.
|
|
};
|
|
void queue_world_ray(std::uint32_t id, const std::array<float, 3> &origin, const std::array<float, 3> &direction, float length);
|
|
WorldRayHit world_ray(std::uint32_t id);
|
|
// Client collision queries used by mode placement do not require the park
|
|
// editor, its placement store, or the server object manager to be enabled.
|
|
// Runs only on the verified local client update thread.
|
|
void tick_local_world_rays() noexcept;
|
|
|
|
// Invoked through the console's verified game-thread dispatcher. `texts`
|
|
// carries a park mod's name, author, version and description (mod-create:
|
|
// all four; mod-details: the same after the folder in `argument`).
|
|
std::string edit_local_park(std::string_view operation, std::string_view map, std::uint64_t generation,
|
|
std::uint64_t revision, std::string_view argument,
|
|
const profile::PlacedObject &object = {},
|
|
const std::vector<std::string> &texts = {});
|
|
} // namespace dingosdk
|
|
namespace dingosdk::profile_runtime {
|
|
void initialize_park_editor(const std::filesystem::path &directory);
|
|
// The engine data root whose Mods folder holds park mods.
|
|
void set_park_mods_root(const std::filesystem::path &data_root);
|
|
void update_park_editor();
|
|
void update_park_editor_moves() noexcept;
|
|
void reset_park_editor();
|
|
bool park_editor_owns_placements();
|
|
// The layout the editor's current edit is applying (null without one). Its new objects are saved
|
|
// only when the whole edit completes, but they are live, linked objects before that.
|
|
const profile::ObjectLayout *park_editor_pending_layout();
|
|
bool park_editor_observe(std::uint64_t entity, const profile::PlacedObject &object);
|
|
void park_editor_external_change();
|
|
} // namespace dingosdk::profile_runtime
|