MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / spawn_item

Method spawn_item

ogsr_engine/xrGame/Level_network_spawn.cpp:168–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168CSE_Abstract* CLevel::spawn_item(LPCSTR section, const Fvector& position, u32 level_vertex_id, u16 parent_id, bool return_item)
169{
170 CSE_Abstract* abstract = F_entity_Create(section);
171 R_ASSERT3(abstract, "Cannot find item with section", section);
172 CSE_ALifeDynamicObject* dynamic_object = smart_cast<CSE_ALifeDynamicObject*>(abstract);
173 if (dynamic_object && ai().get_level_graph())
174 {
175 dynamic_object->m_tNodeID = level_vertex_id;
176 if (ai().level_graph().valid_vertex_id(level_vertex_id) && ai().get_game_graph() && ai().get_cross_table())
177 dynamic_object->m_tGraphID = ai().cross_table().vertex(level_vertex_id).game_vertex_id();
178 }
179
180 //оружие спавним с полным магазинои
181 CSE_ALifeItemWeapon* weapon = smart_cast<CSE_ALifeItemWeapon*>(abstract);
182 if (weapon)
183 weapon->a_elapsed = weapon->get_ammo_magsize();
184
185 // Fill
186 abstract->s_name = section;
187 abstract->set_name_replace(section);
188 abstract->s_gameid = u8(GameID());
189 abstract->o_Position = position;
190 abstract->s_RP = 0xff;
191 abstract->ID = 0xffff;
192 abstract->ID_Parent = parent_id;
193 abstract->ID_Phantom = 0xffff;
194 abstract->s_flags.assign(M_SPAWN_OBJECT_LOCAL);
195 abstract->RespawnTime = 0;
196
197 if (!return_item)
198 {
199 NET_Packet P;
200 abstract->Spawn_Write(P, TRUE);
201 Send(P, net_flags(TRUE));
202 F_entity_Destroy(abstract);
203 return (0);
204 }
205 else
206 return (abstract);
207}
208
209
210void CLevel::ProcessGameSpawns()

Callers 15

ScopeRespawnMethod · 0.45
spawn_phantomFunction · 0.45
on_spawnMethod · 0.45
ContactMethod · 0.45
spawn_fake_missileMethod · 0.45
ExitContactCallbackMethod · 0.45
SpawnAnomalyMethod · 0.45
spawn_suppliesMethod · 0.45
SpawnArtefactMethod · 0.45
spawn_suppliesMethod · 0.45
processMethod · 0.45

Calls 13

F_entity_CreateFunction · 0.85
GameIDFunction · 0.85
net_flagsFunction · 0.85
F_entity_DestroyFunction · 0.85
get_level_graphMethod · 0.80
get_game_graphMethod · 0.80
get_cross_tableMethod · 0.80
get_ammo_magsizeMethod · 0.80
Spawn_WriteMethod · 0.80
valid_vertex_idMethod · 0.45
game_vertex_idMethod · 0.45
vertexMethod · 0.45

Tested by

no test coverage detected