mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Cleaning
This commit is contained in:
@ -862,13 +862,6 @@ impl Component for Item {
|
|||||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
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)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct ItemDrop(pub Item);
|
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(_))
|
Some(comp::Alignment::Owned(_))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Only drop loot if entity has agency (not a player), and if it is not owned by
|
// Only drop loot if entity has agency (not a player),
|
||||||
// another entity (not a pet)
|
// and if it is not owned by another entity (not a pet)
|
||||||
|
|
||||||
// Decide for a loot drop before turning into a lootbag
|
// Decide for a loot drop before turning into a lootbag
|
||||||
let old_body = state.ecs().write_storage::<Body>().remove(entity);
|
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>();
|
let mut item_drop = state.ecs().write_storage::<comp::ItemDrop>();
|
||||||
item_drop.remove(entity).map(|comp::ItemDrop(item)| item)
|
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 pos = state.ecs().read_storage::<comp::Pos>().get(entity).cloned();
|
||||||
let vel = state.ecs().read_storage::<comp::Vel>().get(entity).cloned();
|
let vel = state.ecs().read_storage::<comp::Vel>().get(entity).cloned();
|
||||||
if let Some(pos) = pos {
|
if let Some(pos) = pos {
|
||||||
|
Reference in New Issue
Block a user