Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
kowalski7cc committed Apr 2, 2015
1 parent 5528081 commit 81b5fd0
Show file tree
Hide file tree
Showing 24 changed files with 717 additions and 559 deletions.
Binary file added gamemodes/prop_hunt/backgrounds/cs_office.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gamemodes/prop_hunt/backgrounds/cs_office_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gamemodes/prop_hunt/backgrounds/office.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gamemodes/prop_hunt/backgrounds/restaurant.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gamemodes/prop_hunt/backgrounds/starship.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gamemodes/prop_hunt/backgrounds/underwater.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gamemodes/prop_hunt/backgrounds/zombiebunker.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions gamemodes/prop_hunt/entities/entities/ph_prop/cl_init.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Include needed files
include("shared.lua")


// Called every frame?
function ENT:Draw()
self.Entity:DrawModel()
// Include needed files
include("shared.lua")


// Called every frame?
function ENT:Draw()
self.Entity:DrawModel()
end
112 changes: 55 additions & 57 deletions gamemodes/prop_hunt/entities/entities/ph_prop/init.lua
Original file line number Diff line number Diff line change
@@ -1,57 +1,55 @@
//Thanks to Blasteh for gmod update the fix and nifnat for spectate fix!

// Send required files to client
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")


// Include needed files
include("shared.lua")


// Called when the entity initializes
function ENT:Initialize()
self:SetModel("models/player/Kleiner.mdl")
self.health = 100
end


// Called when we take damge
function ENT:OnTakeDamage(dmg)
local pl = self:GetOwner()
local attacker = dmg:GetAttacker()
local inflictor = dmg:GetInflictor()

// Health
if pl && pl:IsValid() && pl:Alive() && pl:IsPlayer() && attacker:IsPlayer() && dmg:GetDamage() > 0 then
self.health = self.health - dmg:GetDamage()
pl:SetHealth(self.health)

if self.health <= 0 then
pl:KillSilent()

if inflictor && inflictor == attacker && inflictor:IsPlayer() then
inflictor = inflictor:GetActiveWeapon()
if !inflictor || inflictor == NULL then inflictor = attacker end
end

pl:RemoveProp() // Needs to be executed before net.Broadcast
net.Start( "PlayerKilledByPlayer" )

net.WriteEntity( pl )
net.WriteString( inflictor:GetClass() )
net.WriteEntity( attacker )

net.Broadcast()


MsgAll(attacker:Name() .. " found and killed " .. pl:Name() .. "\n")

attacker:AddFrags(1)
pl:AddDeaths(1)
attacker:SetHealth(math.Clamp(attacker:Health() + GetConVar("HUNTER_KILL_BONUS"):GetInt(), 1, 100))


end
end
end

// Send required files to client
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")


// Include needed files
include("shared.lua")


// Called when the entity initializes
function ENT:Initialize()
self:SetModel("models/player/Kleiner.mdl")
self.health = 100
end


// Called when we take damge
function ENT:OnTakeDamage(dmg)
local pl = self:GetOwner()
local attacker = dmg:GetAttacker()
local inflictor = dmg:GetInflictor()

// Health
if pl && pl:IsValid() && pl:Alive() && pl:IsPlayer() && attacker:IsPlayer() && dmg:GetDamage() > 0 then
self.health = self.health - dmg:GetDamage()
pl:SetHealth(self.health)

if self.health <= 0 then
pl:KillSilent()

if inflictor && inflictor == attacker && inflictor:IsPlayer() then
inflictor = inflictor:GetActiveWeapon()
if !inflictor || inflictor == NULL then inflictor = attacker end
end

net.Start( "PlayerKilledByPlayer" )

net.WriteEntity( pl )
net.WriteString( inflictor:GetClass() )
net.WriteEntity( attacker )

net.Broadcast()


MsgAll(attacker:Name() .. " found and killed " .. pl:Name() .. "\n")

