Horizon Official Technical Documentation
Horizon::Zone::MonsterComponent Class Reference

#include <MonsterComponent.hpp>

+ Inheritance diagram for Horizon::Zone::MonsterComponent:
+ Collaboration diagram for Horizon::Zone::MonsterComponent:

Public Member Functions

 MonsterComponent ()
 
 MonsterComponent (std::shared_ptr< GameLogicProcess > container)
 
 ~MonsterComponent ()
 
void sync_definitions (std::shared_ptr< sol::state > state)
 
void sync_data_types (std::shared_ptr< sol::state > state)
 
void sync_functions (std::shared_ptr< sol::state > state)
 
- Public Member Functions inherited from Horizon::Zone::LUAComponent
 LUAComponent ()
 
 LUAComponent (std::shared_ptr< GameLogicProcess > container)
 
 ~LUAComponent ()
 
virtual void sync_definitions (std::shared_ptr< sol::state > state)=0
 
virtual void sync_data_types (std::shared_ptr< sol::state > state)=0
 
virtual void sync_functions (std::shared_ptr< sol::state > state)=0
 
std::shared_ptr< GameLogicProcessget_container ()
 

Constructor & Destructor Documentation

◆ MonsterComponent() [1/2]

Horizon::Zone::MonsterComponent::MonsterComponent ( )
inline
46{ }

◆ MonsterComponent() [2/2]

Horizon::Zone::MonsterComponent::MonsterComponent ( std::shared_ptr< GameLogicProcess container)
inline
48 : LUAComponent(container) { }
LUAComponent()
Definition: LUAComponent.hpp:42

◆ ~MonsterComponent()

Horizon::Zone::MonsterComponent::~MonsterComponent ( )
inline
49{ }

Member Function Documentation

◆ sync_data_types()

void MonsterComponent::sync_data_types ( std::shared_ptr< sol::state >  state)
virtual

Implements Horizon::Zone::LUAComponent.

134{
135 sol::usertype<Monster> config_1 = state->new_usertype<Monster>("Monster");
136 config_1["unit"] = [](std::shared_ptr<Horizon::Zone::Units::Monster> monster) { return monster->shared_from_this(); };
137 config_1["stop_movement"] = &Monster::stop_movement;
138 config_1["on_pathfinding_failure"] = &Monster::on_pathfinding_failure;
139 config_1["on_movement_begin"] = &Monster::on_movement_begin;
140 config_1["on_movement_step"] = &Monster::on_movement_step;
141 config_1["on_movement_end"] = &Monster::on_movement_end;
142 config_1["set_spotted"] = &Monster::set_spotted,
143 config_1["was_spotted_once"] = &Monster::was_spotted_once;
144 config_1["on_status_effect_start"] = &Monster::on_status_effect_start;
145 config_1["on_status_effect_end"] = &Monster::on_status_effect_end;
146 config_1["on_status_effect_change"] = &Monster::on_status_effect_change;
147 config_1["set_next_walk_time"] = &Monster::set_next_walk_time;
148 config_1["next_walk_time"] = &Monster::next_walk_time;
149 config_1["on_damage_received"] = &Monster::on_damage_received;
150}
Definition: Monster.hpp:47

◆ sync_definitions()

void MonsterComponent::sync_definitions ( std::shared_ptr< sol::state >  state)
virtual

Implements Horizon::Zone::LUAComponent.

