message when inventory is full (assumes player inventory destination, but item winds up in hand due to lack of space, but it works)

This commit is contained in:
Fate-JH 2024-08-19 21:47:41 -04:00
parent e4275cf298
commit 8f98f67aef
4 changed files with 32 additions and 28 deletions

View file

@ -120,13 +120,8 @@ class GeneralLogic(val ops: GeneralOperations, implicit val context: ActorContex
ops.fallHeightTracker(pos.z)
if (isCrouching && !player.Crouching) {
//dev stuff goes here
sendResponse(ChatMsg(ChatMessageType.UNK_227, "@NoChat_NoSquad"))
sendResponse(ChatMsg(ChatMessageType.UNK_229, "@PadDeconstruct_secsA^23~"))
sendResponse(ChatMsg(ChatMessageType.UNK_227, "@InventoryPickupNoRoom"))
// zone.LocalEvents ! LocalServiceMessage(
// "",
// LocalAction.SendResponse(ChatMsg(ChatMessageType.UNK_227, "@InventoryPickupNoRoom"))
// LocalAction.SendResponse(ChatMsg(ChatMessageType.UNK_227, "@InventoryPickupNoRoom"))
// )
}
player.Position = pos
player.Velocity = vel

View file

@ -65,7 +65,7 @@ object WorldSession {
Zone.Ground.DropItem(localItem, localContainer.Position, Vector3.z(localContainer.Orientation.z)),
localContainer.Actor
)
case _ => ;
case _ => ()
}
result
}
@ -163,7 +163,7 @@ object WorldSession {
result.onComplete {
case Failure(_) | Success(_: Containable.CanNotPutItemInSlot) =>
TaskWorkflow.execute(GUIDTask.unregisterEquipment(localContainer.Zone.GUID, localItem))
case _ => ;
case _ => ()
}
result
}
@ -361,17 +361,21 @@ object WorldSession {
val future = ask(localZone.Ground, Zone.Ground.PickupItem(item.GUID))
future.onComplete {
case Success(Zone.Ground.ItemInHand(_)) =>
PutEquipmentInInventoryOrDrop(localContainer)(localItem)
PutEquipmentInInventoryOrDrop(localContainer)(localItem).onComplete {
case Success(Containable.ItemPutInSlot(_, _, Player.FreeHandSlot, _)) =>
localContainer.Actor ! Zone.Ground.CanNotPickupItem(localZone, localItem.GUID, "@InventoryPickupNoRoom")
case _ => ()
}
case Success(Zone.Ground.CanNotPickupItem(_, item_guid, _)) =>
localZone.GUID(item_guid) match {
case Some(_) => ;
case Some(_) => ()
case None => //acting on old data?
localZone.AvatarEvents ! AvatarServiceMessage(
localZone.id,
AvatarAction.ObjectDelete(Service.defaultPlayerGUID, item_guid)
)
}
case _ => ;
case _ => ()
}
future
}
@ -407,7 +411,7 @@ object WorldSession {
.DropItem(localItem, localPos.getOrElse(localContainer.Position), Vector3.z(localContainer.Orientation.z)),
localContainer.Actor
)
case _ => ;
case _ => ()
}
result
}
@ -584,7 +588,7 @@ object WorldSession {
case Success(Containable.ItemPutInSlot(_, _, _, Some(swapItem))) =>
//swapItem is not registered right now, we can not drop the item without re-registering it
TaskWorkflow.execute(PutNewEquipmentInInventorySlot(localSource)(swapItem, localSrcSlot))
case _ => ;
case _ => ()
}
override def description(): String = s"unregistering $localItem before stowing in $localDestination"
@ -597,7 +601,7 @@ object WorldSession {
localChannel,
AvatarAction.ObjectDelete(Service.defaultPlayerGUID, guid)
)
case None => ;
case None => ()
}
val moveResult = ask(localDestination.Actor, Containable.PutItemInSlotOrAway(localItem, Some(localDestSlot)))
moveResult.onComplete(localMoveOnComplete)
@ -610,7 +614,7 @@ object WorldSession {
moveItemTaskFunc(fromSlot),
GUIDTask.unregisterEquipment(fromSource.Zone.GUID, itemToMove)
))
case _ => ;
case _ => ()
}
val result = ask(source.Actor, Containable.RemoveItemFromSlot(item))
result.onComplete(resultOnComplete)
@ -689,7 +693,7 @@ object WorldSession {
case Success(Containable.ItemPutInSlot(_, _, _, Some(swapItem))) =>
//swapItem is not registered right now, we can not drop the item without re-registering it
TaskWorkflow.execute(PutNewEquipmentInInventorySlot(localSource)(swapItem, localSrcSlot))
case _ => ;
case _ => ()
}
override def description(): String = s"registering $localItem in ${localDestination.Zone.id} before removing from $localSource"
@ -702,7 +706,7 @@ object WorldSession {
localChannel,
AvatarAction.ObjectDelete(Service.defaultPlayerGUID, guid)
)
case None => ;
case None => ()
}
val moveResult = ask(localDestination.Actor, Containable.PutItemInSlotOrAway(localItem, Some(localDestSlot)))
moveResult.onComplete(localMoveOnComplete)
@ -715,7 +719,7 @@ object WorldSession {
moveItemTaskFunc(fromSlot),
GUIDTask.registerEquipment(fromSource.Zone.GUID, itemToMove)
))
case _ => ;
case _ => ()
}
val result = ask(source.Actor, Containable.RemoveItemFromSlot(item))
result.onComplete(resultOnComplete)
@ -847,17 +851,17 @@ object WorldSession {
case Some(e) =>
log.info(s"${tplayer.Name} has dropped ${tplayer.Sex.possessive} ${e.Definition.Name}")
PutEquipmentInInventoryOrDrop(tplayer)(e)
case _ => ;
case _ => ()
}
//restore previously-held-up equipment
itemInPreviouslyDrawnSlotToDrop match {
case Some(e) => PutEquipmentInInventorySlot(tplayer)(e, previouslyDrawnSlot)
case _ => ;
case _ => ()
}
log.info(s"${tplayer.Name} has quickly drawn a ${grenade.Definition.Name}")
case _ => ;
case _ => ()
}
case None => ;
case None => ()
}
optGrenadeInSlot.nonEmpty
} else {

View file

@ -522,6 +522,12 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
case Zone.Ground.CanNotPickupItem(_, item_guid, reason) =>
log.warn(s"${player.Name} failed to pick up an item ($item_guid) from the ground because $reason")
if (reason.startsWith("@")) {
player.Zone.AvatarEvents ! AvatarServiceMessage(
player.Name,
AvatarAction.SendResponse(Service.defaultPlayerGUID, ChatMsg(ChatMessageType.UNK_227, reason))
)
}
case Player.BuildDeployable(obj: TelepadDeployable, tool: Telepad) =>
obj.Router = tool.Router //necessary; forwards link to the router that produced the telepad

View file

@ -102,7 +102,8 @@ class CaptureFlagManager(zone: Zone) extends Actor {
val building = flag.Owner.asInstanceOf[Building]
CaptureFlagManager.ChatBroadcast(
zone,
CaptureFlagChatMessageStrings.CTF_Failed_FlagLost(building.Name, flag.Faction)
CaptureFlagChatMessageStrings.CTF_Failed_FlagLost(building.Name, flag.Faction),
fanfare = false
)
case CaptureFlagLostReasonEnum.Ended =>
()
@ -175,10 +176,7 @@ class CaptureFlagManager(zone: Zone) extends Actor {
if (hackTimeRemaining < nextMessageAfterMinutes.minutes.toMillis) {
entry.currentMessageIndex += 1
val msg = CaptureFlagManager.ComposeWarningMessage(flag, owner.Name, nextMessageAfterMinutes)
//can't use ChatBroadcast(...) because the message contents are wide
events ! LocalServiceMessage(zoneId, LocalAction.SendResponse(
ChatMsg(ChatMessageType.UNK_229, wideContents = true, "", msg, None)
))
CaptureFlagManager.ChatBroadcast(zone, msg, fanfare = false)
}
FlagInfo(
u1 = 0,
@ -241,6 +239,7 @@ object CaptureFlagManager {
private def ChatBroadcast(zone: Zone, message: String, fanfare: Boolean = true): Unit = {
//todo use UNK_222 sometimes
//todo I think the fanfare was relate to whether the message was celebratory is tone, based on the faction
val messageType: ChatMessageType = if (fanfare) {
ChatMessageType.UNK_223
} else {
@ -250,7 +249,7 @@ object CaptureFlagManager {
zone.id,
LocalAction.SendChatMsg(
PlanetSideGUID(-1),
ChatMsg(messageType, wideContents = false, "", message, None)
ChatMsg(messageType, wideContents = true, "", message, None)
)
)
}