ViolLua.Bots.Spawnbot = {     
    Config   = ViolLua.Config,
    Client   = ViolLua.Client,

    Active   = false
}

function ViolLua.Bots.Spawnbot:SpawnShield( CUserCMD )
    if ( not self.Config[ 'miscellaneous_spawnshield' ] ) then 
        return
    end

    local Prop = self.Config[ 'miscellaneous_spawnshield_prop' ]

    if ( Prop ) then 
        CUserCMD:SetViewAngles( Angle( 89, 0, 0 ) )

        RunConsoleCommand( 'gm_spawn', Prop )
    end
end

function ViolLua.Bots.Spawnbot:Handler( CUserCMD )
    if ( not self.Active ) then 
        return
    end

    self.Active = false
    
    self:SpawnShield( CUserCMD )
end

function ViolLua.Bots.Spawnbot:Activate( Data )
    local ENT = Player( Data.userid )

    if ( not IsValid( ENT ) or ENT != self.Client.Local ) then 
        return
    end

    self.Active = true
end

gameevent.Listen( 'player_spawn' )

ViolLua.Hooks:New( 'player_spawn', ViolLua.Bots.Spawnbot.Activate, ViolLua.Bots.Spawnbot )