Initial Reupload
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
-- Create new class
|
||||
local CLASS = {}
|
||||
|
||||
|
||||
-- Some settings for the class
|
||||
CLASS.DisplayName = "Hunter"
|
||||
CLASS.WalkSpeed = 230
|
||||
CLASS.CrouchedWalkSpeed = 0.4
|
||||
CLASS.RunSpeed = 290
|
||||
CLASS.DuckSpeed = 0.2
|
||||
CLASS.DrawTeamRing = false
|
||||
|
||||
|
||||
-- Called by spawn and sets loadout
|
||||
function CLASS:Loadout(pl)
|
||||
pl:GiveAmmo(32, "Buckshot")
|
||||
pl:GiveAmmo(255, "SMG1")
|
||||
pl:GiveAmmo(12, "357")
|
||||
|
||||
pl:Give("weapon_crowbar")
|
||||
pl:Give("weapon_shotgun")
|
||||
pl:Give("weapon_smg1")
|
||||
pl:Give("item_ar2_grenade")
|
||||
pl:Give("weapon_357")
|
||||
|
||||
local cl_defaultweapon = pl:GetInfo("cl_defaultweapon")
|
||||
|
||||
if pl:HasWeapon(cl_defaultweapon) then
|
||||
pl:SelectWeapon(cl_defaultweapon)
|
||||
end
|
||||
end
|
||||
|
||||
-- Called when player spawns with this class
|
||||
function CLASS:OnSpawn(pl)
|
||||
if !pl:IsValid() then return end
|
||||
|
||||
pl:SetupHands()
|
||||
pl:SetCustomCollisionCheck(true)
|
||||
pl:SetAvoidPlayers(false)
|
||||
pl:CrosshairEnable()
|
||||
|
||||
pl:SetViewOffset(Vector(0,0,64))
|
||||
pl:SetViewOffsetDucked(Vector(0,0,28))
|
||||
|
||||
local unlock_time = math.Clamp(GetConVar("ph_hunter_blindlock_time"):GetInt() - (CurTime() - GetGlobalFloat("RoundStartTime", 0)), 0, GetConVar("ph_hunter_blindlock_time"):GetInt())
|
||||
|
||||
local unblindfunc = function()
|
||||
if pl:IsValid() then
|
||||
pl:Blind(false)
|
||||
end
|
||||
end
|
||||
local lockfunc = function()
|
||||
if pl:IsValid() then
|
||||
pl.Lock(pl)
|
||||
end
|
||||
end
|
||||
local unlockfunc = function()
|
||||
if pl:IsValid() then
|
||||
pl.UnLock(pl)
|
||||
end
|
||||
end
|
||||
|
||||
if unlock_time > 2 then
|
||||
pl:Blind(true)
|
||||
|
||||
timer.Simple(unlock_time, unblindfunc)
|
||||
|
||||
timer.Simple(2, lockfunc)
|
||||
timer.Simple(unlock_time, unlockfunc)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
-- Hands
|
||||
function CLASS:GetHandsModel()
|
||||
if !GetConVar("ph_use_custom_plmodel"):GetBool() then
|
||||
return { model = "models/weapons/c_arms_combine.mdl", skin = 1, body = "0100000" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Called when a player dies with this class
|
||||
function CLASS:OnDeath(pl, attacker, dmginfo)
|
||||
pl:CreateRagdoll()
|
||||
pl:UnLock()
|
||||
|
||||
-- Always Reset the ViewOffset
|
||||
pl:SetViewOffset(Vector(0,0,64))
|
||||
pl:SetViewOffsetDucked(Vector(0,0,28))
|
||||
|
||||
-- Spawn Devil Ball
|
||||
local pos = pl:GetPos()
|
||||
if GetConVar("ph_enable_devil_balls"):GetBool() then
|
||||
if math.random() < 0.7 then --70% chance.
|
||||
local dropent = ents.Create("ph_devilball")
|
||||
dropent:SetPos(Vector(pos.x, pos.y, pos.z + 16)) -- to make sure the Devil Ball didn't fall underground.
|
||||
dropent:SetAngles(Angle(0,0,0))
|
||||
dropent:Spawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Register
|
||||
player_class.Register("Hunter", CLASS)
|
||||
@@ -0,0 +1,93 @@
|
||||
-- Create new class
|
||||
local CLASS = {}
|
||||
|
||||
|
||||
-- Some settings for the class
|
||||
CLASS.DisplayName = "Prop"
|
||||
CLASS.WalkSpeed = 250
|
||||
CLASS.CrouchedWalkSpeed = 0.2
|
||||
CLASS.RunSpeed = 275
|
||||
CLASS.DuckSpeed = 0.2
|
||||
CLASS.DrawTeamRing = false
|
||||
|
||||
-- Prevent 'mod_studio: MOVETYPE_FOLLOW with No Models error.'
|
||||
CLASS.DrawViewModel = false
|
||||
|
||||
|
||||
-- Called by spawn and sets loadout
|
||||
function CLASS:Loadout(pl)
|
||||
-- Props don't get anything
|
||||
end
|
||||
|
||||
|
||||
-- Called when player spawns with this class
|
||||
function CLASS:OnSpawn(pl)
|
||||
pl:SetColor(Color(0,0,0,0))
|
||||
pl:SetCustomCollisionCheck(true)
|
||||
pl:SetupHands()
|
||||
pl:SetAvoidPlayers(true)
|
||||
pl:CrosshairEnable()
|
||||
|
||||
-- Initial Setup during Prop choosing a props. Jump-Duck may still required somehow.
|
||||
pl:SetViewOffset(Vector(0,0,64))
|
||||
pl:SetViewOffsetDucked(Vector(0,0,28))
|
||||
|
||||
-- Prevent 'mod_studio: MOVETYPE_FOLLOW with No Models error.'
|
||||
pl:DrawViewModel(false)
|
||||
|
||||
pl.ph_prop = ents.Create("ph_prop")
|
||||
pl.ph_prop:SetPos(pl:GetPos())
|
||||
pl.ph_prop:SetAngles(pl:GetAngles())
|
||||
pl.ph_prop:Spawn()
|
||||
|
||||
if GetConVar("ph_use_custom_plmodel_for_prop"):GetBool() then
|
||||
if table.HasValue(PHE.PROP_PLMODEL_BANS, string.lower(player_manager.TranslatePlayerModel(pl:GetInfo("cl_playermodel")))) then
|
||||
pl.ph_prop:SetModel("models/player/kleiner.mdl")
|
||||
pl:ChatPrint("Your custom playermodel was banned from Props.")
|
||||
elseif table.HasValue(PHE.PROP_PLMODEL_BANS, string.lower(pl:GetInfo("cl_playermodel"))) then
|
||||
pl.ph_prop:SetModel("models/player/kleiner.mdl")
|
||||
pl:ChatPrint("Your custom playermodel was banned from Props.")
|
||||
else
|
||||
pl.ph_prop:SetModel(player_manager.TranslatePlayerModel(pl:GetInfo("cl_playermodel")))
|
||||
end
|
||||
end
|
||||
pl.ph_prop:SetSolid(SOLID_BBOX)
|
||||
pl.ph_prop:SetOwner(pl)
|
||||
pl:SetNWEntity("PlayerPropEntity", pl.ph_prop)
|
||||
|
||||
-- Delay start the AutoTaunt stuff and Control Tutorial
|
||||
timer.Simple(1, function()
|
||||
if IsValid(pl) then
|
||||
net.Start("AutoTauntSpawn")
|
||||
net.Send(pl)
|
||||
|
||||
net.Start("PH_ShowTutor")
|
||||
net.Send(pl)
|
||||
end
|
||||
end)
|
||||
|
||||
pl.ph_prop.max_health = 100
|
||||
end
|
||||
|
||||
|
||||
-- Hands
|
||||
function CLASS:GetHandsModel()
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
-- Called when a player dies with this class
|
||||
function CLASS:OnDeath(pl, attacker, dmginfo)
|
||||
pl:RemoveProp()
|
||||
-- reset the Prop Rotating State.
|
||||
net.Start("PHE.rotateState")
|
||||
net.WriteInt(0, 2)
|
||||
net.Send(pl)
|
||||
|
||||
pl:SetViewOffset(Vector(0,0,64))
|
||||
pl:SetViewOffsetDucked(Vector(0,0,28))
|
||||
end
|
||||
|
||||
|
||||
-- Register
|
||||
player_class.Register("Prop", CLASS)
|
||||
Reference in New Issue
Block a user