spawn prefab updated
Unfortunately, only doors are being instantiated. I haven't done enough research for the problem
This commit is contained in:
@@ -148,6 +148,7 @@ void DrawEntitiesTab() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
|
|
||||||
ImGui::Text("Animals");
|
ImGui::Text("Animals");
|
||||||
const char* animals_items[] = { "Rat", "Goat", "Pig" };
|
const char* animals_items[] = { "Rat", "Goat", "Pig" };
|
||||||
static int animal_current = 0;
|
static int animal_current = 0;
|
||||||
@@ -155,6 +156,26 @@ void DrawEntitiesTab() {
|
|||||||
if (ImGui::Button("Spawn##an")) {
|
if (ImGui::Button("Spawn##an")) {
|
||||||
Misc::CarryAnimal(animals_items[animal_current]);
|
Misc::CarryAnimal(animals_items[animal_current]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::Text("Prefabs");
|
||||||
|
const char* prefab_items[] = {
|
||||||
|
"TV",
|
||||||
|
"Devour Door Back",
|
||||||
|
"Devour Door Main",
|
||||||
|
"Devour Door Room",
|
||||||
|
"Animal Gate",
|
||||||
|
"DoorNumber",
|
||||||
|
"Town Door",
|
||||||
|
"Inn Double Door",
|
||||||
|
"Slaughterhouse Fire Escape Door",
|
||||||
|
"Asylum White Door",
|
||||||
|
"Town Cell Door",
|
||||||
|
};
|
||||||
|
static int prefab_current = 0;
|
||||||
|
ImGui::Combo("##pref", &prefab_current, prefab_items, IM_ARRAYSIZE(prefab_items));
|
||||||
|
if (ImGui::Button("Spawn##pref")) {
|
||||||
|
Misc::SpawnPrefab(prefab_items[prefab_current]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawMapSpecificTab() {
|
void DrawMapSpecificTab() {
|
||||||
|
|||||||
@@ -187,30 +187,51 @@ void Misc::Fly(float speed) {
|
|||||||
|
|
||||||
void Misc::CustomizedLobby()
|
void Misc::CustomizedLobby()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function has not been tested
|
// This function has not been tested
|
||||||
// This function has not been tested
|
void Misc::SpawnPrefab(const char* prefabName) {
|
||||||
// This function has not been tested
|
|
||||||
void Misc::SpawnPrefab(app::PrefabId id) {
|
if (IsHost() == false) { return; }
|
||||||
|
|
||||||
|
std::string _scene = SceneName();
|
||||||
|
if (_scene == std::string("Menu")) return;
|
||||||
|
|
||||||
if (il2cppi_is_initialized(app::BoltPrefabs__TypeInfo)) {
|
if (il2cppi_is_initialized(app::BoltPrefabs__TypeInfo)) {
|
||||||
app::PrefabId pGate = (*app::BoltPrefabs__TypeInfo)->static_fields->ManorGate;
|
|
||||||
|
|
||||||
app::Quaternion rotation = app::Quaternion_get_identity(NULL);
|
app::BoltPrefabs__StaticFields* _prefab_field = (*app::BoltPrefabs__TypeInfo)->static_fields;
|
||||||
|
|
||||||
auto localPlayer = Player::GetLocalPlayer();
|
|
||||||
|
|
||||||
|
std::map<const char*, app::PrefabId> prefabMapDevour = {
|
||||||
|
{"TV", _prefab_field->TV},
|
||||||
|
{"Devour Door Back", _prefab_field->DevourDoorBack},
|
||||||
|
{"Devour Door Main", _prefab_field->DevourDoorMain},
|
||||||
|
{"Devour Door Room", _prefab_field->DevourDoorRoom},
|
||||||
|
{"Animal Gate", _prefab_field->Animal_Gate},
|
||||||
|
{"DoorNumber", _prefab_field->DoorNumber},
|
||||||
|
{"Town Door", _prefab_field->TownDoor},
|
||||||
|
{"Inn Double Door", _prefab_field->InnDoubleDoor},
|
||||||
|
{"Slaughterhouse Fire Escape Door", _prefab_field->SlaughterhouseFireEscapeDoor},
|
||||||
|
{"Asylum White Door", _prefab_field->AsylumWhiteDoor},
|
||||||
|
{"Town Cell Door", _prefab_field->TownCellDoor},
|
||||||
|
};
|
||||||
|
|
||||||
|
app::PrefabId p = prefabMapDevour[prefabName];
|
||||||
|
|
||||||
|
app::GameObject* localPlayer = Player::GetLocalPlayer();
|
||||||
if (localPlayer) {
|
if (localPlayer) {
|
||||||
app::Transform* _transform = Unity::Transform::Get(localPlayer);
|
app::Quaternion rotation = app::Quaternion_get_identity(NULL);
|
||||||
if (_transform == nullptr) return;
|
|
||||||
|
|
||||||
app::Vector3 pos = Unity::Transform::Position(_transform);
|
app::Transform* playerTransform = Unity::Transform::Get(localPlayer);
|
||||||
|
if (playerTransform == nullptr) return;
|
||||||
|
|
||||||
// CRASH????????????????
|
app::Vector3 playerPos = Unity::Transform::Position(playerTransform);
|
||||||
app::BoltNetwork_Instantiate_6(pGate, pos, rotation, NULL);
|
|
||||||
|
if (app::BoltNetwork_Instantiate_6) {
|
||||||
|
app::GameObject* go = (app::GameObject*)app::BoltNetwork_Instantiate_6(p, playerPos, rotation, nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace Misc {
|
|||||||
void InstantWin();
|
void InstantWin();
|
||||||
void Fly(float speed);
|
void Fly(float speed);
|
||||||
void CustomizedLobby();
|
void CustomizedLobby();
|
||||||
void SpawnPrefab(app::PrefabId id);
|
void SpawnPrefab(const char* prefabName);
|
||||||
void FullBright();
|
void FullBright();
|
||||||
void Revive(bool self);
|
void Revive(bool self);
|
||||||
void GetKeys();
|
void GetKeys();
|
||||||
|
|||||||
Reference in New Issue
Block a user