player.naked = true
player.barecrotch = true
player.barebust = true
foreach (o, GetDirectChildren(player)) {
if (GetBoolean(o, "worn")) {
player.naked = false
}
if (HasAttribute(o,"wear_slots")) {
if (ListContains(o.wear_slots, "chest")) {
player.barebust = false
}
if (ListContains(o.wear_slots, "crotch")) {
player.barecrotch = false
}
}
}I think the way I would do it is to have a function, say CheckClothingState, that tests if the player is naked or has certain areas exposed, and to set flags on the player object if they are. Call the function from the end of the DoWear and DoRemove functions. You can then test the flags in a text processor command.
CheckClothingState needs no parameters or return type, and would look a bit like this:
Code: Select all
player.naked = true
player.barecrotch = true
player.barebust = true
foreach (o, GetDirectChildren(player)) {
if (GetBoolean(o, "worn")) {
player.naked = false
}
if (HasAttribute(o,"wear_slots")) {
if (ListContains(o.wear_slots, "chest")) {
player.barebust = false
}
if (ListContains(o.wear_slots, "crotch")) {
player.barecrotch = false
}
}
}
Make sure any garment that covers her chest has "chest" in the list of slots (looks like you already have), and "crotch" if it covers the crotch.
if (not object.parent = player or not GetBoolean(object, "worn") or not GetBoolean(object, "removeable")) {
if (object.removemsg = null) {
msg (DynamicTemplate("RemoveUnsuccessful",object))
}
else {
msg (object.removemsg)
}
}
else {
conflictedItem = null
// check if we are wearing anything over it
if (HasAttribute(object,"wear_slots")) {
foreach (item, ScopeReachableInventory()) {
if (HasAttribute(item,"wear_slots")) {
if (GetBoolean(item, "worn")) {
foreach (itemSlot, item.wear_slots) {
if (ListContains(object.wear_slots,itemSlot)) {
if (object.wear_layer < item.wear_layer) {
conflictedItem = item
}
}
}
}
}
}
}
if (conflictedItem = null) {
if (object.removemsg = null) {
msg (DynamicTemplate("RemoveSuccessful",object))
}
else {
msg (object.removemsg)
}
object.worn = false
object.drop = object.original_drop
object.alias = object.original_alias
object.original_drop = null
object.original_alias = null
object.display = null
// do after
if (HasScript(object, "onafterremove")) {
do (object, "onafterremove")
}
else if (HasString(object, "onafterremove")) {
msg (object.onafterremove)
}
}
else {
msg (DynamicTemplate("RemoveFirst", conflictedItem))
}
}player.toobigforitem = false
if (HasScript(object, "testplayersize")) {
do (object, "testplayersize")
}
if (player.toobigforitem) {
if (HasString(object, "toobigtowearmsg")) {
msg (object.toobigtowearmsg)
}
else {
msg ("You try to put on the " + GetDisplayName(object) + " but it just won't fit!")
}
}
else if (not HasAttribute(object,"worn")) {
msg (DynamicTemplate("WearUnsuccessful", object))
}
else if (object.parent = player and GetBoolean(object, "worn")) {
msg (DynamicTemplate("AlreadyWearing", object))
}
else if (not ListContains(ScopeInventory(), object)) {
msg (DynamicTemplate("WearUnsuccessful", object))
}
else {
isLayerProblem = false
conflictedItem = null
if (HasAttribute(object,"wear_slots")) {
foreach (item, ScopeReachableInventory()) {
if (HasAttribute(item,"wear_slots")) {
if (GetBoolean(item, "worn")) {
foreach (itemSlot, item.wear_slots) {
if (ListContains(object.wear_slots,itemSlot)) {
if (object.wear_layer < item.wear_layer) {
conflictedItem = item
isLayerProblem = true
}
else if (object.wear_layer = item.wear_layer) {
conflictedItem = item
}
}
}
}
}
}
}
if (conflictedItem = null) {
object.worn = True
object.original_drop = object.drop
object.original_alias = object.alias
object.drop = false
object.display = GetDisplayName(object)
object.alias = GetDisplayAlias(object) + " (worn)"
if (object.wearmsg = null) {
msg (DynamicTemplate("WearSuccessful",object))
}
else {
msg (object.wearmsg)
}
// do after
if (HasScript(object, "onafterwear")) {
do (object, "onafterwear")
}
else if (HasString(object, "onafterwear")) {
msg (object.onafterwear)
}
}
else if (isLayerProblem = true) {
msg (DynamicTemplate("CannotWearOver",conflictedItem))
}
else {
msg (DynamicTemplate("CannotWearWith",conflictedItem))
}
}