feat: add AI to more entities
This commit is contained in:
1 parent
88a38f74be
commit
05763ea19c
17 files changed
+278
-26
No files matched your search
@@ -64,7 +64,7 @@ impl Goal for CreeperIgniteGoal {
|
|||||||
let target_lock = mob.get_mob_entity().target.lock().await;
|
let target_lock = mob.get_mob_entity().target.lock().await;
|
||||||
|
|
||||||
let Some(target) = target_lock.as_ref() else {
|
let Some(target) = target_lock.as_ref() else {
|
||||||
self.creeper.set_fuse_speed(-1).await;
|
self.creeper.set_fuse_speed(-1);
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -75,11 +75,11 @@ impl Goal for CreeperIgniteGoal {
|
|||||||
.squared_distance_to_vec(&target.get_entity().pos.load());
|
.squared_distance_to_vec(&target.get_entity().pos.load());
|
||||||
|
|
||||||
if dist_sq > 49.0 {
|
if dist_sq > 49.0 {
|
||||||
self.creeper.set_fuse_speed(-1).await;
|
self.creeper.set_fuse_speed(-1);
|
||||||
}
|
}
|
||||||
// TODO: Check line of sight
|
// TODO: Check line of sight
|
||||||
else {
|
else {
|
||||||
self.creeper.set_fuse_speed(1).await;
|
self.creeper.set_fuse_speed(1);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ impl MeleeAttackGoal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
pub fn get_max_cooldown(&self) -> i32 {
|
pub fn get_max_cooldown(&self) -> i32 {
|
||||||
self.get_tick_count(20)
|
self.get_tick_count(20)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ pub mod creeper_ignite;
|
|||||||
pub mod goal_selector;
|
pub mod goal_selector;
|
||||||
pub mod look_around;
|
pub mod look_around;
|
||||||
pub mod look_at_entity;
|
pub mod look_at_entity;
|
||||||
mod melee_attack;
|
pub mod melee_attack;
|
||||||
pub mod move_to_target_pos;
|
pub mod move_to_target_pos;
|
||||||
pub mod step_and_destroy_block;
|
pub mod step_and_destroy_block;
|
||||||
mod track_target;
|
mod track_target;
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ use std::sync::{
|
|||||||
atomic::{AtomicI32, Ordering},
|
atomic::{AtomicI32, Ordering},
|
||||||
};
|
};
|
||||||
|
|
||||||
use pumpkin_data::{entity::EntityType, meta_data_type::MetaDataType, tracked_data::TrackedData};
|
use pumpkin_data::entity::EntityType;
|
||||||
use pumpkin_protocol::java::client::play::Metadata;
|
|
||||||
|
|
||||||
use crate::entity::{
|
use crate::entity::{
|
||||||
Entity, NBTStorage,
|
Entity, NBTStorage,
|
||||||
ai::goal::{
|
ai::goal::{
|
||||||
active_target::ActiveTargetGoal, creeper_ignite::CreeperIgniteGoal,
|
active_target::ActiveTargetGoal, creeper_ignite::CreeperIgniteGoal,
|
||||||
look_around::LookAroundGoal, look_at_entity::LookAtEntityGoal,
|
look_around::LookAroundGoal, look_at_entity::LookAtEntityGoal,
|
||||||
|
melee_attack::MeleeAttackGoal,
|
||||||
},
|
},
|
||||||
mob::{Mob, MobEntity},
|
mob::{Mob, MobEntity},
|
||||||
};
|
};
|
||||||
@@ -33,11 +33,14 @@ impl CreeperEntity {
|
|||||||
Arc::downgrade(&mob_arc)
|
Arc::downgrade(&mob_arc)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO
|
||||||
{
|
{
|
||||||
let mut goal_selector = mob_arc.mob_entity.goals_selector.lock().await;
|
let mut goal_selector = mob_arc.mob_entity.goals_selector.lock().await;
|
||||||
let mut target_selector = mob_arc.mob_entity.target_selector.lock().await;
|
let mut target_selector = mob_arc.mob_entity.target_selector.lock().await;
|
||||||
|
|
||||||
goal_selector.add_goal(2, Box::new(CreeperIgniteGoal::new(mob_arc.clone())));
|
goal_selector.add_goal(2, Box::new(CreeperIgniteGoal::new(mob_arc.clone())));
|
||||||
|
goal_selector.add_goal(4, Box::new(MeleeAttackGoal::new(1.0, false)));
|
||||||
|
|
||||||
goal_selector.add_goal(
|
goal_selector.add_goal(
|
||||||
6,
|
6,
|
||||||
LookAtEntityGoal::with_default(mob_weak, &EntityType::PLAYER, 8.0),
|
LookAtEntityGoal::with_default(mob_weak, &EntityType::PLAYER, 8.0),
|
||||||
@@ -53,17 +56,18 @@ impl CreeperEntity {
|
|||||||
mob_arc
|
mob_arc
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn set_fuse_speed(&self, speed: i32) {
|
pub fn set_fuse_speed(&self, speed: i32) {
|
||||||
self.fuse_speed.store(speed, Ordering::Relaxed);
|
self.fuse_speed.store(speed, Ordering::Relaxed);
|
||||||
self.mob_entity
|
// TODO: fix this
|
||||||
.living_entity
|
// self.mob_entity
|
||||||
.entity
|
// .living_entity
|
||||||
.send_meta_data(&[Metadata::new(
|
// .entity
|
||||||
TrackedData::DATA_FUSE_SPEED,
|
// .send_meta_data(&[Metadata::new(
|
||||||
MetaDataType::Integer,
|
// TrackedData::DATA_FUSE_SPEED,
|
||||||
speed,
|
// MetaDataType::Integer,
|
||||||
)])
|
// speed,
|
||||||
.await;
|
// )])
|
||||||
|
// .await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
use std::sync::{Arc, Weak};
|
||||||
|
|
||||||
|
use pumpkin_data::entity::EntityType;
|
||||||
|
|
||||||
|
use crate::entity::{
|
||||||
|
Entity, NBTStorage,
|
||||||
|
ai::goal::{
|
||||||
|
look_around::LookAroundGoal, look_at_entity::LookAtEntityGoal,
|
||||||
|
melee_attack::MeleeAttackGoal,
|
||||||
|
},
|
||||||
|
mob::{Mob, MobEntity},
|
||||||
|
};
|
||||||
|
|
||||||
|
pub struct EndermanEntity {
|
||||||
|
pub mob_entity: MobEntity,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl EndermanEntity {
|
||||||
|
pub async fn new(entity: Entity) -> Arc<Self> {
|
||||||
|
let mob_entity = MobEntity::new(entity);
|
||||||
|
let mob = Self { mob_entity };
|
||||||
|
let mob_arc = Arc::new(mob);
|
||||||
|
let mob_weak: Weak<dyn Mob> = {
|
||||||
|
let mob_arc: Arc<dyn Mob> = mob_arc.clone();
|
||||||
|
Arc::downgrade(&mob_arc)
|
||||||
|
};
|
||||||
|
{
|
||||||
|
let mut goal_selector = mob_arc.mob_entity.goals_selector.lock().await;
|
||||||
|
|
||||||
|
goal_selector.add_goal(2, Box::new(MeleeAttackGoal::new(1.0, false)));
|
||||||
|
|
||||||
|
goal_selector.add_goal(
|
||||||
|
8,
|
||||||
|
LookAtEntityGoal::with_default(mob_weak, &EntityType::PLAYER, 8.0),
|
||||||
|
);
|
||||||
|
goal_selector.add_goal(8, Box::new(LookAroundGoal::default()));
|
||||||
|
};
|
||||||
|
|
||||||
|
mob_arc
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl NBTStorage for EndermanEntity {}
|
||||||
|
|
||||||
|
impl Mob for EndermanEntity {
|
||||||
|
fn get_mob_entity(&self) -> &MobEntity {
|
||||||
|
&self.mob_entity
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,7 +19,7 @@ use std::sync::atomic::{AtomicI32, AtomicU8, Ordering};
|
|||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
|
|
||||||
pub mod creeper;
|
pub mod creeper;
|
||||||
pub mod drowned;
|
pub mod enderman;
|
||||||
pub mod silverfish;
|
pub mod silverfish;
|
||||||
pub mod skeleton;
|
pub mod skeleton;
|
||||||
pub mod zombie;
|
pub mod zombie;
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use crate::entity::{
|
||||||
|
Entity, NBTStorage,
|
||||||
|
mob::{Mob, MobEntity, skeleton::SkeletonEntityBase},
|
||||||
|
};
|
||||||
|
|
||||||
|
pub struct BoggedSkeletonEntity {
|
||||||
|
entity: Arc<SkeletonEntityBase>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl BoggedSkeletonEntity {
|
||||||
|
pub async fn new(entity: Entity) -> Arc<Self> {
|
||||||
|
let entity = SkeletonEntityBase::new(entity).await;
|
||||||
|
let zombie = Self { entity };
|
||||||
|
Arc::new(zombie)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl NBTStorage for BoggedSkeletonEntity {}
|
||||||
|
|
||||||
|
impl Mob for BoggedSkeletonEntity {
|
||||||
|
fn get_mob_entity(&self) -> &MobEntity {
|
||||||
|
&self.entity.mob_entity
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,14 +11,19 @@ use crate::entity::{
|
|||||||
mob::{Mob, MobEntity},
|
mob::{Mob, MobEntity},
|
||||||
};
|
};
|
||||||
|
|
||||||
//pub mod skeleton;
|
pub mod bogged;
|
||||||
|
pub mod parched;
|
||||||
|
#[allow(clippy::module_inception)]
|
||||||
|
pub mod skeleton;
|
||||||
|
pub mod stray;
|
||||||
|
pub mod wither;
|
||||||
|
|
||||||
pub struct SkeletonEntityBase {
|
pub struct SkeletonEntityBase {
|
||||||
pub mob_entity: MobEntity,
|
pub mob_entity: MobEntity,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SkeletonEntityBase {
|
impl SkeletonEntityBase {
|
||||||
pub async fn make(entity: Entity) -> Arc<Self> {
|
pub async fn new(entity: Entity) -> Arc<Self> {
|
||||||
let mob_entity = MobEntity::new(entity);
|
let mob_entity = MobEntity::new(entity);
|
||||||
let mob = Self { mob_entity };
|
let mob = Self { mob_entity };
|
||||||
let mob_arc = Arc::new(mob);
|
let mob_arc = Arc::new(mob);
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use crate::entity::{
|
||||||
|
Entity, NBTStorage,
|
||||||
|
mob::{Mob, MobEntity, skeleton::SkeletonEntityBase},
|
||||||
|
};
|
||||||
|
|
||||||
|
pub struct ParchedSkeletonEntity {
|
||||||
|
entity: Arc<SkeletonEntityBase>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ParchedSkeletonEntity {
|
||||||
|
pub async fn new(entity: Entity) -> Arc<Self> {
|
||||||
|
let entity = SkeletonEntityBase::new(entity).await;
|
||||||
|
let zombie = Self { entity };
|
||||||
|
Arc::new(zombie)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl NBTStorage for ParchedSkeletonEntity {}
|
||||||
|
|
||||||
|
impl Mob for ParchedSkeletonEntity {
|
||||||
|
fn get_mob_entity(&self) -> &MobEntity {
|
||||||
|
&self.entity.mob_entity
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use crate::entity::{
|
||||||
|
Entity, NBTStorage,
|
||||||
|
mob::{Mob, MobEntity, skeleton::SkeletonEntityBase},
|
||||||
|
};
|
||||||
|
|
||||||
|
pub struct SkeletonEntity {
|
||||||
|
entity: Arc<SkeletonEntityBase>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SkeletonEntity {
|
||||||
|
pub async fn new(entity: Entity) -> Arc<Self> {
|
||||||
|
let entity = SkeletonEntityBase::new(entity).await;
|
||||||
|
let zombie = Self { entity };
|
||||||
|
Arc::new(zombie)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl NBTStorage for SkeletonEntity {}
|
||||||
|
|
||||||
|
impl Mob for SkeletonEntity {
|
||||||
|
fn get_mob_entity(&self) -> &MobEntity {
|
||||||
|
&self.entity.mob_entity
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use crate::entity::{
|
||||||
|
Entity, NBTStorage,
|
||||||
|
mob::{Mob, MobEntity, skeleton::SkeletonEntityBase},
|
||||||
|
};
|
||||||
|
|
||||||
|
pub struct StraySkeletonEntity {
|
||||||
|
entity: Arc<SkeletonEntityBase>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl StraySkeletonEntity {
|
||||||
|
pub async fn new(entity: Entity) -> Arc<Self> {
|
||||||
|
let entity = SkeletonEntityBase::new(entity).await;
|
||||||
|
let zombie = Self { entity };
|
||||||
|
Arc::new(zombie)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl NBTStorage for StraySkeletonEntity {}
|
||||||
|
|
||||||
|
impl Mob for StraySkeletonEntity {
|
||||||
|
fn get_mob_entity(&self) -> &MobEntity {
|
||||||
|
&self.entity.mob_entity
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use crate::entity::{
|
||||||
|
Entity, NBTStorage,
|
||||||
|
mob::{Mob, MobEntity, skeleton::SkeletonEntityBase},
|
||||||
|
};
|
||||||
|
|
||||||
|
pub struct WitherSkeletonEntity {
|
||||||
|
entity: Arc<SkeletonEntityBase>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl WitherSkeletonEntity {
|
||||||
|
pub async fn new(entity: Entity) -> Arc<Self> {
|
||||||
|
let entity = SkeletonEntityBase::new(entity).await;
|
||||||
|
let zombie = Self { entity };
|
||||||
|
Arc::new(zombie)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl NBTStorage for WitherSkeletonEntity {}
|
||||||
|
|
||||||
|
impl Mob for WitherSkeletonEntity {
|
||||||
|
fn get_mob_entity(&self) -> &MobEntity {
|
||||||
|
&self.entity.mob_entity
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use crate::entity::{
|
||||||
|
Entity, NBTStorage,
|
||||||
|
mob::{Mob, MobEntity, zombie::ZombieEntity},
|
||||||
|
};
|
||||||
|
|
||||||
|
pub struct DrownedEntity {
|
||||||
|
entity: Arc<ZombieEntity>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DrownedEntity {
|
||||||
|
pub async fn new(entity: Entity) -> Arc<Self> {
|
||||||
|
let entity = ZombieEntity::new(entity).await;
|
||||||
|
let zombie = Self { entity };
|
||||||
|
let mob_arc = Arc::new(zombie);
|
||||||
|
// Fix duplicated since already in ZombieEntity::new()
|
||||||
|
{
|
||||||
|
//let mut target_selector = mob_arc.entity.mob_entity.target_selector.lock().await;
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
// target_selector.add_goal(
|
||||||
|
// 2,
|
||||||
|
// ActiveTargetGoal::with_default(
|
||||||
|
// &mob_arc.entity.mob_entity,
|
||||||
|
// &EntityType::PLAYER,
|
||||||
|
// true,
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
};
|
||||||
|
|
||||||
|
mob_arc
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl NBTStorage for DrownedEntity {}
|
||||||
|
|
||||||
|
impl Mob for DrownedEntity {
|
||||||
|
fn get_mob_entity(&self) -> &MobEntity {
|
||||||
|
&self.entity.mob_entity
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,11 +8,11 @@ use crate::entity::{
|
|||||||
mob::{Mob, MobEntity, zombie::ZombieEntity},
|
mob::{Mob, MobEntity, zombie::ZombieEntity},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct DrownedEntity {
|
pub struct HuskEntity {
|
||||||
entity: Arc<ZombieEntity>,
|
entity: Arc<ZombieEntity>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DrownedEntity {
|
impl HuskEntity {
|
||||||
pub async fn new(entity: Entity) -> Arc<Self> {
|
pub async fn new(entity: Entity) -> Arc<Self> {
|
||||||
let entity = ZombieEntity::new(entity).await;
|
let entity = ZombieEntity::new(entity).await;
|
||||||
let zombie = Self { entity };
|
let zombie = Self { entity };
|
||||||
@@ -36,9 +36,9 @@ impl DrownedEntity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NBTStorage for DrownedEntity {}
|
impl NBTStorage for HuskEntity {}
|
||||||
|
|
||||||
impl Mob for DrownedEntity {
|
impl Mob for HuskEntity {
|
||||||
fn get_mob_entity(&self) -> &MobEntity {
|
fn get_mob_entity(&self) -> &MobEntity {
|
||||||
&self.entity.mob_entity
|
&self.entity.mob_entity
|
||||||
}
|
}
|
||||||
@@ -19,6 +19,9 @@ use rand::{RngExt, rng};
|
|||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::sync::{Arc, Weak};
|
use std::sync::{Arc, Weak};
|
||||||
|
|
||||||
|
pub mod drowned;
|
||||||
|
pub mod husk;
|
||||||
|
|
||||||
pub struct ZombieEntity {
|
pub struct ZombieEntity {
|
||||||
pub mob_entity: MobEntity,
|
pub mob_entity: MobEntity,
|
||||||
}
|
}
|
||||||
@@ -13,8 +13,15 @@ use crate::{
|
|||||||
},
|
},
|
||||||
living::LivingEntity,
|
living::LivingEntity,
|
||||||
mob::{
|
mob::{
|
||||||
creeper::CreeperEntity, drowned::DrownedEntity, silverfish::SilverfishEntity,
|
creeper::CreeperEntity,
|
||||||
zombie::ZombieEntity, zombie_villager::ZombieVillagerEntity,
|
enderman::EndermanEntity,
|
||||||
|
silverfish::SilverfishEntity,
|
||||||
|
skeleton::{
|
||||||
|
bogged::BoggedSkeletonEntity, parched::ParchedSkeletonEntity,
|
||||||
|
skeleton::SkeletonEntity, stray::StraySkeletonEntity, wither::WitherSkeletonEntity,
|
||||||
|
},
|
||||||
|
zombie::{ZombieEntity, drowned::DrownedEntity, husk::HuskEntity},
|
||||||
|
zombie_villager::ZombieVillagerEntity,
|
||||||
},
|
},
|
||||||
passive::{iron_golem::IronGolemEntity, snow_golem::SnowGolemEntity, wolf::WolfEntity},
|
passive::{iron_golem::IronGolemEntity, snow_golem::SnowGolemEntity, wolf::WolfEntity},
|
||||||
},
|
},
|
||||||
@@ -30,10 +37,22 @@ pub async fn from_type(
|
|||||||
let entity = Entity::from_uuid(uuid, world.clone(), position, entity_type);
|
let entity = Entity::from_uuid(uuid, world.clone(), position, entity_type);
|
||||||
|
|
||||||
let mob: Arc<dyn EntityBase> = match entity_type.id {
|
let mob: Arc<dyn EntityBase> = match entity_type.id {
|
||||||
|
// Zombie
|
||||||
id if id == EntityType::ZOMBIE.id => ZombieEntity::new(entity).await,
|
id if id == EntityType::ZOMBIE.id => ZombieEntity::new(entity).await,
|
||||||
id if id == EntityType::DROWNED.id => DrownedEntity::new(entity).await,
|
id if id == EntityType::DROWNED.id => DrownedEntity::new(entity).await,
|
||||||
|
id if id == EntityType::HUSK.id => HuskEntity::new(entity).await,
|
||||||
id if id == EntityType::ZOMBIE_VILLAGER.id => ZombieVillagerEntity::new(entity).await,
|
id if id == EntityType::ZOMBIE_VILLAGER.id => ZombieVillagerEntity::new(entity).await,
|
||||||
|
|
||||||
|
// Sekelton
|
||||||
|
id if id == EntityType::SKELETON.id => SkeletonEntity::new(entity).await,
|
||||||
|
id if id == EntityType::BOGGED.id => BoggedSkeletonEntity::new(entity).await,
|
||||||
|
id if id == EntityType::PARCHED.id => ParchedSkeletonEntity::new(entity).await,
|
||||||
|
id if id == EntityType::WITHER_SKELETON.id => WitherSkeletonEntity::new(entity).await,
|
||||||
|
id if id == EntityType::STRAY.id => StraySkeletonEntity::new(entity).await,
|
||||||
|
|
||||||
id if id == EntityType::CREEPER.id => CreeperEntity::new(entity).await,
|
id if id == EntityType::CREEPER.id => CreeperEntity::new(entity).await,
|
||||||
|
id if id == EntityType::ENDERMAN.id => EndermanEntity::new(entity).await,
|
||||||
|
|
||||||
id if id == EntityType::SNOW_GOLEM.id => SnowGolemEntity::new(entity).await,
|
id if id == EntityType::SNOW_GOLEM.id => SnowGolemEntity::new(entity).await,
|
||||||
id if id == EntityType::IRON_GOLEM.id => IronGolemEntity::new(entity).await,
|
id if id == EntityType::IRON_GOLEM.id => IronGolemEntity::new(entity).await,
|
||||||
id if id == EntityType::WOLF.id => WolfEntity::new(entity).await,
|
id if id == EntityType::WOLF.id => WolfEntity::new(entity).await,
|
||||||
|
|||||||
@@ -240,7 +240,6 @@ impl ReadlineLogWrapper {
|
|||||||
.map_or_else(|_| None, |mut result| result.take())
|
.map_or_else(|_| None, |mut result| result.take())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub(crate) fn return_readline(&self, rl: Editor<PumpkinCommandCompleter, FileHistory>) {
|
pub(crate) fn return_readline(&self, rl: Editor<PumpkinCommandCompleter, FileHistory>) {
|
||||||
if let Ok(mut result) = self.readline.lock() {
|
if let Ok(mut result) = self.readline.lock() {
|
||||||
let _ = result.insert(rl);
|
let _ = result.insert(rl);
|
||||||
|
|||||||
Reference in new issue
Block a user