Start working on logic for new items
This commit is contained in:
@@ -209,8 +209,8 @@ const VRR_ITEM_USETYPE_ARMOUR = 28; //
|
||||
const VRR_ITEM_USETYPE_HEALTH = 29; //
|
||||
const VRR_ITEM_USETYPE_AED = 30; //
|
||||
const VRR_ITEM_USETYPE_WALKIETALKIE = 31; //
|
||||
const VRR_ITEM_USETYPE_BOOMBOX = 32; //
|
||||
const VRR_ITEM_USETYPE_EARBUDS = 33; //
|
||||
const VRR_ITEM_USETYPE_AREARADIO = 32; //
|
||||
const VRR_ITEM_USETYPE_PERSONALRADIO = 33; //
|
||||
const VRR_ITEM_USETYPE_BADGE = 34; //
|
||||
const VRR_ITEM_USETYPE_DRINK = 35; // Drinkable item. Action output shows "Player_Name drinks some (drink name)"
|
||||
const VRR_ITEM_USETYPE_EXTINGUISHER = 36; // Extinguisher item. Allows putting out fires
|
||||
@@ -231,6 +231,7 @@ const VRR_ITEM_USETYPE_PLANT = 50; // Plantable item. Pot plants,
|
||||
const VRR_ITEM_USETYPE_MEGAPHONE = 51; // Megaphone item. Allows shouting over greater distances. Also called a bullhorn
|
||||
const VRR_ITEM_USETYPE_INJECTDRUG = 52; // Injectable drug. Action output shows "Player_Name injects some (drug)"
|
||||
const VRR_ITEM_USETYPE_ALCOHOL = 53; // Alcohol. Applies an intoxication/drunkness effect
|
||||
const VRR_ITEM_USETYPE_LOTTOTICKET = 54; // Lotto ticket. Allows a character to enter the lottery
|
||||
|
||||
// Item Drop Types
|
||||
const VRR_ITEM_DROPTYPE_NONE = 0; // Can't be dropped
|
||||
|
||||
@@ -723,6 +723,12 @@ function playerUseItem(client, hotBarSlot) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!getItemData(itemIndex)) {
|
||||
submitBugReport(client, `[AUTOMATED REPORT] Tried to use invalid item (index ${itemIndex} in player slot ${hotBarSlot})`);
|
||||
cachePlayerHotBarItems(client);
|
||||
return false;
|
||||
}
|
||||
|
||||
switch(getItemTypeData(getItemData(itemIndex).itemTypeIndex).useType) {
|
||||
case VRR_ITEM_USETYPE_SKIN: {
|
||||
getPlayerData(client).itemActionItem = itemIndex;
|
||||
@@ -1024,6 +1030,39 @@ function playerUseItem(client, hotBarSlot) {
|
||||
break;
|
||||
}
|
||||
|
||||
case VRR_ITEM_USETYPE_HEALTH: {
|
||||
let closestPlayer = getClosestPlayer(getPlayerPosition(client), client);
|
||||
|
||||
if(!getPlayerData(closestPlayer)) {
|
||||
messagePlayerError(client, "There isn't anyone close enough to heal!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getDistance(getPlayerPosition(closestPlayer), getPlayerPosition(client)) > getGlobalConfig().firstAidKitPlayerDistance) {
|
||||
messagePlayerError(client, "There isn't anyone close enough to heal!");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case VRR_ITEM_USETYPE_LOTTOTICKET: {
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case VRR_ITEM_USETYPE_AREARADIO: {
|
||||
let state = getItemData(itemIndex)
|
||||
meActionToNearbyPlayers(client, `turns ${getOnOffFromBool(state)} the boombox radio`);
|
||||
messagePlayerAlert(client, `Use /radiostation to set the radio station and drop it on the ground to play`);
|
||||
break;
|
||||
}
|
||||
|
||||
case VRR_ITEM_USETYPE_PERSONALRADIO: {
|
||||
meActionToNearbyPlayers(client, `turns ${getOnOffFromBool(state)} the boombox radio`);
|
||||
messagePlayerAlert(client, `Use /radiostation to set the radio station`);
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
messagePlayerError(client, `The ${getItemName(itemIndex)} doesn't do anything when you try to use it.`);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user