attacker:AddFrags(1)
pl:AddDeaths(1)
attacker:SetHealth(math.Clamp(attacker:Health() + GetConVar("HUNTER_KILL_BONUS"):GetInt(), 1, 100))

pl:RemoveProp()
end
end
end
4 changes: 2 additions & 2 deletions gamemodes/prop_hunt/entities/entities/ph_prop/shared.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Entity information
ENT.Type = "anim"
// Entity information
ENT.Type = "anim"
ENT.Base = "base_anim"
227 changes: 116 additions & 111 deletions gamemodes/prop_hunt/gamemode/cl_init.lua
Original file line number Diff line number Diff line change
@@ -1,111 +1,116 @@
// Include the needed files
include("sh_init.lua")
//include("cl_hints.lua")

// Decides where the player view should be (forces third person for props)
function GM:CalcView(pl, origin, angles, fov)
local view = {}

if blind then
view.origin = Vector(20000, 0, 0)
view.angles = Angle(0, 0, 0)
view.fov = fov

return view
end

view.origin = origin
view.angles = angles
view.fov = fov

// Give the active weapon a go at changing the viewmodel position
if pl:Team() == TEAM_PROPS && pl:Alive() then
view.origin = origin + Vector(0, 0, hullz - 60) + (angles:Forward() * -80)
else
local wep = pl:GetActiveWeapon()
if wep && wep != NULL then
local func = wep.GetViewModelPosition
if func then
view.vm_origin, view.vm_angles = func(wep, origin*1, angles*1) // Note: *1 to copy the object so the child function can't edit it.
end

local func = wep.CalcView
if func then
view.origin, view.angles, view.fov = func(wep, pl, origin*1, angles*1, fov) // Note: *1 to copy the object so the child function can't edit it.
end
end
end

return view
end


// Draw round timeleft and hunter release timeleft
function HUDPaint()
if GetGlobalBool("InRound", false) then
local blindlock_time_left = (GetConVar("HUNTER_BLINDLOCK_TIME"):GetInt() - (CurTime() - GetGlobalFloat("RoundStartTime", 0))) + 1

if blindlock_time_left < 1 && blindlock_time_left > -6 then
blindlock_time_left_msg = "Hunters have been released!"
elseif blindlock_time_left > 0 then
blindlock_time_left_msg = "Hunters will be unblinded and released in "..string.ToMinutesSeconds(blindlock_time_left)
else
blindlock_time_left_msg = nil
end

if blindlock_time_left_msg then
surface.SetFont("MyFont")
local tw, th = surface.GetTextSize(blindlock_time_left_msg)

draw.RoundedBox(8, 20, 20, tw + 20, 26, Color(0, 0, 0, 75))
draw.DrawText(blindlock_time_left_msg, "MyFont", 31, 26, Color(255, 255, 0, 255), TEXT_ALIGN_LEFT)
end
end
end
hook.Add("HUDPaint", "PH_HUDPaint", HUDPaint)


// Called immediately after starting the gamemode
function Initialize()
hullz = 80
//surface.CreateFont("Arial", 14, 1200, true, false, "ph_arial")
surface.CreateFont( "MyFont",
{
font = "Arial",
size = 14,
weight = 1200,
antialias = true,
underline = false
})
end
hook.Add("Initialize", "PH_Initialize", Initialize)


// Resets the player hull
function ResetHull(um)
if LocalPlayer() && LocalPlayer():IsValid() then
LocalPlayer():ResetHull()
hullz = 80
end
end
usermessage.Hook("ResetHull", ResetHull)


// Sets the local blind variable to be used in CalcView
function SetBlind(um)
blind = um:ReadBool()
end
usermessage.Hook("SetBlind", SetBlind)


// Sets the player hull
function SetHull(um)
hullxy = um:ReadLong()
hullz = um:ReadLong()
new_health = um:ReadLong()

LocalPlayer():SetHull(Vector(hullxy * -1, hullxy * -1, 0), Vector(hullxy, hullxy, hullz))
LocalPlayer():SetHullDuck(Vector(hullxy * -1, hullxy * -1, 0), Vector(hullxy, hullxy, hullz))
LocalPlayer():SetHealth(new_health)
end
usermessage.Hook("SetHull", SetHull)
include("sh_init.lua")

