Benny/gamemodes/benny/gamemode/items/base.lua

81 lines
1.9 KiB
Lua

do -- Base
local ITEM, Base = CreateItem( "base" )
ITEM.PrintName = "Item Base"
ITEM.Description = "Testing testing"
ITEM.Category = "base"
ITEM.Model = bModel("weapons/test_g18")
ITEM.DefaultBodygroups = {}
ITEM.HoldType = "handgun"
ITEM.Vars = {
["Float"] = {
"Acquisition",
"HolsterIn",
},
}
ITEM.DeploySound = bSound("dev/magpouch.ogg")
ITEM.StartHolsterSound = bSound("dev/magpouch_replace_small.ogg")
ITEM.FinishHolsterSound = bSound("dev/holster.ogg")
ITEM.CancelHolsterSound = bSound("dev/grab.ogg")
function ITEM:EntInitialize()
print( self )
for k, v in ipairs(self.DefaultBodygroups) do
if v then
self:SetBodygroup( k-1, v )
end
end
end
function ITEM:Sound( soundName, soundLevel, pitchPercent, volume, channel, soundFlags, dsp, filter )
local emiton = self
if self:GetHandler():IsValid() then
emiton = self:GetHandler()
end
emiton:EmitSound( soundName, soundLevel, pitchPercent, volume, channel, soundFlags, dsp )
end
function ITEM:Attack() end
function ITEM:AttackAlt() end
function ITEM:Think()
if self:GetHolsterIn() != 0 and self:GetHolsterIn() <= CurTime() then
self:FinishHolster()
self:SetHolsterIn( 0 )
end
end
function ITEM:PlayerAnimation( seqname )
local p = self:GetOwner()
p:DoAnimationEvent( p:LookupSequence( seqname ) )
end
function ITEM:EntThink() end
function ITEM:EntPhysicsCollide() end
function ITEM:Reload() end
function ITEM:Drop() end
function ITEM:Deploy()
self:Sound( self.DeploySound, 70, 100, 0.4 )
end
function ITEM:StartHolster()
self:Sound( self.StartHolsterSound, 70, 100, 0.4 )
self:SetHolsterIn( CurTime() + 0.25 )
end
function ITEM:FinishHolster()
self:Sound( self.FinishHolsterSound, 70, 100, 0.4, CHAN_STATIC )
self:GetHandler():SetActiveR( NULL )
self:SetNoDraw( true )
end
function ITEM:CancelHolster()
self:SetHolsterIn( 0 )
self:Sound( self.CancelHolsterSound, 70, 100, 0.4 )
end
end