43{
44 sol::table tbl_1 = state->create_named_table("MonsterRace");
45 tbl_1["Formless"] = (int) MONSTER_RACE_FORMLESS;
46 tbl_1["Undead"] = (int) MONSTER_RACE_UNDEAD;
47 tbl_1["Brute"] = (int) MONSTER_RACE_BRUTE;
48 tbl_1["Plant"] = (int) MONSTER_RACE_PLANT;
49 tbl_1["Insect"] = (int) MONSTER_RACE_INSECT;
50 tbl_1["Fish"] = (int) MONSTER_RACE_FISH;
51 tbl_1["Demon"] = (int) MONSTER_RACE_DEMON;
52 tbl_1["DemiHuman"] = (int) MONSTER_RACE_DEMIHUMAN;
53 tbl_1["Angel"] = (int) MONSTER_RACE_ANGEL;
54 tbl_1["Dragon"] = (int) MONSTER_RACE_DRAGON;
55 tbl_1["Player"] = (int) MONSTER_RACE_PLAYER;
56 tbl_1["Boss"] = (int) MONSTER_RACE_BOSS;
57 tbl_1["NonBoss"] = (int) MONSTER_RACE_NONBOSS;
58
59 sol::table tbl_2 = state->create_named_table("MonsterMode");
60 tbl_2["None"] = (int) MONSTER_MODE_MASK_NONE;
61 tbl_2["CanMove"] = (int) MONSTER_MODE_MASK_CANMOVE;
62 tbl_2["Looter"] = (int) MONSTER_MODE_MASK_LOOTER;
63 tbl_2["Aggressive"] = (int) MONSTER_MODE_MASK_AGGRESSIVE;
64 tbl_2["Assist"] = (int) MONSTER_MODE_MASK_ASSIST;
65 tbl_2["CastSensorIdle"] = (int) MONSTER_MODE_MASK_CASTSENSOR_IDLE;
66 tbl_2["Boss"] = (int) MONSTER_MODE_MASK_BOSS;
67 tbl_2["Plant"] = (int) MONSTER_MODE_MASK_PLANT;
68 tbl_2["CanAttack"] = (int) MONSTER_MODE_MASK_CANATTACK;
69 tbl_2["Detector"] = (int) MONSTER_MODE_MASK_DETECTOR;
70 tbl_2["CastSensorChase"] = (int) MONSTER_MODE_MASK_CASTSENSOR_CHASE;
71 tbl_2["ChangeChase"] = (int) MONSTER_MODE_MASK_CHANGECHASE;
72 tbl_2["Angry"] = (int) MONSTER_MODE_MASK_ANGRY;
73 tbl_2["ChangeTargetMelee"] = (int) MONSTER_MODE_MASK_CHANGETARGET_MELEE;
74 tbl_2["ChangeTargetChase"] = (int) MONSTER_MODE_MASK_CHANGETARGET_CHASE;
75 tbl_2["TargetWeak"] = (int) MONSTER_MODE_MASK_TARGETWEAK;
76 tbl_2["NoKnockBack"] = (int) MONSTER_MODE_MASK_NOKNOCKBACK;
77
78 sol::table tbl_3 = state->create_named_table("MonsterSkillState");
79 tbl_3["Any"] = (int) MONSTER_SKILL_STATE_ANY;
80 tbl_3["Idle"] = (int) MONSTER_SKILL_STATE_IDLE;
81 tbl_3["Walk"] = (int) MONSTER_SKILL_STATE_WALK;
82 tbl_3["Loot"] = (int) MONSTER_SKILL_STATE_LOOT;
83 tbl_3["Dead"] = (int) MONSTER_SKILL_STATE_DEAD;
84 tbl_3["Berserk"] = (int) MONSTER_SKILL_STATE_BERSERK; //Aggressive mob attacking
85 tbl_3["Angry"] = (int) MONSTER_SKILL_STATE_ANGRY; //Mob retaliating from being attacked.
86 tbl_3["Rush"] = (int) MONSTER_SKILL_STATE_RUSH; //Mob following a player after being attacked.
87 tbl_3["Follow"] = (int) MONSTER_SKILL_STATE_FOLLOW; //Mob following a player without being attacked.
88 tbl_3["AnyTarget"] = (int) MONSTER_SKILL_STATE_ANYTARGET;
89
90 sol::table tbl_4 = state->create_named_table("MonsterSkillTarget");
91 tbl_4["CurrentTarget"] = (int) MONSTER_SKILL_TARGET_CURRENT;
92 tbl_4["Random"] = (int) MONSTER_SKILL_TARGET_RANDOM;
93 tbl_4["Self"] = (int) MONSTER_SKILL_TARGET_SELF;
94 tbl_4["Friend"] = (int) MONSTER_SKILL_TARGET_FRIEND;
95 tbl_4["Master"] = (int) MONSTER_SKILL_TARGET_MASTER;
96 tbl_4["Around5"] = (int) MONSTER_SKILL_TARGET_AROUND5;
97 tbl_4["Around6"] = (int) MONSTER_SKILL_TARGET_AROUND6;
98 tbl_4["Around7"] = (int) MONSTER_SKILL_TARGET_AROUND7;
99 tbl_4["Around8"] = (int) MONSTER_SKILL_TARGET_AROUND8;
100 tbl_4["Around1"] = (int) MONSTER_SKILL_TARGET_AROUND1;
101 tbl_4["Around2"] = (int) MONSTER_SKILL_TARGET_AROUND2;
102 tbl_4["Around3"] = (int) MONSTER_SKILL_TARGET_AROUND3;
103 tbl_4["Around4"] = (int) MONSTER_SKILL_TARGET_AROUND4;
104 tbl_4["Around"] = (int) MONSTER_SKILL_TARGET_AROUND;
105
106 sol::table tbl_5 = state->create_named_table("MonsterSkillCastCondition");
107 tbl_5["Always"] = (int) MONSTER_SKILL_CC_ALWAYS;
108 tbl_5["MyHpLtMaxRate"] = (int) MONSTER_SKILL_CC_MYHPLTMAXRATE;
109 tbl_5["MyHpInRate"] = (int) MONSTER_SKILL_CC_MYHPINRATE;
110 tbl_5["FriendHpLtMaxRate"] = (int) MONSTER_SKILL_CC_FRIENDHPLTMAXRATE;
111 tbl_5["FriendHpInRate"] = (int) MONSTER_SKILL_CC_FRIENDHPINRATE;
112 tbl_5["MyStatusOn"] = (int) MONSTER_SKILL_CC_MYSTATUSON;
113 tbl_5["MyStatusOff"] = (int) MONSTER_SKILL_CC_MYSTATUSOFF;
114 tbl_5["FriendStatusOn"] = (int) MONSTER_SKILL_CC_FRIENDSTATUSON;
115 tbl_5["FriendStatusOff"] = (int) MONSTER_SKILL_CC_FRIENDSTATUSOFF;
116 tbl_5["AttackPCGT"] = (int) MONSTER_SKILL_CC_ATTACKPCGT;
117 tbl_5["AttackPCGE"] = (int) MONSTER_SKILL_CC_ATTACKPCGE;
118 tbl_5["SlaveLT"] = (int) MONSTER_SKILL_CC_SLAVELT;
119 tbl_5["SlaveLE"] = (int) MONSTER_SKILL_CC_SLAVELE;
120 tbl_5["CloseRangeAttacked"] = (int) MONSTER_SKILL_CC_CLOSERANGEATTACKED;
121 tbl_5["LongRangeAttacked"] = (int) MONSTER_SKILL_CC_LONGRANGEATTACKED;
122 tbl_5["AfterSkill"] = (int) MONSTER_SKILL_CC_AFTERSKILL;
123 tbl_5["SkillUsed"] = (int) MONSTER_SKILL_CC_SKILLUSED;
124 tbl_5["CastTargeted"] = (int) MONSTER_SKILL_CC_CASTTARGETED;
125 tbl_5["RudeAttacked"] = (int) MONSTER_SKILL_CC_RUDEATTACKED;
126 tbl_5["MasterHPLTMaxRate"] = (int) MONSTER_SKILL_CC_MASTERHPLTMAXRATE;
127 tbl_5["MasterAttacked"] = (int) MONSTER_SKILL_CC_MASTERATTACKED;
128 tbl_5["Alchemist"] = (int) MONSTER_SKILL_CC_ALCHEMIST;
129 tbl_5["Spawn"] = (int) MONSTER_SKILL_CC_SPAWN;
130 tbl_5["MagicAttacked"] = (int) MONSTER_SKILL_CC_MAGICATTACKED;
131}
@ MONSTER_MODE_MASK_TARGETWEAK
Definition: MonsterDefinitions.hpp:105
@ MONSTER_MODE_MASK_LOOTER
Definition: MonsterDefinitions.hpp:92
@ MONSTER_MODE_MASK_CHANGECHASE
Definition: MonsterDefinitions.hpp:101
@ MONSTER_MODE_MASK_CASTSENSOR_IDLE
Definition: MonsterDefinitions.hpp:95
@ MONSTER_MODE_MASK_PLANT
Definition: MonsterDefinitions.hpp:97
@ MONSTER_MODE_MASK_NOKNOCKBACK
Definition: MonsterDefinitions.hpp:106
@ MONSTER_MODE_MASK_BOSS
Definition: MonsterDefinitions.hpp:96
@ MONSTER_MODE_MASK_CANATTACK
Definition: MonsterDefinitions.hpp:98
@ MONSTER_MODE_MASK_CASTSENSOR_CHASE
Definition: MonsterDefinitions.hpp:100
@ MONSTER_MODE_MASK_AGGRESSIVE
Definition: MonsterDefinitions.hpp:93
@ MONSTER_MODE_MASK_CANMOVE
Definition: MonsterDefinitions.hpp:91
@ MONSTER_MODE_MASK_DETECTOR
Definition: MonsterDefinitions.hpp:99
@ MONSTER_MODE_MASK_CHANGETARGET_CHASE
Definition: MonsterDefinitions.hpp:104
@ MONSTER_MODE_MASK_ANGRY
Definition: MonsterDefinitions.hpp:102
@ MONSTER_MODE_MASK_NONE
Definition: MonsterDefinitions.hpp:90
@ MONSTER_MODE_MASK_CHANGETARGET_MELEE
Definition: MonsterDefinitions.hpp:103
@ MONSTER_MODE_MASK_ASSIST
Definition: MonsterDefinitions.hpp:94
@ MONSTER_SKILL_CC_FRIENDSTATUSOFF
Definition: MonsterDefinitions.hpp:151
@ MONSTER_SKILL_CC_FRIENDHPINRATE
Definition: MonsterDefinitions.hpp:147
@ MONSTER_SKILL_CC_FRIENDSTATUSON
Definition: MonsterDefinitions.hpp:150
@ MONSTER_SKILL_CC_SKILLUSED
Definition: MonsterDefinitions.hpp:159
@ MONSTER_SKILL_CC_MAGICATTACKED
Definition: MonsterDefinitions.hpp:166
@ MONSTER_SKILL_CC_MASTERATTACKED
Definition: MonsterDefinitions.hpp:163
@ MONSTER_SKILL_CC_MASTERHPLTMAXRATE
Definition: MonsterDefinitions.hpp:162
@ MONSTER_SKILL_CC_CASTTARGETED
Definition: MonsterDefinitions.hpp:160
@ MONSTER_SKILL_CC_ALWAYS
Definition: MonsterDefinitions.hpp:143
@ MONSTER_SKILL_CC_ATTACKPCGT
Definition: MonsterDefinitions.hpp:152
@ MONSTER_SKILL_CC_CLOSERANGEATTACKED
Definition: MonsterDefinitions.hpp:156
@ MONSTER_SKILL_CC_ALCHEMIST
Definition: MonsterDefinitions.hpp:164
@ MONSTER_SKILL_CC_LONGRANGEATTACKED
Definition: MonsterDefinitions.hpp:157
@ MONSTER_SKILL_CC_MYHPLTMAXRATE
Definition: MonsterDefinitions.hpp:144
@ MONSTER_SKILL_CC_ATTACKPCGE
Definition: MonsterDefinitions.hpp:153
@ MONSTER_SKILL_CC_SLAVELE
Definition: MonsterDefinitions.hpp:155
@ MONSTER_SKILL_CC_FRIENDHPLTMAXRATE
Definition: MonsterDefinitions.hpp:146
@ MONSTER_SKILL_CC_MYSTATUSOFF
Definition: MonsterDefinitions.hpp:149
@ MONSTER_SKILL_CC_AFTERSKILL
Definition: MonsterDefinitions.hpp:158
@ MONSTER_SKILL_CC_SLAVELT
Definition: MonsterDefinitions.hpp:154
@ MONSTER_SKILL_CC_MYSTATUSON
Definition: MonsterDefinitions.hpp:148
@ MONSTER_SKILL_CC_MYHPINRATE
Definition: MonsterDefinitions.hpp:145
@ MONSTER_SKILL_CC_SPAWN
Definition: MonsterDefinitions.hpp:165
@ MONSTER_SKILL_CC_RUDEATTACKED
Definition: MonsterDefinitions.hpp:161
@ MONSTER_RACE_DRAGON
Dragon.
Definition: MonsterDefinitions.hpp:59
@ MONSTER_RACE_ANGEL
Angel.
Definition: MonsterDefinitions.hpp:58
@ MONSTER_RACE_BOSS
Boss.
Definition: MonsterDefinitions.hpp:62
@ MONSTER_RACE_PLANT
Plant.
Definition: MonsterDefinitions.hpp:53
@ MONSTER_RACE_PLAYER
Player.
Definition: MonsterDefinitions.hpp:60
@ MONSTER_RACE_DEMON
Demon.
Definition: MonsterDefinitions.hpp:56
@ MONSTER_RACE_UNDEAD
Undead.
Definition: MonsterDefinitions.hpp:51
@ MONSTER_RACE_DEMIHUMAN
Demi-Human (not including Player)
Definition: MonsterDefinitions.hpp:57
@ MONSTER_RACE_INSECT
Insect.
Definition: MonsterDefinitions.hpp:54
@ MONSTER_RACE_FORMLESS
Formless.
Definition: MonsterDefinitions.hpp:50
@ MONSTER_RACE_FISH
Fish.
Definition: MonsterDefinitions.hpp:55
@ MONSTER_RACE_NONBOSS
Non-boss.
Definition: MonsterDefinitions.hpp:63
@ MONSTER_RACE_BRUTE
Beast/Brute.
Definition: MonsterDefinitions.hpp:52
@ MONSTER_SKILL_TARGET_MASTER
Definition: MonsterDefinitions.hpp:130
@ MONSTER_SKILL_TARGET_AROUND
Definition: MonsterDefinitions.hpp:139
@ MONSTER_SKILL_TARGET_FRIEND
Definition: MonsterDefinitions.hpp:129
@ MONSTER_SKILL_TARGET_AROUND4
Definition: MonsterDefinitions.hpp:138
@ MONSTER_SKILL_TARGET_AROUND6
Definition: MonsterDefinitions.hpp:132
@ MONSTER_SKILL_TARGET_AROUND2
Definition: MonsterDefinitions.hpp:136
@ MONSTER_SKILL_TARGET_AROUND5
Definition: MonsterDefinitions.hpp:131
@ MONSTER_SKILL_TARGET_AROUND8
Definition: MonsterDefinitions.hpp:134
@ MONSTER_SKILL_TARGET_CURRENT
Definition: MonsterDefinitions.hpp:126
@ MONSTER_SKILL_TARGET_AROUND3
Definition: MonsterDefinitions.hpp:137
@ MONSTER_SKILL_TARGET_SELF
Definition: MonsterDefinitions.hpp:128
@ MONSTER_SKILL_TARGET_AROUND7
Definition: MonsterDefinitions.hpp:133
@ MONSTER_SKILL_TARGET_RANDOM
Definition: MonsterDefinitions.hpp:127
@ MONSTER_SKILL_TARGET_AROUND1
Definition: MonsterDefinitions.hpp:135
@ MONSTER_SKILL_STATE_ANYTARGET
Definition: MonsterDefinitions.hpp:122
@ MONSTER_SKILL_STATE_RUSH
Definition: MonsterDefinitions.hpp:120
@ MONSTER_SKILL_STATE_BERSERK
Definition: MonsterDefinitions.hpp:118
@ MONSTER_SKILL_STATE_IDLE
Definition: MonsterDefinitions.hpp:114
@ MONSTER_SKILL_STATE_DEAD
Definition: MonsterDefinitions.hpp:117
@ MONSTER_SKILL_STATE_WALK
Definition: MonsterDefinitions.hpp:115
@ MONSTER_SKILL_STATE_FOLLOW
Definition: MonsterDefinitions.hpp:121
@ MONSTER_SKILL_STATE_LOOT
Definition: MonsterDefinitions.hpp:116
@ MONSTER_SKILL_STATE_ANGRY
Definition: MonsterDefinitions.hpp:119
@ MONSTER_SKILL_STATE_ANY
Definition: MonsterDefinitions.hpp:113