// Decides where the player view should be (forces third person for props)
function GM:CalcView(pl, origin, angles, fov)
local view = {}

if blind then
view.origin = Vector(20000, 0, 0)
view.angles = Angle(0, 0, 0)
view.fov = fov

return view
end

view.origin = origin
view.angles = angles
view.fov = fov

// Give the active weapon a go at changing the viewmodel position
if pl:Team() == TEAM_PROPS && pl:Alive() then
view.origin = origin + Vector(0, 0, hullz - 60) + (angles:Forward() * -80)
else
local wep = pl:GetActiveWeapon()
if wep && wep != NULL then
local func = wep.GetViewModelPosition
if func then
view.vm_origin, view.vm_angles = func(wep, origin*1, angles*1) // Note: *1 to copy the object so the child function can't edit it.
end

local func = wep.CalcView
if func then
view.origin, view.angles, view.fov = func(wep, pl, origin*1, angles*1, fov) // Note: *1 to copy the object so the child function can't edit it.
end
end
end

return view
end


// Draw round timeleft and hunter release timeleft
function HUDPaint()
if GetGlobalBool("InRound", false) then
local blindlock_time_left = (HUNTER_BLINDLOCK_TIME - (CurTime() - GetGlobalFloat("RoundStartTime", 0))) + 1

if blindlock_time_left < 1 && blindlock_time_left > -6 then
blindlock_time_left_msg = "Ready or not, here we come!"
elseif blindlock_time_left > 0 then
blindlock_time_left_msg = "Hunters will be unblinded and released in "..string.ToMinutesSeconds(blindlock_time_left)
else
blindlock_time_left_msg = nil
end

if blindlock_time_left_msg then
surface.SetFont("MyFont")
local tw, th = surface.GetTextSize(blindlock_time_left_msg)

draw.RoundedBox(8, 20, 20, tw + 20, 26, Color(0, 0, 0, 75))
draw.DrawText(blindlock_time_left_msg, "MyFont", 31, 26, Color(255, 255, 0, 255), TEXT_ALIGN_LEFT)
end
end
end
hook.Add("HUDPaint", "PH_HUDPaint", HUDPaint)


// Called immediately after starting the gamemode
function Initialize()
hullz = 80
//surface.CreateFont("Arial", 14, 1200, true, false, "ph_arial")
surface.CreateFont( "MyFont",
{
font = "Arial",
size = 14,
weight = 1200,
antialias = true,
underline = false
})
end
hook.Add("Initialize", "PH_Initialize", Initialize)


// Resets the player hull
function ResetHull(um)
if LocalPlayer() && LocalPlayer():IsValid() then
LocalPlayer():ResetHull()
hullz = 80
end
end
usermessage.Hook("ResetHull", ResetHull)

// Show hands!
function GM:PostDrawViewModel( vm, pl, weapon )
if weapon.UseHands or (not weapon:IsScripted()) then
local hands = LocalPlayer():GetHands()
if IsValid(hands) then hands:DrawModel() end
end
end

// Sets the local blind variable to be used in CalcView
function SetBlind(um)
blind = um:ReadBool()
end
usermessage.Hook("SetBlind", SetBlind)


// Sets the player hull
function SetHull(um)
hullxy = um:ReadLong()
hullz = um:ReadLong()
new_health = um:ReadLong()

LocalPlayer():SetHull(Vector(hullxy * -1, hullxy * -1, 0), Vector(hullxy, hullxy, hullz))
LocalPlayer():SetHullDuck(Vector(hullxy * -1, hullxy * -1, 0), Vector(hullxy, hullxy, hullz))
LocalPlayer():SetHealth(new_health)
end
usermessage.Hook("SetHull", SetHull)
Loading

0 comments on commit 81b5fd0

Please sign in to comment.