Rename create game element funcs to "spawn"

This commit is contained in:
Vortrex
2023-02-15 03:19:00 -06:00
parent ae0178717c
commit 8ca2e84e62
8 changed files with 156 additions and 109 deletions

View File

@@ -356,13 +356,13 @@ function createGroundItem(itemTypeId, value, position, dimension = 0) {
let itemIndex = createItem(itemTypeId, value, V_ITEM_OWNER_GROUND, 0);
getItemData(itemIndex).position = position;
getItemData(itemIndex).dimension = dimension;
createGroundItemObject(itemIndex);
spawnGroundItemObject(itemIndex);
return itemIndex;
}
// ===========================================================================
function createGroundItemObject(itemId) {
function spawnGroundItemObject(itemId) {
if (!getItemData(itemId)) {
return false;
}
@@ -1772,7 +1772,7 @@ function playerDropItem(client, hotBarSlot) {
getItemData(itemId).position = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), getItemTypeData(getItemData(itemId).itemTypeIndex).dropFrontDistance);
getItemData(itemId).dimension = getPlayerDimension(client);
//getItemData(itemId).interior = getPlayerInterior(client);
createGroundItemObject(itemId);
spawnGroundItemObject(itemId);
getItemData(itemId).needsSaved = true;
getServerData().groundItemCache.push(itemId);
}
@@ -2137,9 +2137,9 @@ function cacheAllGroundItems() {
// ===========================================================================
function createAllGroundItemObjects() {
function spawnAllGroundItemObjects() {
for (let i in getServerData().groundItemCache) {
createGroundItemObject(getServerData().groundItemCache[i]);
spawnGroundItemObject(getServerData().groundItemCache[i]);
}
}
@@ -3293,4 +3293,15 @@ function cacheItemItems(itemId) {
}
}
// ===========================================================================
function despawnAllGroundItemObjects() {
for (let i in getServerData().groundItemCache) {
if (getItemData(getServerData().groundItemCache[i]).object != null) {
destroyGameElement(getItemData(getServerData().groundItemCache[i]).object);
getItemData(getServerData().groundItemCache[i]).object = null;
}
}
}
// ===========================================================================