28 #ifndef ELEMENT_DREG_H
29 #define ELEMENT_DREG_H
44 #define DREG_VERSION 1
50 typedef typename CC::ATOM_TYPE T;
51 typedef typename CC::PARAM_CONFIG P;
52 enum { R = P::EVENT_WINDOW_RADIUS };
67 m_resOdds(
this,
"res",
"Res Spawn Odds",
"Chance of filling an empty site with a Res", 1, 200, 1000),
68 m_deleteOdds(
this,
"del",
"Delete Odds",
"Chance of deleting an adjacent non-empty non-Dreg", 1, 100, 1000),
69 m_dregCreateOdds(
this,
"dreg",
"Dreg Spawn Odds",
"Chance of filling an empty site with a Dreg", 1, 500, 1000),
70 m_dregDeleteOdds(
this,
"ddreg",
"Delete Dreg Odds",
"Chance of deleting an adjacent Dreg", 1, 50, 1000)
77 const T& me,
const SPoint& offset)
const
94 return "Short for \"Dynamic Regulator\", This Atom controls the density of "
95 "nearby Atoms by creating RES atoms and deleting nearby atoms.";
108 u32 oldType = atom.GetType();
112 if(random.
OneIn(m_dregCreateOdds.GetValue()))
116 else if(random.
OneIn(m_resOdds.GetValue()))
121 else if(oldType == Element_Dreg::THE_INSTANCE.
GetType())
123 if(random.
OneIn(m_dregDeleteOdds.GetValue()))
133 if(atom.GetType() != oldType)
143 Element_Dreg<CC> Element_Dreg<CC>::THE_INSTANCE;
void Diffuse(EventWindow< CC > &window) const
Definition: Element.tcc:73
u32 GetType() const
Definition: Element.h:290
Definition: Element_Empty.h:41
virtual u32 PercentMovable(const T &you, const T &me, const SPoint &offset) const
Definition: Element_Dreg.h:76
void SetName(const char *name)
Definition: Element.h:209
void SetAtomicSymbol(const char *symbol)
Definition: Element.h:193
virtual u32 DefaultPhysicsColor() const
Definition: Element_Dreg.h:82
bool IsLiveSite(const SPoint &location) const
Definition: EventWindow.h:148
bool OneIn(u32 odds)
Definition: Random.h:96
Random & GetRandom()
Definition: EventWindow.h:122
const T & GetRelativeAtom(const SPoint &offset) const
Definition: EventWindow.tcc:26
Definition: Element_Dreg.h:47
Definition: Parameter.h:593
virtual const T & GetDefaultAtom() const
Definition: Element.h:382
bool IsType(u32 type) const
Definition: Element.h:345
static MDist< R > & get()
Definition: MDist.tcc:193
virtual u32 DefaultLowlightColor() const
Definition: Element_Dreg.h:87
Definition: Element_Res.h:48
virtual void Behavior(EventWindow< CC > &window) const
Definition: Element_Dreg.h:98
Definition: Element_Wall.h:42
Definition: ElementTable.h:43
bool SetRelativeAtom(const SPoint &offset, const T &atom)
Definition: EventWindow.tcc:15
virtual const char * GetDescription() const
Definition: Element_Dreg.h:92