Files
dsrc/sku.0/sys.server/compiled/game/script/library/slots.scriptlib
T

95 lines
2.0 KiB
Plaintext

//e.g.
// include library.slots;
// obj_id shirt = createObject (myShirtTemplateSting, myGuyInAShirt, slots.CHEST1 );
const string BACK = "back";
const string BICEP_L = "bicep_l";
const string BICEP_R = "bicep_r";
const string BRACER_L = "bracer_l";
const string BRACER_R = "bracer_r";
const string CHEST1 = "chest1";
const string CHEST2 = "chest2";
const string CHEST3 = "chest3";
const string CLOAK = "cloak";
const string EARRING_L = "earring_l";
const string EARRING_R = "earring_r";
const string EYES = "eyes";
const string GLOVES = "gloves";
const string HAIR = "hair";
const string HAT = "hat";
const string HOLD_L = "hold_l";
const string HOLD_R = "hold_r";
const string MOUTH = "mouth";
const string NECK = "neck";
const string PANTS1 = "pants1";
const string PANTS2 = "pants2";
const string RING_L = "ring_l";
const string RING_R = "ring_r";
const string SHOES = "shoes";
const string UTILITY_BELT = "utility_belt";
const string WRIST_L = "wrist_l";
const string WRIST_R = "wrist_r";
const string[] EQ_SLOTS = { BACK,
BICEP_L,
BICEP_R,
BRACER_L,
BRACER_R,
CHEST1,
CHEST2,
CHEST3,
CLOAK,
EARRING_L,
EARRING_R,
EYES,
GLOVES,
HAT,
HOLD_L,
HOLD_R,
MOUTH,
NECK,
PANTS1,
PANTS2,
RING_L,
RING_R,
SHOES,
UTILITY_BELT,
WRIST_L,
WRIST_R};
string[] getOccupiedSlots(obj_id target, string[] slots)
{
if ( !isIdValid(target) )
{
return null;
}
if ( (slots == null) || (slots.length == 0) )
{
return null;
}
resizeable string[] ret = new string[0];
for ( int i = 0; i < slots.length; i++ )
{
string name = slots[i];
obj_id item = getObjectInSlot(target, name);
if ( isIdValid(item) )
{
ret = utils.addElement(ret, name);
}
}
if ( (ret == null) || (ret.length == 0) )
{
return null;
}
return ret;
}
string[] getOccupiedEqSlots(obj_id target)
{
return getOccupiedSlots(target, EQ_SLOTS);
}