-- Combat Shield
-- By JetBoom

model = "models/props_debris/metal_panel02a.mdl"

-------------------
-- Non-Edit line --
-------------------

shield = 0

    function Holster()
   		if _EntExists(shield) then
			_EntRemove(shield)
			shield = 0
	   	    _PlayerSetArmor(Owner, 0)
		end
		_PlayerSetDrawViewModel(Owner, true)
    end
    
    function Deploy()
    end

    function onInit( )
   end

    function onThink( )
    	if _EntExists(shield) then
			_EntitySetPhysicsAttacker(shield, Owner)
			_EntSetPos( shield, vecAdd(vecAdd(_PlayerGetShootPos( Owner ), vector3(0,0,-10)),vecMul(_PlayerGetShootAng( Owner ),vector3(40,40,40))))
	   	    _EntSetAng(shield, _PlayerGetShootAng(Owner))
	   	    _PlayerSetArmor(Owner, 20)
 		else
			_EntPrecacheModel(model)
			shield = _EntCreate("prop_physics")
			if shield > 0 then
				_EntSetKeyValue(shield, "model", model)
				_EntSetOwner(shield, Owner)
				_EntitySetPhysicsAttacker(shield, Owner)
				_EntSetPos( shield, vecAdd(_PlayerGetShootPos( Owner ),vecMul(_PlayerGetShootAng( Owner ),vector3(40,40,40))))
				_EntSetAng(shield, _PlayerGetShootAng(Owner))
				_EntSpawn(shield)
				_phys.EnableGravity(shield, false)
				_phys.SetMass(shield, 50)
				_EntSetMaterial(shield, "models/props_lab/Tank_Glass001")
				_EntSetCollisionGroup(shield, COLLISION_GROUP_PROJECTILE)
			end
			_PlayerSetDrawViewModel(Owner, false)
		end
    end

	function onPrimaryAttack( )
	end

    function onSecondaryAttack( )
    end

    function onReload( )
    end
    
    function getWeaponSwapHands()
        return false
    end
    
    function getWeaponFOV()
        return 60
    end
    
    function getWeaponSlot()
        return 0
    end
    
    function getWeaponSlotPos()
        return 7    
    end
    
    function getFiresUnderwater()
        return true
    end
    
    function getReloadsSingly()
        return false
    end

    function getDamage()
        return 10
    end
    
    function getPrimaryShotDelay()
        return 400
    end
        
    function getPrimaryIsAutomatic()
        return true
    end
            
    function getBulletSpread()
        return vector3( 0.00, 0.00, 0.00 )
    end
    
    function getViewKick()
        return vector3( 0.0, 0.0, 0.0)
    end
    
    function getViewKickRandom()
        return vector3( 0.0, 0.0, 0.0 )
    end
        
    function getNumShotsPrimary()
        return 1
    end
    
    function getPrimaryAmmoType()
        return "none"
    end

    function getDamageSecondary()
        return 10
    end
    
    function getSecondaryShotDelay()
        return 0.2
    end
    
    function getSecondaryIsAutomatic()
        return true
    end
    
    function getBulletSpreadSecondary()
        return vector3( 0.001, 0.001, 0.001 )
    end
    
    function getViewKickSecondary()
        return vector3( 0.0, 0.0, 0.0)
    end
    
    function getViewKickRandomSecondary()
        return vector3( 0.5, 0.5, 0.2 )
    end
    
    function getNumShotsSecondary()
        return 1
    end
    
    function getSecondaryAmmoType()
        return "none"
    end

    function getViewModel( )
		return "models/weapons/v_knife_t.mdl"
    end
    
    function getWorldModel( )
 		return "models/weapons/shell.mdl"
    end
    
    function getClassName() 
        return "weapon_combatshield"
    end     

    function getMaxClipPrimary()
        return 1
    end
    
    function getMaxClipSecondary()
        return -1
    end
    
    function getDefClipPrimary()
        return 1
    end
    
    function getDefClipSecondary()
        return 0
    end

    function getAnimPrefix()
        return "slam"
    end

    function getPrintName()
        return "Combat Shield"
    end

    function getDeathIcon()
	    return "d_crowbar"
    end

    function getPrimaryScriptOverride()
        return 3
    end

    function getSecondaryScriptOverride()
        return 3
    end
