mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Cleaning
This commit is contained in:
parent
7291d32209
commit
68aba856ec
@ -862,13 +862,6 @@ impl Component for Item {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
}
|
||||
|
||||
// #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
// pub struct ItemDrop<T: AsRef<str>>(pub LootSpec<T>);
|
||||
|
||||
// impl<T: 'static + Send + Sync + AsRef<str>> Component for ItemDrop<T> {
|
||||
// type Storage = IdvStorage<Self>;
|
||||
// }
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ItemDrop(pub Item);
|
||||
|
||||
|
@ -346,18 +346,18 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, last_change: Healt
|
||||
Some(comp::Alignment::Owned(_))
|
||||
)
|
||||
{
|
||||
// Only drop loot if entity has agency (not a player), and if it is not owned by
|
||||
// another entity (not a pet)
|
||||
// Only drop loot if entity has agency (not a player),
|
||||
// and if it is not owned by another entity (not a pet)
|
||||
|
||||
// Decide for a loot drop before turning into a lootbag
|
||||
let old_body = state.ecs().write_storage::<Body>().remove(entity);
|
||||
|
||||
let loot_spec = {
|
||||
let item = {
|
||||
let mut item_drop = state.ecs().write_storage::<comp::ItemDrop>();
|
||||
item_drop.remove(entity).map(|comp::ItemDrop(item)| item)
|
||||
};
|
||||
|
||||
if let Some(item) = loot_spec {
|
||||
if let Some(item) = item {
|
||||
let pos = state.ecs().read_storage::<comp::Pos>().get(entity).cloned();
|
||||
let vel = state.ecs().read_storage::<comp::Vel>().get(entity).cloned();
|
||||
if let Some(pos) = pos {
|
||||
|
Loading…
Reference in New Issue
Block a user