28 #ifndef ELEMENT_EMITTER_H
29 #define ELEMENT_EMITTER_H
43 #define EMITTER_VERSION 1
44 #define DATA_CREATE_PER_1000 150
50 typedef typename CC::ATOM_TYPE T;
51 typedef typename CC::PARAM_CONFIG P;
52 enum { R = P::EVENT_WINDOW_RADIUS };
66 this->SetGap(defaultAtom,2);
94 return "This vertically-reproducing Element emits DATA atoms with randomly generated "
102 this->ReproduceVertically(window);
104 if(random.
OddsOf(DATA_CREATE_PER_1000,1000))
109 u64 * datap = et.GetDataAndRegister(this->
GetType(), DATA_SLOT_COUNT);
110 ++datap[DATUMS_EMITTED_SLOT];
114 for (u32 ring = 1; ring <= 2; ++ring)
116 u32 emptiesFound = 0;
120 const SPoint sp = md.GetPoint(idx);
126 const u32 otherType = other.GetType();
128 if (isEmpty && random.
OneIn(++emptiesFound))
131 if (emptiesFound > 0)
140 ++datap[DATUMS_REJECTED_SLOT];
146 Element_Emitter<CC> Element_Emitter<CC>::THE_INSTANCE;
u32 GetFirstIndex(const u32 radius) const
Definition: MDist.h:112
u32 GetType() const
Definition: Element.h:290
Definition: Element_Empty.h:41
Definition: Element_Data.h:47
u32 GetLastIndex(const u32 radius) const
Definition: MDist.h:129
Tile< CC > & GetTile()
Definition: EventWindow.h:132
void SetName(const char *name)
Definition: Element.h:209
void SetAtomicSymbol(const char *symbol)
Definition: Element.h:193
virtual T BuildDefaultAtom() const
Definition: Element_Emitter.h:64
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
bool OddsOf(u32 thisMany, u32 outOfThisMany)
Definition: Random.h:183
virtual const T & GetDefaultAtom() const
Definition: Element_Data.h:102
Definition: AbstractElement_Reprovert.h:42
virtual void Behavior(EventWindow< CC > &window) const
Definition: Element_Emitter.h:98
static MDist< R > & get()
Definition: MDist.tcc:193
virtual u32 PercentMovable(const T &you, const T &me, const SPoint &offset) const
Definition: Element_Emitter.h:77
Definition: EventWindow.h:41
Definition: ElementTable.h:46
virtual u32 DefaultLowlightColor() const
Definition: Element_Emitter.h:87
ElementTable< CC > & GetElementTable()
Definition: Tile.h:599
s32 Between(s32 min, s32 max)
Definition: Random.h:188
Definition: ElementTable.h:43
virtual u32 DefaultPhysicsColor() const
Definition: Element_Emitter.h:82
bool SetRelativeAtom(const SPoint &offset, const T &atom)
Definition: EventWindow.tcc:15
Definition: Element_Emitter.h:47
virtual const char * GetDescription() const
Definition: Element_Emitter.h:92