MCPcopy Create free account
hub / github.com/Panzerschrek/Chasm-Reverse / Shoot

Method Shoot

PanzerChasm/server/map.cpp:319–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317}
318
319void Map::Shoot(
320 const EntityId owner_id,
321 const unsigned int rocket_id,
322 const m_Vec3& from,
323 const m_Vec3& normalized_direction,
324 const Time current_time )
325{
326 rockets_.emplace_back( next_rocket_id_, owner_id, rocket_id, from, normalized_direction, current_time );
327 next_rocket_id_++;
328
329 Rocket& rocket= rockets_.back();
330 if( !rocket.HasInfiniteSpeed( *game_resources_ ) )
331 {
332 Messages::RocketBirth message;
333
334 message.rocket_id= rocket.rocket_id;
335 message.rocket_type= rocket.rocket_type_id;
336
337 PositionToMessagePosition( rocket.start_point, message.xyz );
338
339 float angle[2];
340 VecToAngles( rocket.normalized_direction, angle );
341 for( unsigned int j= 0u; j < 2u; j++ )
342 message.angle[j]= AngleToMessageAngle( angle[j] );
343
344 rockets_birth_messages_.emplace_back( message );
345 }
346
347 // Set initial speed for jumping rockets.
348 const GameResources::RocketDescription& description= game_resources_->rockets_description[ rocket.rocket_type_id ];
349 if( description.reflect )
350 {
351 const float speed= description.fast ? GameConstants::fast_rockets_speed : GameConstants::rockets_speed;
352 rocket.speed= rocket.normalized_direction * speed;
353 }
354}
355
356void Map::PlantMine(
357 const EntityId owner_monster_id,

Callers 2

DoShootMethod · 0.80
TickMethod · 0.80

Calls 4

VecToAnglesFunction · 0.85
AngleToMessageAngleFunction · 0.85
HasInfiniteSpeedMethod · 0.80

Tested by

no test coverage detected