From a3d619bdd06f53c8ab53bf49429c107a2709b37e Mon Sep 17 00:00:00 2001 From: Rendo Date: Sat, 15 Feb 2025 20:24:25 +0500 Subject: [PATCH] Property :+1:, basic properties and property trait impl --- src/properties/mod.rs | 77 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 74 insertions(+), 3 deletions(-) diff --git a/src/properties/mod.rs b/src/properties/mod.rs index 0a876cd..a326671 100644 --- a/src/properties/mod.rs +++ b/src/properties/mod.rs @@ -1,4 +1,75 @@ -pub trait Properties { - fn check_condition(conditions: T) -> bool; - fn trigger(data: T); +// Базовый трейт для свойства животного +// Интересно, будет ли участвовать в моддинге +pub trait Property { + fn check_condition(self : &Self,conditions: T) -> bool; + fn trigger(self : &Self, data: T); } + +pub enum BaseProperties +{ + Swimmings, + Running, + Mimicry, + HBW, + Grazing, + Poisonous, + TailLoss, + Communication, + Hibernation, + Scavenger, + Symbiosis, + Piracy, + Cooperation, + Burrowing, + Camouflage, + SharpVision, + Parasite +} + +impl Property for BaseProperties { + fn check_condition(self : &Self, conditions: T) -> bool { + match self + { + BaseProperties::Swimmings => todo!(), + BaseProperties::Running => todo!(), + BaseProperties::Mimicry => todo!(), + BaseProperties::HBW => todo!(), + BaseProperties::Grazing => todo!(), + BaseProperties::Poisonous => todo!(), + BaseProperties::TailLoss => todo!(), + BaseProperties::Communication => todo!(), + BaseProperties::Hibernation => todo!(), + BaseProperties::Scavenger => todo!(), + BaseProperties::Symbiosis => todo!(), + BaseProperties::Piracy => todo!(), + BaseProperties::Cooperation => todo!(), + BaseProperties::Burrowing => todo!(), + BaseProperties::Camouflage => todo!(), + BaseProperties::SharpVision => todo!(), + BaseProperties::Parasite => todo!(), + } + } + + fn trigger(self : &Self, data: T) { + match self + { + BaseProperties::Swimmings => todo!(), + BaseProperties::Running => todo!(), + BaseProperties::Mimicry => todo!(), + BaseProperties::HBW => todo!(), + BaseProperties::Grazing => todo!(), + BaseProperties::Poisonous => todo!(), + BaseProperties::TailLoss => todo!(), + BaseProperties::Communication => todo!(), + BaseProperties::Hibernation => todo!(), + BaseProperties::Scavenger => todo!(), + BaseProperties::Symbiosis => todo!(), + BaseProperties::Piracy => todo!(), + BaseProperties::Cooperation => todo!(), + BaseProperties::Burrowing => todo!(), + BaseProperties::Camouflage => todo!(), + BaseProperties::SharpVision => todo!(), + BaseProperties::Parasite => todo!(), + } + } +} \ No newline at end of file