Пример #1
0
void CGameContext::MoveCharacter(int ClientID, int X, int Y, bool Raw)
{
	CCharacter* pChr = GetPlayerChar(ClientID);

	if (!pChr)
		return;

	pChr->Core()->m_Pos.x += ((Raw) ? 1 : 32) * X;
	pChr->Core()->m_Pos.y += ((Raw) ? 1 : 32) * Y;
	pChr->m_DDRaceState = DDRACE_CHEAT;
}
Пример #2
0
void CGameContext::ConJumps(IConsole::IResult *pResult, void *pUserData)
{
	CGameContext *pSelf = (CGameContext *)pUserData;
	if(!CheckClientID(pResult->m_ClientID)) return;
	CCharacter *pChr = pSelf->m_apPlayers[pResult->m_ClientID]->GetCharacter();
	if (!pChr)
		return;

	char aBuf[64];
	str_format(aBuf, sizeof(aBuf), "You can jump %d times.", pChr->Core()->m_MaxJumps);
	pSelf->SendChatTarget(pResult->m_ClientID, aBuf);
}
Пример #3
0
bool CLaser::HitCharacter(vec2 From, vec2 To)
{
	vec2 At;
	CCharacter *OwnerChar = GameServer()->GetPlayerChar(m_Owner);
	CCharacter *Hit = GameServer()->m_World.IntersectCharacter(m_Pos, To, 0.f, At, g_Config.m_SvOldLaser || m_Bounces == 0 ? OwnerChar : 0, m_Owner, (g_Config.m_SvHit == 1) ? OwnerChar : 0);
	if(!Hit || (Hit == OwnerChar && g_Config.m_SvOldLaser) || (Hit != OwnerChar && !g_Config.m_SvHit))
		return false;
	m_From = From;
	m_Pos = At;
	m_Energy = -1;
	if (m_Type == 1 && g_Config.m_SvHit)
	{
		vec2 Temp;
		if(!g_Config.m_SvOldLaser)
			Temp = Hit->Core()->m_Vel + normalize(m_PrevPos - Hit->Core()->m_Pos) * 10;
		else
			Temp = Hit->Core()->m_Vel + normalize(OwnerChar->Core()->m_Pos - Hit->Core()->m_Pos) * 10;
		if(Temp.x > 0 && ((Hit->m_TileIndex == TILE_STOP && Hit->m_TileFlags == ROTATION_270) || (Hit->m_TileIndexL == TILE_STOP && Hit->m_TileFlagsL == ROTATION_270) || (Hit->m_TileIndexL == TILE_STOPS && (Hit->m_TileFlagsL == ROTATION_90 || Hit->m_TileFlagsL ==ROTATION_270)) || (Hit->m_TileIndexL == TILE_STOPA) || (Hit->m_TileFIndex == TILE_STOP && Hit->m_TileFFlags == ROTATION_270) || (Hit->m_TileFIndexL == TILE_STOP && Hit->m_TileFFlagsL == ROTATION_270) || (Hit->m_TileFIndexL == TILE_STOPS && (Hit->m_TileFFlagsL == ROTATION_90 || Hit->m_TileFFlagsL == ROTATION_270)) || (Hit->m_TileFIndexL == TILE_STOPA) || (Hit->m_TileSIndex == TILE_STOP && Hit->m_TileSFlags == ROTATION_270) || (Hit->m_TileSIndexL == TILE_STOP && Hit->m_TileSFlagsL == ROTATION_270) || (Hit->m_TileSIndexL == TILE_STOPS && (Hit->m_TileSFlagsL == ROTATION_90 || Hit->m_TileSFlagsL == ROTATION_270)) || (Hit->m_TileSIndexL == TILE_STOPA)))
			Temp.x = 0;
		if(Temp.x < 0 && ((Hit->m_TileIndex == TILE_STOP && Hit->m_TileFlags == ROTATION_90) || (Hit->m_TileIndexR == TILE_STOP && Hit->m_TileFlagsR == ROTATION_90) || (Hit->m_TileIndexR == TILE_STOPS && (Hit->m_TileFlagsR == ROTATION_90 || Hit->m_TileFlagsR == ROTATION_270)) || (Hit->m_TileIndexR == TILE_STOPA) || (Hit->m_TileFIndex == TILE_STOP && Hit->m_TileFFlags == ROTATION_90) || (Hit->m_TileFIndexR == TILE_STOP && Hit->m_TileFFlagsR == ROTATION_90) || (Hit->m_TileFIndexR == TILE_STOPS && (Hit->m_TileFFlagsR == ROTATION_90 || Hit->m_TileFFlagsR == ROTATION_270)) || (Hit->m_TileFIndexR == TILE_STOPA) || (Hit->m_TileSIndex == TILE_STOP && Hit->m_TileSFlags == ROTATION_90) || (Hit->m_TileSIndexR == TILE_STOP && Hit->m_TileSFlagsR == ROTATION_90) || (Hit->m_TileSIndexR == TILE_STOPS && (Hit->m_TileSFlagsR == ROTATION_90 || Hit->m_TileSFlagsR == ROTATION_270)) || (Hit->m_TileSIndexR == TILE_STOPA)))
			Temp.x = 0;
		if(Temp.y < 0 && ((Hit->m_TileIndex == TILE_STOP && Hit->m_TileFlags == ROTATION_180) || (Hit->m_TileIndexB == TILE_STOP && Hit->m_TileFlagsB == ROTATION_180) || (Hit->m_TileIndexB == TILE_STOPS && (Hit->m_TileFlagsB == ROTATION_0 || Hit->m_TileFlagsB == ROTATION_180)) || (Hit->m_TileIndexB == TILE_STOPA) || (Hit->m_TileFIndex == TILE_STOP && Hit->m_TileFFlags == ROTATION_180) || (Hit->m_TileFIndexB == TILE_STOP && Hit->m_TileFFlagsB == ROTATION_180) || (Hit->m_TileFIndexB == TILE_STOPS && (Hit->m_TileFFlagsB == ROTATION_0 || Hit->m_TileFFlagsB == ROTATION_180)) || (Hit->m_TileFIndexB == TILE_STOPA) || (Hit->m_TileSIndex == TILE_STOP && Hit->m_TileSFlags == ROTATION_180) || (Hit->m_TileSIndexB == TILE_STOP && Hit->m_TileSFlagsB == ROTATION_180) || (Hit->m_TileSIndexB == TILE_STOPS && (Hit->m_TileSFlagsB == ROTATION_0 || Hit->m_TileSFlagsB == ROTATION_180)) || (Hit->m_TileSIndexB == TILE_STOPA)))
			Temp.y = 0;
		if(Temp.y > 0 && ((Hit->m_TileIndex == TILE_STOP && Hit->m_TileFlags == ROTATION_0) || (Hit->m_TileIndexT == TILE_STOP && Hit->m_TileFlagsT == ROTATION_0) || (Hit->m_TileIndexT == TILE_STOPS && (Hit->m_TileFlagsT == ROTATION_0 || Hit->m_TileFlagsT == ROTATION_180)) || (Hit->m_TileIndexT == TILE_STOPA) || (Hit->m_TileFIndex == TILE_STOP && Hit->m_TileFFlags == ROTATION_0) || (Hit->m_TileFIndexT == TILE_STOP && Hit->m_TileFFlagsT == ROTATION_0) || (Hit->m_TileFIndexT == TILE_STOPS && (Hit->m_TileFFlagsT == ROTATION_0 || Hit->m_TileFFlagsT == ROTATION_180)) || (Hit->m_TileFIndexT == TILE_STOPA) || (Hit->m_TileSIndex == TILE_STOP && Hit->m_TileSFlags == ROTATION_0) || (Hit->m_TileSIndexT == TILE_STOP && Hit->m_TileSFlagsT == ROTATION_0) || (Hit->m_TileSIndexT == TILE_STOPS && (Hit->m_TileSFlagsT == ROTATION_0 || Hit->m_TileSFlagsT == ROTATION_180)) || (Hit->m_TileSIndexT == TILE_STOPA)))
			Temp.y = 0;
		Hit->Core()->m_Vel = Temp;
	}
	else if (m_Type == 0)
	{
		Hit->UnFreeze();
	}
	return true;
}
Пример #4
0
void CGameWorld::ReleaseHooked(int ClientID)
{
	CCharacter *pChr = (CCharacter *)CGameWorld::FindFirst(CGameWorld::ENTTYPE_CHARACTER);
		for(; pChr; pChr = (CCharacter *)pChr->TypeNext())
		{
			CCharacterCore* Core = pChr->Core();
			if(Core->m_HookedPlayer == ClientID && !pChr->GetPlayer()->Cheats.Super)
			{
				Core->m_HookedPlayer = -1;
				Core->m_HookState = HOOK_RETRACTED;
				Core->m_TriggeredEvents |= COREEVENT_HOOK_RETRACT;
				Core->m_HookState = HOOK_RETRACTED;
			}
		}
}
Пример #5
0
void CGameContext::ConTeleport(IConsole::IResult *pResult, void *pUserData)
{
	CGameContext *pSelf = (CGameContext *) pUserData;
	if (!CheckClientID(pResult->GetVictim()))
		return;
	int TeleTo = pResult->GetVictim();
	if (pSelf->m_apPlayers[TeleTo])
	{
		CCharacter* pChr = pSelf->GetPlayerChar(pResult->m_ClientID);
		if (pChr)
		{
			pChr->Core()->m_Pos = pSelf->m_apPlayers[TeleTo]->m_ViewPos;
			pChr->m_DDRaceState = DDRACE_CHEAT;
		}
	}
}
Пример #6
0
bool CLaser::HitCharacter(vec2 From, vec2 To)
{
	vec2 At;
	CCharacter *pOwnerChar = GameServer()->GetPlayerChar(m_Owner);
	CCharacter *pHit;
	bool pDontHitSelf = g_Config.m_SvOldLaser || (m_Bounces == 0 && !m_WasTele);

	if(pOwnerChar ? (!(pOwnerChar->m_Hit&CCharacter::DISABLE_HIT_RIFLE) && m_Type == WEAPON_RIFLE) || (!(pOwnerChar->m_Hit&CCharacter::DISABLE_HIT_SHOTGUN) && m_Type == WEAPON_SHOTGUN) : g_Config.m_SvHit)
		pHit = GameServer()->m_World.IntersectCharacter(m_Pos, To, 0.f, At, pDontHitSelf ? pOwnerChar : 0, m_Owner);
	else
		pHit = GameServer()->m_World.IntersectCharacter(m_Pos, To, 0.f, At, pDontHitSelf ? pOwnerChar : 0, m_Owner, pOwnerChar);

	if(!pHit || (pHit == pOwnerChar && g_Config.m_SvOldLaser) || (pHit != pOwnerChar && pOwnerChar ? (pOwnerChar->m_Hit&CCharacter::DISABLE_HIT_RIFLE  && m_Type == WEAPON_RIFLE) || (pOwnerChar->m_Hit&CCharacter::DISABLE_HIT_SHOTGUN && m_Type == WEAPON_SHOTGUN) : !g_Config.m_SvHit))
		return false;
	m_From = From;
	m_Pos = At;
	m_Energy = -1;
	if (m_Type == WEAPON_SHOTGUN)
	{
		vec2 Temp;

		float Strength;
		if (!m_TuneZone)
			Strength = GameServer()->Tuning()->m_ShotgunStrength;
		else
			Strength = GameServer()->TuningList()[m_TuneZone].m_ShotgunStrength;

		if(!g_Config.m_SvOldLaser)
			Temp = pHit->Core()->m_Vel + normalize(m_PrevPos - pHit->Core()->m_Pos) * Strength;
		else if(pOwnerChar)
			Temp = pHit->Core()->m_Vel + normalize(pOwnerChar->Core()->m_Pos - pHit->Core()->m_Pos) * Strength;
		else
			Temp = pHit->Core()->m_Vel;
		if(Temp.x > 0 && ((pHit->m_TileIndex == TILE_STOP && pHit->m_TileFlags == ROTATION_270) || (pHit->m_TileIndexL == TILE_STOP && pHit->m_TileFlagsL == ROTATION_270) || (pHit->m_TileIndexL == TILE_STOPS && (pHit->m_TileFlagsL == ROTATION_90 || pHit->m_TileFlagsL ==ROTATION_270)) || (pHit->m_TileIndexL == TILE_STOPA) || (pHit->m_TileFIndex == TILE_STOP && pHit->m_TileFFlags == ROTATION_270) || (pHit->m_TileFIndexL == TILE_STOP && pHit->m_TileFFlagsL == ROTATION_270) || (pHit->m_TileFIndexL == TILE_STOPS && (pHit->m_TileFFlagsL == ROTATION_90 || pHit->m_TileFFlagsL == ROTATION_270)) || (pHit->m_TileFIndexL == TILE_STOPA) || (pHit->m_TileSIndex == TILE_STOP && pHit->m_TileSFlags == ROTATION_270) || (pHit->m_TileSIndexL == TILE_STOP && pHit->m_TileSFlagsL == ROTATION_270) || (pHit->m_TileSIndexL == TILE_STOPS && (pHit->m_TileSFlagsL == ROTATION_90 || pHit->m_TileSFlagsL == ROTATION_270)) || (pHit->m_TileSIndexL == TILE_STOPA)))
			Temp.x = 0;
		if(Temp.x < 0 && ((pHit->m_TileIndex == TILE_STOP && pHit->m_TileFlags == ROTATION_90) || (pHit->m_TileIndexR == TILE_STOP && pHit->m_TileFlagsR == ROTATION_90) || (pHit->m_TileIndexR == TILE_STOPS && (pHit->m_TileFlagsR == ROTATION_90 || pHit->m_TileFlagsR == ROTATION_270)) || (pHit->m_TileIndexR == TILE_STOPA) || (pHit->m_TileFIndex == TILE_STOP && pHit->m_TileFFlags == ROTATION_90) || (pHit->m_TileFIndexR == TILE_STOP && pHit->m_TileFFlagsR == ROTATION_90) || (pHit->m_TileFIndexR == TILE_STOPS && (pHit->m_TileFFlagsR == ROTATION_90 || pHit->m_TileFFlagsR == ROTATION_270)) || (pHit->m_TileFIndexR == TILE_STOPA) || (pHit->m_TileSIndex == TILE_STOP && pHit->m_TileSFlags == ROTATION_90) || (pHit->m_TileSIndexR == TILE_STOP && pHit->m_TileSFlagsR == ROTATION_90) || (pHit->m_TileSIndexR == TILE_STOPS && (pHit->m_TileSFlagsR == ROTATION_90 || pHit->m_TileSFlagsR == ROTATION_270)) || (pHit->m_TileSIndexR == TILE_STOPA)))
			Temp.x = 0;
		if(Temp.y < 0 && ((pHit->m_TileIndex == TILE_STOP && pHit->m_TileFlags == ROTATION_180) || (pHit->m_TileIndexB == TILE_STOP && pHit->m_TileFlagsB == ROTATION_180) || (pHit->m_TileIndexB == TILE_STOPS && (pHit->m_TileFlagsB == ROTATION_0 || pHit->m_TileFlagsB == ROTATION_180)) || (pHit->m_TileIndexB == TILE_STOPA) || (pHit->m_TileFIndex == TILE_STOP && pHit->m_TileFFlags == ROTATION_180) || (pHit->m_TileFIndexB == TILE_STOP && pHit->m_TileFFlagsB == ROTATION_180) || (pHit->m_TileFIndexB == TILE_STOPS && (pHit->m_TileFFlagsB == ROTATION_0 || pHit->m_TileFFlagsB == ROTATION_180)) || (pHit->m_TileFIndexB == TILE_STOPA) || (pHit->m_TileSIndex == TILE_STOP && pHit->m_TileSFlags == ROTATION_180) || (pHit->m_TileSIndexB == TILE_STOP && pHit->m_TileSFlagsB == ROTATION_180) || (pHit->m_TileSIndexB == TILE_STOPS && (pHit->m_TileSFlagsB == ROTATION_0 || pHit->m_TileSFlagsB == ROTATION_180)) || (pHit->m_TileSIndexB == TILE_STOPA)))
			Temp.y = 0;
		if(Temp.y > 0 && ((pHit->m_TileIndex == TILE_STOP && pHit->m_TileFlags == ROTATION_0) || (pHit->m_TileIndexT == TILE_STOP && pHit->m_TileFlagsT == ROTATION_0) || (pHit->m_TileIndexT == TILE_STOPS && (pHit->m_TileFlagsT == ROTATION_0 || pHit->m_TileFlagsT == ROTATION_180)) || (pHit->m_TileIndexT == TILE_STOPA) || (pHit->m_TileFIndex == TILE_STOP && pHit->m_TileFFlags == ROTATION_0) || (pHit->m_TileFIndexT == TILE_STOP && pHit->m_TileFFlagsT == ROTATION_0) || (pHit->m_TileFIndexT == TILE_STOPS && (pHit->m_TileFFlagsT == ROTATION_0 || pHit->m_TileFFlagsT == ROTATION_180)) || (pHit->m_TileFIndexT == TILE_STOPA) || (pHit->m_TileSIndex == TILE_STOP && pHit->m_TileSFlags == ROTATION_0) || (pHit->m_TileSIndexT == TILE_STOP && pHit->m_TileSFlagsT == ROTATION_0) || (pHit->m_TileSIndexT == TILE_STOPS && (pHit->m_TileSFlagsT == ROTATION_0 || pHit->m_TileSFlagsT == ROTATION_180)) || (pHit->m_TileSIndexT == TILE_STOPA)))
			Temp.y = 0;
		pHit->Core()->m_Vel = Temp;
	}
	else if (m_Type == WEAPON_RIFLE)
	{
		pHit->UnFreeze();
	}
	return true;
}
Пример #7
0
void CGameContext::ConSetJumps(IConsole::IResult *pResult, void *pUserData)
{
	if(!CheckRights(pResult->m_ClientID, pResult->GetVictim(), (CGameContext *)pUserData)) return;
	CGameContext *pSelf = (CGameContext *)pUserData;
	int Victim = pResult->GetVictim();

	CPlayer *pPlayer = pSelf->m_apPlayers[Victim];
	if(!pPlayer)
		return;

	CCharacter *pChr = pSelf->m_apPlayers[Victim]->GetCharacter();
	if (!pChr)
		return;

	pChr->Core()->m_MaxJumps = clamp(pResult->GetInteger(0), 0, 9999);
	pChr->m_DDRaceState = DDRACE_CHEAT;
}
Пример #8
0
void CGameContext::ConToTeleporter(IConsole::IResult *pResult, void *pUserData)
{
	CGameContext *pSelf = (CGameContext *) pUserData;
	unsigned int TeleTo = pResult->GetInteger(0);

	if (((CGameControllerDDRace*)pSelf->m_pController)->m_TeleOuts[TeleTo-1].size())
	{
		int Num = ((CGameControllerDDRace*)pSelf->m_pController)->m_TeleOuts[TeleTo-1].size();
		vec2 TelePos = ((CGameControllerDDRace*)pSelf->m_pController)->m_TeleOuts[TeleTo-1][(!Num)?Num:rand() % Num];
		CCharacter* pChr = pSelf->GetPlayerChar(pResult->m_ClientID);
		if (pChr)
		{
			pChr->Core()->m_Pos = TelePos;
			pChr->m_Pos = TelePos;
			pChr->m_PrevPos = TelePos;
			pChr->m_DDRaceState = DDRACE_CHEAT;
		}
	}
}
Пример #9
0
void CGameContext::ConTeleport(IConsole::IResult *pResult, void *pUserData)
{
	CGameContext *pSelf = (CGameContext *) pUserData;
	int TeleTo = pResult->GetInteger(0);
	int Tele = pResult->m_ClientID;
	if (pResult->NumArguments() > 0)
		Tele = pResult->GetVictim();

	if (pSelf->m_apPlayers[TeleTo])
	{
		CCharacter* pChr = pSelf->GetPlayerChar(Tele);
		if (pChr && pSelf->GetPlayerChar(TeleTo))
		{
			pChr->Core()->m_Pos = pSelf->m_apPlayers[TeleTo]->m_ViewPos;
			pChr->m_Pos = pSelf->m_apPlayers[TeleTo]->m_ViewPos;
			pChr->m_PrevPos = pSelf->m_apPlayers[TeleTo]->m_ViewPos;
			pChr->m_DDRaceState = DDRACE_CHEAT;
		}
	}
}
Пример #10
0
void CDragger::Drag()
{
	if (m_Target)
	{
		CCharacter *Target = m_Target;

		for (int i = -1; i < MAX_CLIENTS; i++)
		{
			if (i >= 0)
				Target = m_SoloEnts[i];

			if (!Target)
				continue;

			int Res = 0;
			if (!m_NW)
				Res = GameServer()->Collision()->IntersectNoLaser(m_Pos,
						Target->m_Pos, 0, 0);
			else
				Res = GameServer()->Collision()->IntersectNoLaserNW(m_Pos,
						Target->m_Pos, 0, 0);
			if (Res || length(m_Pos - Target->m_Pos) > g_Config.m_SvDraggerRange)
			{
				Target = 0;
				if (i == -1)
					m_Target = 0;
				else
					m_SoloEnts[i] = 0;
			}
			else if (length(m_Pos - Target->m_Pos) > 28)
			{
				vec2 Temp = Target->Core()->m_Vel
						+ (normalize(m_Pos - Target->m_Pos) * m_Strength);
				if (Temp.x > 0
						&& ((Target->m_TileIndex == TILE_STOP
								&& Target->m_TileFlags == ROTATION_270)
								|| (Target->m_TileIndexL == TILE_STOP
										&& Target->m_TileFlagsL == ROTATION_270)
								|| (Target->m_TileIndexL == TILE_STOPS
										&& (Target->m_TileFlagsL == ROTATION_90
												|| Target->m_TileFlagsL
														== ROTATION_270))
								|| (Target->m_TileIndexL == TILE_STOPA)
								|| (Target->m_TileFIndex == TILE_STOP
										&& Target->m_TileFFlags == ROTATION_270)
								|| (Target->m_TileFIndexL == TILE_STOP
										&& Target->m_TileFFlagsL == ROTATION_270)
								|| (Target->m_TileFIndexL == TILE_STOPS
										&& (Target->m_TileFFlagsL == ROTATION_90
												|| Target->m_TileFFlagsL
														== ROTATION_270))
								|| (Target->m_TileFIndexL == TILE_STOPA)
								|| (Target->m_TileSIndex == TILE_STOP
										&& Target->m_TileSFlags == ROTATION_270)
								|| (Target->m_TileSIndexL == TILE_STOP
										&& Target->m_TileSFlagsL == ROTATION_270)
								|| (Target->m_TileSIndexL == TILE_STOPS
										&& (Target->m_TileSFlagsL == ROTATION_90
												|| Target->m_TileSFlagsL
														== ROTATION_270))
								|| (Target->m_TileSIndexL == TILE_STOPA)))
					Temp.x = 0;
				if (Temp.x < 0
						&& ((Target->m_TileIndex == TILE_STOP
								&& Target->m_TileFlags == ROTATION_90)
								|| (Target->m_TileIndexR == TILE_STOP
										&& Target->m_TileFlagsR == ROTATION_90)
								|| (Target->m_TileIndexR == TILE_STOPS
										&& (Target->m_TileFlagsR == ROTATION_90
												|| Target->m_TileFlagsR
														== ROTATION_270))
								|| (Target->m_TileIndexR == TILE_STOPA)
								|| (Target->m_TileFIndex == TILE_STOP
										&& Target->m_TileFFlags == ROTATION_90)
								|| (Target->m_TileFIndexR == TILE_STOP
										&& Target->m_TileFFlagsR == ROTATION_90)
								|| (Target->m_TileFIndexR == TILE_STOPS
										&& (Target->m_TileFFlagsR == ROTATION_90
												|| Target->m_TileFFlagsR
														== ROTATION_270))
								|| (Target->m_TileFIndexR == TILE_STOPA)
								|| (Target->m_TileSIndex == TILE_STOP
										&& Target->m_TileSFlags == ROTATION_90)
								|| (Target->m_TileSIndexR == TILE_STOP
										&& Target->m_TileSFlagsR == ROTATION_90)
								|| (Target->m_TileSIndexR == TILE_STOPS
										&& (Target->m_TileSFlagsR == ROTATION_90
												|| Target->m_TileSFlagsR
														== ROTATION_270))
								|| (Target->m_TileSIndexR == TILE_STOPA)))
					Temp.x = 0;
				if (Temp.y < 0
						&& ((Target->m_TileIndex == TILE_STOP
								&& Target->m_TileFlags == ROTATION_180)
								|| (Target->m_TileIndexB == TILE_STOP
										&& Target->m_TileFlagsB == ROTATION_180)
								|| (Target->m_TileIndexB == TILE_STOPS
										&& (Target->m_TileFlagsB == ROTATION_0
												|| Target->m_TileFlagsB
														== ROTATION_180))
								|| (Target->m_TileIndexB == TILE_STOPA)
								|| (Target->m_TileFIndex == TILE_STOP
										&& Target->m_TileFFlags == ROTATION_180)
								|| (Target->m_TileFIndexB == TILE_STOP
										&& Target->m_TileFFlagsB == ROTATION_180)
								|| (Target->m_TileFIndexB == TILE_STOPS
										&& (Target->m_TileFFlagsB == ROTATION_0
												|| Target->m_TileFFlagsB
														== ROTATION_180))
								|| (Target->m_TileFIndexB == TILE_STOPA)
								|| (Target->m_TileSIndex == TILE_STOP
										&& Target->m_TileSFlags == ROTATION_180)
								|| (Target->m_TileSIndexB == TILE_STOP
										&& Target->m_TileSFlagsB == ROTATION_180)
								|| (Target->m_TileSIndexB == TILE_STOPS
										&& (Target->m_TileSFlagsB == ROTATION_0
												|| Target->m_TileSFlagsB
														== ROTATION_180))
								|| (Target->m_TileSIndexB == TILE_STOPA)))
					Temp.y = 0;
				if (Temp.y > 0
						&& ((Target->m_TileIndex == TILE_STOP
								&& Target->m_TileFlags == ROTATION_0)
								|| (Target->m_TileIndexT == TILE_STOP
										&& Target->m_TileFlagsT == ROTATION_0)
								|| (Target->m_TileIndexT == TILE_STOPS
										&& (Target->m_TileFlagsT == ROTATION_0
												|| Target->m_TileFlagsT
														== ROTATION_180))
								|| (Target->m_TileIndexT == TILE_STOPA)
								|| (Target->m_TileFIndex == TILE_STOP
										&& Target->m_TileFFlags == ROTATION_0)
								|| (Target->m_TileFIndexT == TILE_STOP
										&& Target->m_TileFFlagsT == ROTATION_0)
								|| (Target->m_TileFIndexT == TILE_STOPS
										&& (Target->m_TileFFlagsT == ROTATION_0
												|| Target->m_TileFFlagsT
														== ROTATION_180))
								|| (Target->m_TileFIndexT == TILE_STOPA)
								|| (Target->m_TileSIndex == TILE_STOP
										&& Target->m_TileSFlags == ROTATION_0)
								|| (Target->m_TileSIndexT == TILE_STOP
										&& Target->m_TileSFlagsT == ROTATION_0)
								|| (Target->m_TileSIndexT == TILE_STOPS
										&& (Target->m_TileSFlagsT == ROTATION_0
												|| Target->m_TileSFlagsT
														== ROTATION_180))
								|| (Target->m_TileSIndexT == TILE_STOPA)))
					Temp.y = 0;
				Target->Core()->m_Vel = Temp;
			}
		}
	}
}
Пример #11
0
void CGameContext::ConRescue(IConsole::IResult *pResult, void *pUserData)
{
	CGameContext *pSelf = (CGameContext *)pUserData;
	CCharacter* pChr = pSelf->m_apPlayers[pResult->m_ClientID]->GetCharacter();

	if(!g_Config.m_SvRescue)
	{
		pSelf->SendChatTarget(pResult->m_ClientID, "Rescue is not activated.");
		return;
	}

	if(!pChr)
	{
		pSelf->SendChatTarget(pResult->m_ClientID, "You are not alive!");
		return;
	}
	
	
	if(pChr->m_DeepFreeze)
	{
		pSelf->SendChatTarget(pResult->m_ClientID, "You are deepfreezed, undeepfreeze first!");
		return;
	}
	if(!pChr->IsAlive())
	{
		pSelf->SendChatTarget(pResult->m_ClientID, "You are not alive!");
		return;
	}
	// unfreeze if pressed second time
	if(pChr->m_RescueFlags & RESCUEFLAG_CAN_UNFREEZE)
	{
		pChr->m_RescueFlags &= ~RESCUEFLAG_CAN_UNFREEZE;
		if(pChr->m_FreezeTime && pChr->m_TileIndex != TILE_FREEZE && pChr->m_TileFIndex != TILE_FREEZE && pChr->Core()->m_Pos == pChr->m_RescuePos)
		{
			pChr->UnFreeze();
			return;
		}
	}
	if(pChr->m_FreezeTime == 0)
		return;
    
	if(pChr->m_LastRescue) // sv_rescue_delay
		return;

	if(pChr->m_RescueOverride)
	{
		pSelf->SendChatTarget(pResult->m_ClientID, "Rescue is disabled by the map.");
		return;
	}

	if(pChr->m_RescuePos == vec2(0,0))
	{
		pSelf->SendChatTarget(pResult->m_ClientID, "No position saved!");
		return;
	}


	// reset players' hook
	for(int i = 0; i < MAX_CLIENTS; i++)
	{
		if(pSelf->m_apPlayers[i])
		{
			CCharacter* pChr2 = pSelf->m_apPlayers[i]->GetCharacter();
			//who hooks me?
			if(pChr2 && pChr2->Core()->m_HookedPlayer == pResult->m_ClientID)
			{
				//Release hook
				pChr2->Core()->m_HookedPlayer = -1;
				pChr2->Core()->m_HookState = HOOK_RETRACTED;
				pChr2->Core()->m_HookPos = pChr2->Core()->m_Pos;
			}
		}
	}
	if(g_Config.m_SvRescueEffects)
	{
		//Blood effect
		pChr->GameServer()->CreateDeath(pChr->m_Pos, pResult->m_ClientID);
		//Spawn effect
		pChr->GameServer()->CreatePlayerSpawn(pChr->m_RescuePos);
	}
	//Teleport player
	pChr->Core()->m_Pos = pChr->m_PrevPos = pChr->m_Pos = pChr->m_RescuePos;
	pChr->Core()->m_Vel = vec2(0.f, 0.f); // reset momentum

	if(pChr->m_RescueFlags)
	{
		// disarm player
		if(pChr->m_RescueFlags & RESCUEFLAG_DISARM)
		{
			bool disarmed = false;
			for(int i = WEAPON_SHOTGUN; i < NUM_WEAPONS; i++)
			{
				if(pChr->GetWeaponGot(i) && i != WEAPON_NINJA)
				{
					pChr->SetWeaponGot(i, false);
					pChr->SetWeaponAmmo(i, 0);
					disarmed = true;
				}
			}
			if(disarmed)
				pChr->GameServer()->SendChatTarget(pResult->m_ClientID, "You have been disarmed");
		}
		// solo fix
		if(pChr->m_RescueFlags & RESCUEFLAG_SOLOOUT)
		{
			pChr->GameServer()->SendChatTarget(pResult->m_ClientID, "You are now in a solo part");
			pChr->m_Solo = true;
		}
		else if(pChr->m_RescueFlags & RESCUEFLAG_SOLOIN)
		{
			pChr->GameServer()->SendChatTarget(pResult->m_ClientID, "You are now out of the solo part");
			pChr->m_Solo = false;
		}
		// hit fix
		if(pChr->m_RescueFlags & RESCUEFLAG_NOHIT)
		{
			pChr->GameServer()->SendChatTarget(pResult->m_ClientID, "You can hit others");
			pChr->m_Hit = CCharacter::HIT_ALL;
		}
		else if(pChr->m_RescueFlags & RESCUEFLAG_HIT)
		{
			pChr->GameServer()->SendChatTarget(pResult->m_ClientID, "You can't hit others");
			pChr->m_Hit = CCharacter::DISABLE_HIT_GRENADE|CCharacter::DISABLE_HIT_HAMMER|
				CCharacter::DISABLE_HIT_RIFLE|CCharacter::DISABLE_HIT_SHOTGUN;
		}
		// endless hook fix
		if(pChr->m_RescueFlags & RESCUEFLAG_NOEHOOK && !pChr->m_EndlessHook)
		{
			pChr->GameServer()->SendChatTarget(pResult->m_ClientID, "Endless hook has been activated");
			pChr->m_EndlessHook = true;
		}
		else if(pChr->m_RescueFlags & RESCUEFLAG_EHOOK && pChr->m_EndlessHook)
		{
			pChr->GameServer()->SendChatTarget(pResult->m_ClientID, "Endless hook has been deactivated");
			pChr->m_EndlessHook = false;
		}
		pChr->m_RescueFlags = RESCUEFLAG_NONE;
	}
	//"save" last rescue time
	pChr->m_LastRescue = ((float)g_Config.m_SvRescueDelay / 1000) * pSelf->Server()->TickSpeed();
	pChr->m_RescueFlags |= RESCUEFLAG_CAN_UNFREEZE;
}