@@ -35,6 +35,12 @@ CLaser::CLaser(CGameWorld *pGameWorld, vec2 Pos, vec2 Direction, float StartEner
3535
3636bool CLaser::HitCharacter (vec2 From, vec2 To)
3737{
38+ if (GameWorld ()->m_WorldConfig .m_IsInfClass )
39+ {
40+ // Ignore characters and only hit own bombs
41+ return HitOwnerMercBomb (From, To);
42+ }
43+
3844 static const vec2 StackedLaserShotgunBugSpeed = vec2 (-2147483648 .0f , -2147483648 .0f );
3945 vec2 At;
4046 CCharacter *pOwnerChar = GameWorld ()->GetCharacterById (m_Owner);
@@ -95,6 +101,37 @@ bool CLaser::HitCharacter(vec2 From, vec2 To)
95101 return true ;
96102}
97103
104+ bool CLaser::HitOwnerMercBomb (const vec2 &From, const vec2 &To)
105+ {
106+ CEntity *pObject = GameWorld ()->FindFirst (CGameWorld::ENTTYPE_IC_PLACED_OBJECT);
107+ for (; pObject; pObject = pObject->NextEntity ())
108+ {
109+ const CIcPlacedObject *pIcObject = static_cast <CIcPlacedObject *>(pObject);
110+ if (pIcObject->GetOwner () != m_Owner)
111+ continue ;
112+ if (pIcObject->IcObjectType () != EIcObjectType::MERCENARY_BOMB)
113+ continue ;
114+
115+ vec2 IntersectPos;
116+ if (closest_point_on_line (From, To, pObject->GetPos (), IntersectPos))
117+ {
118+ float Len = distance (pObject->GetPos (), IntersectPos);
119+ const float DefaultMercBombRadius = 80 .0f ;
120+ float LaserHitRadius = std::max (DefaultMercBombRadius, fx2f (pIcObject->GetSnapData1 ()));
121+ if (Len < LaserHitRadius)
122+ {
123+ m_From = From;
124+ m_Pos = IntersectPos;
125+ m_Energy = -1 ;
126+ return true ;
127+ }
128+ }
129+ return false ;
130+ }
131+
132+ return false ;
133+ }
134+
98135void CLaser::DoBounce ()
99136{
100137 m_EvalTick = GameWorld ()->GameTick ();
0 commit comments