#pragma once

#include <common/items/_mod.qh>
#include <common/items/item/ammo.qh>
#include <common/mutators/mutator/powerups/_mod.qh>

#ifdef GAMEQC
MODEL(VaporizerCells_ITEM, Item_Model("a_cells.md3"));
SOUND(VaporizerCells, Item_Sound("itempickup"));
#endif

#ifdef SVQC
int autocvar_g_instagib_ammo_drop;
void ammo_vaporizercells_init(Pickup this, entity item)
{
    if(!GetResource(item, RES_CELLS))
        SetResourceExplicit(item, RES_CELLS, autocvar_g_instagib_ammo_drop);
}
#endif

CLASS(VaporizerCells, Ammo)
/* spawnfunc   */ ATTRIB(VaporizerCells, m_canonical_spawnfunc, string, "item_vaporizer_cells");
#ifdef GAMEQC
/* spawnflags  */ ATTRIB(VaporizerCells, spawnflags, int, ITEM_FLAG_MUTATORBLOCKED);
/* model       */ ATTRIB(VaporizerCells, m_model, Model, MDL_VaporizerCells_ITEM);
/* sound       */ ATTRIB(VaporizerCells, m_sound, Sound, SND_VaporizerCells);
#endif
/* refname     */ ATTRIB(VaporizerCells, netname, string, "vaporizer_cells");
/* itemname    */ ATTRIB(VaporizerCells, m_name, string, _("Vaporizer ammo"));
/* icon        */ ATTRIB(VaporizerCells, m_icon, string, "ammo_supercells");
/* color       */ ATTRIB(VaporizerCells, m_color, vector, '0.816 0.941 0.541');
#ifdef SVQC
/* botvalue    */ ATTRIB(VaporizerCells, m_botvalue, int, 2000);
/* itemid      */ ATTRIB(VaporizerCells, m_itemid, int, IT_RESOURCE);
/* respawntime */ ATTRIB(VaporizerCells, m_respawntime, float, 45);
/*             */ ATTRIB(VaporizerCells, m_respawntimejitter, float, 0);
/* iteminit    */ ATTRIB(VaporizerCells, m_iteminit, void(Pickup this, entity item), ammo_vaporizercells_init);
#endif
ENDCLASS(VaporizerCells)
REGISTER_ITEM(VaporizerCells, NEW(VaporizerCells));

SPAWNFUNC_ITEM(item_vaporizer_cells, ITEM_VaporizerCells)
SPAWNFUNC_ITEM(item_minst_cells, ITEM_VaporizerCells)

#ifdef GAMEQC
MODEL(ExtraLife_ITEM, Item_Model("g_h100.md3"));
SOUND(ExtraLife, Item_Sound("megahealth"));
#endif

CLASS(ExtraLife, Powerup)
/* spawnfunc */ ATTRIB(ExtraLife, m_canonical_spawnfunc, string, "item_extralife");
#ifdef GAMEQC
/* model     */ ATTRIB(ExtraLife, m_model, Model, MDL_ExtraLife_ITEM);
/* sound     */ ATTRIB(ExtraLife, m_sound, Sound, SND_ExtraLife);
#endif
/* refname   */ ATTRIB(ExtraLife, netname, string, "extralife");
/* itemname  */ ATTRIB(ExtraLife, m_name, string, _("Extra life"));
/* icon      */ ATTRIB(ExtraLife, m_icon, string, "item_mega_health");
/* color     */ ATTRIB(ExtraLife, m_color, vector, '1 0 0');
/* wptext    */ ATTRIB(ExtraLife, m_waypoint, string, _("Extra life"));
/* wpblink   */ ATTRIB(ExtraLife, m_waypointblink, int, 2);
#ifdef SVQC
/* itemid    */ ATTRIB(ExtraLife, m_itemid, int, IT_RESOURCE);
#endif
ENDCLASS(ExtraLife)
REGISTER_ITEM(ExtraLife, NEW(ExtraLife));

SPAWNFUNC_ITEM(item_extralife, ITEM_ExtraLife)