References MONSTER_MODE_MASK_AGGRESSIVE, MONSTER_MODE_MASK_ANGRY, MONSTER_MODE_MASK_ASSIST, MONSTER_MODE_MASK_BOSS, MONSTER_MODE_MASK_CANATTACK, MONSTER_MODE_MASK_CANMOVE, MONSTER_MODE_MASK_CASTSENSOR_CHASE, MONSTER_MODE_MASK_CASTSENSOR_IDLE, MONSTER_MODE_MASK_CHANGECHASE, MONSTER_MODE_MASK_CHANGETARGET_CHASE, MONSTER_MODE_MASK_CHANGETARGET_MELEE, MONSTER_MODE_MASK_DETECTOR, MONSTER_MODE_MASK_LOOTER, MONSTER_MODE_MASK_NOKNOCKBACK, MONSTER_MODE_MASK_NONE, MONSTER_MODE_MASK_PLANT, MONSTER_MODE_MASK_TARGETWEAK, MONSTER_RACE_ANGEL, MONSTER_RACE_BOSS, MONSTER_RACE_BRUTE, MONSTER_RACE_DEMIHUMAN, MONSTER_RACE_DEMON, MONSTER_RACE_DRAGON, MONSTER_RACE_FISH, MONSTER_RACE_FORMLESS, MONSTER_RACE_INSECT, MONSTER_RACE_NONBOSS, MONSTER_RACE_PLANT, MONSTER_RACE_PLAYER, MONSTER_RACE_UNDEAD, MONSTER_SKILL_CC_AFTERSKILL, MONSTER_SKILL_CC_ALCHEMIST, MONSTER_SKILL_CC_ALWAYS, MONSTER_SKILL_CC_ATTACKPCGE, MONSTER_SKILL_CC_ATTACKPCGT, MONSTER_SKILL_CC_CASTTARGETED, MONSTER_SKILL_CC_CLOSERANGEATTACKED, MONSTER_SKILL_CC_FRIENDHPINRATE, MONSTER_SKILL_CC_FRIENDHPLTMAXRATE, MONSTER_SKILL_CC_FRIENDSTATUSOFF, MONSTER_SKILL_CC_FRIENDSTATUSON, MONSTER_SKILL_CC_LONGRANGEATTACKED, MONSTER_SKILL_CC_MAGICATTACKED, MONSTER_SKILL_CC_MASTERATTACKED, MONSTER_SKILL_CC_MASTERHPLTMAXRATE, MONSTER_SKILL_CC_MYHPINRATE, MONSTER_SKILL_CC_MYHPLTMAXRATE, MONSTER_SKILL_CC_MYSTATUSOFF, MONSTER_SKILL_CC_MYSTATUSON, MONSTER_SKILL_CC_RUDEATTACKED, MONSTER_SKILL_CC_SKILLUSED, MONSTER_SKILL_CC_SLAVELE, MONSTER_SKILL_CC_SLAVELT, MONSTER_SKILL_CC_SPAWN, MONSTER_SKILL_STATE_ANGRY, MONSTER_SKILL_STATE_ANY, MONSTER_SKILL_STATE_ANYTARGET, MONSTER_SKILL_STATE_BERSERK, MONSTER_SKILL_STATE_DEAD, MONSTER_SKILL_STATE_FOLLOW, MONSTER_SKILL_STATE_IDLE, MONSTER_SKILL_STATE_LOOT, MONSTER_SKILL_STATE_RUSH, MONSTER_SKILL_STATE_WALK, MONSTER_SKILL_TARGET_AROUND, MONSTER_SKILL_TARGET_AROUND1, MONSTER_SKILL_TARGET_AROUND2, MONSTER_SKILL_TARGET_AROUND3, MONSTER_SKILL_TARGET_AROUND4, MONSTER_SKILL_TARGET_AROUND5, MONSTER_SKILL_TARGET_AROUND6, MONSTER_SKILL_TARGET_AROUND7, MONSTER_SKILL_TARGET_AROUND8, MONSTER_SKILL_TARGET_CURRENT, MONSTER_SKILL_TARGET_FRIEND, MONSTER_SKILL_TARGET_MASTER, MONSTER_SKILL_TARGET_RANDOM, and MONSTER_SKILL_TARGET_SELF.

