-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dropped GroundItems are never made globally visible #352
Comments
@Major- we discussed this on IRC before and the conclusion was that it is intended behaviour. Is that right? I think that needs documented. |
If this is intended functionality, what would be a use case for GroundItem.dropped? When a user drops an item, should that use GroundItem.create? I guess I am confused because of what the javadocs state. apollo/game/src/main/org/apollo/game/model/entity/GroundItem.java Lines 19 to 43 in ee78d2c
The only difference that I can tell between the two is that dropped assigns an owner. Should the item be visible to the owner when dropped? |
<Major_RS> first one (create): send only to the player who dropped it at the time they drop it. second one (dropped): send to everyone, the client of the player who dropped it filters it out so it doesnt show twice |
Oh yeah nvm this is intended, the method names aren't very useful though. Maybe we should move |
Understood, so when an item is dropped, then both need to get called? How does create know which player dropped the item? |
Use |
OK, That makes sense. Thank you! |
So this is the test I wrote import org.apollo.game.action.Action
import org.apollo.game.message.impl.InventoryItemMessage
import org.apollo.game.model.Item
import org.apollo.game.model.entity.Entity
import org.apollo.game.model.entity.EntityType
import org.apollo.game.model.entity.GroundItem
import org.apollo.game.model.entity.Player
class DropItemAction(val player: Player, val item: Int): Action<Player>(0, true, player) {
override fun execute() {
val region = player.world.regionRepository.fromPosition(player.position)
if (region.getEntities<Entity>(player.position, EntityType.DYNAMIC_OBJECT, EntityType.STATIC_OBJECT).isEmpty()) {
val amount = player.inventory.getAmount(item)
System.out.println(amount)
player.inventory.remove(item, amount)
val groundItem = GroundItem.dropped(player.world, player.position, Item(item, amount), player)
player.world.spawn(groundItem)
} else {
player.sendMessage("You cannot drop this here.")
}
stop()
}
}
on {InventoryItemMessage::class}
.where {option == 5 && interfaceId == 3214}
.then {
it.startAction(DropItemAction(it, id))
terminate()
} When I drop an item I cannot see it, but other clients can immediately. After 60 seconds there is still no change. If I change it to use GroundItem.create then the item shows on all clients immediately. |
Yeah looks like nobody ever got round to writing a Task that replaces the private dropped items with public ones |
So we need some sort of management for dropping/spawning grounditems basically (edit: Oops deleting that comment was an accident, sorry) |
No worries! |
Blocking #349 |
Hello,
So I was doing some tests.
Performing
Does not show anything in the world
But doing
Does show the items in the world.
I think this is an issue, or are we only supposed to run GroundItem.create when we want an item to be visible?
The text was updated successfully, but these errors were encountered: