-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
kowalski7cc
committed
Apr 2, 2015
1 parent
5528081
commit 81b5fd0
Showing
24 changed files
with
717 additions
and
559 deletions.
There are no files selected for viewing
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.
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Oops, something went wrong.