◆ sync_functions()

void MonsterComponent::sync_functions ( std::shared_ptr< sol::state >  state)
virtual

Implements Horizon::Zone::LUAComponent.

153{
154 state->set_function("cast_unit_to_monster",
155 [] (std::shared_ptr<Unit> e)
156 {
157 return e->template downcast<Monster>();
158 });
159
160 // Monster Spawn Script Function
161 state->set_function("Monster",
162 [this] (std::string const &map_name, uint16_t x, uint16_t y, uint16_t x_area, uint16_t y_area, std::string const &name, uint16_t monster_id, uint16_t amount, uint16_t spawn_delay_base, uint16_t spawn_delay_variance)
163 {
164 std::shared_ptr<Map> map;
165
166 int segment_number = sZone->get_segment_number_for_resource<Horizon::Zone::GameLogicProcess, RESOURCE_PRIORITY_PRIMARY, std::string, std::shared_ptr<Map>>(Horizon::System::RUNTIME_GAMELOGIC, map_name, nullptr);
167
168 if (segment_number == 0)
169 return;
170
171 std::shared_ptr<Horizon::Zone::GameLogicProcess> container = sZone->get_component_of_type<Horizon::Zone::GameLogicProcess>(Horizon::System::RUNTIME_GAMELOGIC, segment_number);
172
174
175 spwd.spawn_dataset_id = container->get_monster_spawn_agent()._last_monster_spawn_id++;
176 spwd.map_name = map_name;
177 spwd.x = x;
178 spwd.y = y;
179 spwd.x_area = x_area;
180 spwd.y_area = y_area;
181 spwd.mob_name = name;
182 spwd.monster_id = monster_id;
183 spwd.amount = amount;
184 spwd.spawn_delay_base = spawn_delay_base;
185 spwd.spawn_delay_variance = spawn_delay_variance;
186
187 std::shared_ptr<Horizon::Zone::SCENARIO_REGISTER_MONSTER_SPAWN> scenario = std::make_shared<Horizon::Zone::SCENARIO_REGISTER_MONSTER_SPAWN>(container);
188 std::shared_ptr<Horizon::Zone::SCENARIO_REGISTER_MONSTER_SPAWN::RegisterMonsterSpawn> work = std::make_shared<Horizon::Zone::SCENARIO_REGISTER_MONSTER_SPAWN::RegisterMonsterSpawn>(scenario);
189 scenario->get_runtime_synchronization_mutex().lock();
190 Horizon::Zone::SCENARIO_REGISTER_MONSTER_SPAWN::s_register_monster_spawn_request request;
191 request.data = spwd;
192 work->set_request(request);
193 scenario->get_runtime_synchronization_mutex().unlock();
194 scenario->push(std::move(work));
195 container->system_routine_queue_push(std::move(scenario));
196 HLog(debug) << "Monster spawn set (" << name << ") in " << map_name << " at (" << x << "," << y << ")[" << x_area << "," << y_area << "]" " for a total of " << amount << " monsters is initializing...";
197
198 });
199}
#define HLog(type)
Definition: Logger.hpp:122
@ RESOURCE_PRIORITY_PRIMARY
Definition: Server.hpp:79
#define sZone
Definition: Zone.hpp:247
Definition: GameLogicProcess.hpp:48
@ RUNTIME_GAMELOGIC
Definition: System.hpp:86
Definition: MonsterDefinitions.hpp:169
int spawn_dataset_id
Definition: MonsterDefinitions.hpp:170

References HLog, RESOURCE_PRIORITY_PRIMARY, Horizon::System::RUNTIME_GAMELOGIC, monster_spawn_data::spawn_dataset_id, and sZone.


The documentation for this class was generated from the following files: