<commit_before>/*==============================================================================


	Southclaw's Scavenge and Survive

		Copyright (C) 2016 Barnaby "Southclaw" Keene

		This program is free software: you can redistribute it and/or modify it
		under the terms of the GNU General Public License as published by the
		Free Software Foundation, either version 3 of the License, or (at your
		option) any later version.

		This program is distributed in the hope that it will be useful, but
		WITHOUT ANY WARRANTY; without even the implied warranty of
		MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
		See the GNU General Public License for more details.

		You should have received a copy of the GNU General Public License along
		with this program.  If not, see <http://www.gnu.org/licenses/>.


==============================================================================*/


enum
{
	EXPLOSION_PRESET_NORMAL,
	EXPLOSION_PRESET_STRUCTURAL,
	EXPLOSION_PRESET_EMP
}


stock SetItemToExplode(itemid, type, Float:size, preset, hitpoints)
{
	if(!IsValidItem(itemid))
		return 0;

	if(IsItemInWorld(itemid))
	{
		new
			Float:x,
			Float:y,
			Float:z;

		GetItemPos(itemid, x, y, z);
		CreateExplosionOfPreset(x, y, z, type, size, preset, hitpoints);
		DestroyItem(itemid);

		return 1;
	}

	new containerid = GetItemContainer(itemid);

	if(IsValidContainer(containerid))
	{
		new buttonid = GetContainerButton(containerid);

		if(IsValidButton(buttonid))
		{
			new
				Float:x,
				Float:y,
				Float:z;

			GetButtonPos(buttonid, x, y, z);
			CreateExplosionOfPreset(x, y, z, type, size, preset, hitpoints);
			DestroyItem(itemid);

			return 1;
		}

		new vehicleid = GetContainerTrunkVehicleID(containerid);

		if(IsValidVehicle(vehicleid))
		{
			new
				Float:x,
				Float:y,
				Float:z;

			GetVehiclePos(vehicleid, x, y, z);
			CreateExplosionOfPreset(x, y, z, type, size, preset, hitpoints);
			DestroyItem(itemid);
			SetVehicleHealth(vehicleid, 0.0);

			return 1;
		}

		new safeboxitemid = GetContainerSafeboxItem(containerid);

		if(IsValidItem(safeboxitemid))
		{
			new
				Float:x,
				Float:y,
				Float:z;

			GetItemPos(safeboxitemid, x, y, z);
			CreateExplosionOfPreset(x, y, z, type, size, preset, hitpoints);
			DestroyItem(itemid);
			DestroyItem(safeboxitemid);

			return 1;
		}

		new bagitemid = GetContainerBagItem(containerid);

		if(IsValidItem(bagitemid))
		{
			new
				Float:x,
				Float:y,
				Float:z;

			GetItemPos(bagitemid, x, y, z);
			CreateExplosionOfPreset(x, y, z, type, size, preset, hitpoints);
			DestroyItem(itemid);
			DestroyItem(bagitemid);

			return 1;
		}

		new playerid = GetContainerPlayerBag(containerid);

		if(IsPlayerConnected(playerid))
		{
			new
				Float:x,
				Float:y,
				Float:z;

			GetPlayerPos(playerid, x, y, z);
			CreateExplosionOfPreset(x, y, z, type, size, preset, hitpoints);
			DestroyItem(itemid);
			DestroyPlayerBag(playerid);

			return 1;
		}
	}

	new playerid = GetItemPlayerInventory(itemid);

	if(IsPlayerConnected(playerid))
	{
		new
			Float:x,
			Float:y,
			Float:z;

		GetPlayerPos(playerid, x, y, z);
		CreateExplosionOfPreset(x, y, z, type, size, preset, hitpoints);
		DestroyItem(itemid);

		return 1;<commit_msg>Fixed #125<commit_after>/*==============================================================================


	Southclaw's Scavenge and Survive

		Copyright (C) 2016 Barnaby "Southclaw" Keene

		This program is free software: you can redistribute it and/or modify it
		under the terms of the GNU General Public License as published by the
		Free Software Foundation, either version 3 of the License, or (at your
		option) any later version.

		This program is distributed in the hope that it will be useful, but
		WITHOUT ANY WARRANTY; without even the implied warranty of
		MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
		See the GNU General Public License for more details.

		You should have received a copy of the GNU General Public License along
		with this program.  If not, see <http://www.gnu.org/licenses/>.


==============================================================================*/


enum
{
	EXPLOSION_PRESET_NORMAL,
	EXPLOSION_PRESET_STRUCTURAL,
	EXPLOSION_PRESET_EMP
}


stock SetItemToExplode(itemid, type, Float:size, preset, hitpoints)
{
	if(!IsValidItem(itemid))
		return 0;

	if(IsItemInWorld(itemid))
	{
		new
			Float:x,
			Float:y,
			Float:z;

		GetItemPos(itemid, x, y, z);
		CreateExplosionOfPreset(x, y, z, type, size, preset, hitpoints);
		DestroyItem(itemid);

		return 1;
	}

	new containerid = GetItemContainer(itemid);

	if(IsValidContainer(containerid))
	{
		new buttonid = GetContainerButton(containerid);

		if(IsValidButton(buttonid))
		{
			new
				Float:x,
				Float:y,
				Float:z;

			GetButtonPos(buttonid, x, y, z);
			CreateExplosionOfPreset(x, y, z, type, size, preset, hitpoints);
			DestroyItem(itemid);

			return 1;
		}

		new vehicleid = GetContainerTrunkVehicleID(containerid);

		if(IsValidVehicle(vehicleid))
		{
			new
				Float:x,
				Float:y,
				Float:z;

			GetVehiclePos(vehicleid, x, y, z);
			CreateExplosionOfPreset(x, y, z, type, size, preset, hitpoints);
			DestroyItem(itemid);
			SetVehicleHealth(vehicleid, 0.0);

			return 1;
		}

		new safeboxitemid = GetContainerSafeboxItem(containerid);

		if(IsValidItem(safeboxitemid))
		{
			new
				Float:x,
				Float:y,
				Float:z;

			GetItemPos(safeboxitemid, x, y, z);
			CreateExplosionOfPreset(x, y, z, type, size, preset, hitpoints);
			DestroyItem(itemid);

			if(type != EXPLOSION_PRESET_EMP)
				DestroyItem(safeboxitemid);

			return 1;
		}

		new bagitemid = GetContainerBagItem(containerid);

		if(IsValidItem(bagitemid))
		{
			new
				Float:x,
				Float:y,
				Float:z;

			GetItemPos(bagitemid, x, y, z);
			CreateExplosionOfPreset(x, y, z, type, size, preset, hitpoints);
			DestroyItem(itemid);

			if(type != EXPLOSION_PRESET_EMP)
				DestroyItem(bagitemid);

			return 1;
		}

		new playerid = GetContainerPlayerBag(containerid);

		if(IsPlayerConnected(playerid))
		{
			new
				Float:x,
				Float:y,
				Float:z;

			GetPlayerPos(playerid, x, y, z);
			CreateExplosionOfPreset(x, y, z, type, size, preset, hitpoints);
			DestroyItem(itemid);

			if(type != EXPLOSION_PRESET_EMP)
				DestroyPlayerBag(playerid);

			return 1;
		}
	}

	new playerid = GetItemPlayerInventory(itemid);

	if(IsPlayerConnected(playerid))
	{
		new
			Float:x,
			Float:y,
			Float:z;

		GetPlayerPos(playerid, x, y, z);
		CreateExplosionOfPreset(x, y, z, type, size, preset, hitpoints);
		DestroyItem(itemid);

		return 1;
{'fraction_non_alphanumeric': 0.14607768469154608, 'fraction_numerical': 0.005026656511805026, 'mean_word_length': 4.121684867394696, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6186588', 'n_tokens_mistral': 2721, 'n_tokens_neox': 2232, 'n_words': 572}