Bringing the repository back up to speed with the workshop mod.

This commit is contained in:
Michael Fabain Dirks
2016-06-15 11:58:55 +02:00
parent 441b32cc8c
commit c556fc6015
23 changed files with 344 additions and 190 deletions
+8 -5
View File
@@ -1,12 +1,15 @@
Changelist
- Made Seeker Weapons & Ammo configurable from console & cfg file.
- Updated Gamemode info so that new configuration options are visible on the client.
-
ToDo:
- Replace all createconvar with getconvar?
- Seeker model not existing after unblind?
- End round triggers
- Other game modes
- UI stuff
- Scoreboard
- Custom Collisions for Hiders? Allows to copy the prop geometry/align with rotation
- Custom Collisions for Hiders? Allows to copy the prop geometry/align with rotation
- Spectator: Spectate players(team only), first & third person
- UI: Proper Scoreboard replacement
- UI: Proper Team Selection replacement
- PostMatch: Implement Round Limit & Map Time Limit checking.
- PostMatch: Implement MapVoting? Or add support for MapVote addon?
- Seekers, Hiders: Taunts! And custom Taunts. And everything that belongs to that.
-14
View File
@@ -1,14 +0,0 @@
Based on the original "Prop Hunt" game mode, Xaymar's Custom Prop Hunt brings you some much needed changes to freshen up the gamemode.
New features:
- Easy configuration - configuration is now stored inside data\prop_hunt\ as a key-values table!
- Default Taunts are no longer infringing on copyrighted material - taunt your life away as a streamer or YouTuber!
- Taunt Pack support - add new taunts by just downloading addons, no file modification needed!
- Prop Rotation - Hit F4 and dance- err I ment rotate!
Fixes:
- Camera can now no longer glitch through the world.
- Camera root position now closely follows the prop size.
- Prop sizes are now set correctly - previously you could make your way behind things with props way too big.
- Props can no longer heal themselves by becoming prop, they'll always keep the same percentage of health.
- Picking a prop is now more accurate, picking from where your camera is looking.
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 KiB

After

Width:  |  Height:  |  Size: 269 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 38 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 270 KiB

@@ -20,5 +20,10 @@ function ENT:Think()
self:SetPos(self.Owner:GetPos() + pos)
self:SetVelocity(self:GetOwner():GetVelocity())
-- Angles
if (self.Owner:GetNWBool("PropRotation")) then
self:SetAngles(self.Owner:EyeAngles())
end
end
--]]
@@ -1,6 +1,7 @@
-- SWEP Information
SWEP.Author = "Michael 'Xaymar' Dirks"
SWEP.Contact = "info@project-kube.de"
SWEP.PrintName = "PH Submachine Gun"
SWEP.Purpose = "More accurate SMG for Prop Hunt."
SWEP.Instructions = "Fire away! Alternative fire to fire a grenade."
SWEP.Category = "Prop Hunt Weapons"
@@ -30,6 +31,7 @@ SWEP.Primary.DefaultClip = 45
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "SMG1"
SWEP.Primary.Damage = 5
SWEP.Primary.RefireTime = 0.1
-- Secondary Ammunition: SMG Grenades
SWEP.Secondary.ClipSize = 1
@@ -37,11 +39,12 @@ SWEP.Secondary.DefaultClip = 0
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "SMG1_Grenade"
SWEP.Secondary.Damage = 100
SWEP.Secondary.RefireTime = 1.0
-- Recoil
SWEP.Recoil = {}
SWEP.Recoil.SingleFire = 1.0
SWEP.Recoil.BurstFire = 4.0
SWEP.Recoil.SingleFire = 0.2
SWEP.Recoil.BurstFire = 1.0
SWEP.Recoil.SecondaryFire = 8.0
-- Accuracy
@@ -82,10 +85,14 @@ function SWEP:Initialize()
-- Initialize default values.
self.BurstFire = false
self:SetNWBool("BurstFire", false)
self.LastReload = CurTime()
self.PrimaryAccuracy = self.Accuracy.Primary.Max
self.LastPrimaryAttack = CurTime()
self.SecondaryAccuracy = self.Accuracy.Secondary.Max
self.LastSecondaryAttack = CurTime()
end
-- Primary Attack
@@ -95,13 +102,13 @@ function SWEP:CanPrimaryAttack()
-- If not, check if there's ammo available.
if (self:Ammo1() > 0) then
-- If yes, reload and wait for weapon to be ready again.
self:EmitSound(self.Sound.NoPrimaryAmmo)
self.Weapon:EmitSound(self.Sound.NoPrimaryAmmo)
self:Reload()
return false
end
-- If no, emit empty sound for primary fire.
self:EmitSound(self.Sound.NoPrimaryAmmo)
self.Weapon:EmitSound(self.Sound.NoPrimaryAmmo)
self:SetNextPrimaryFire(CurTime() + 0.1)
return false
end
@@ -114,31 +121,37 @@ function SWEP:PrimaryAttack()
-- Can't fire without Ammo
if (!self:CanPrimaryAttack()) then return end
if (self.BurstFire == false) then
if (self:GetNWBool("BurstFire") == false) then
-- Single Mode: fire and take one bullet from the clip.
self:ShootBullet(self.Primary.Damage, bullet_count, 1.0 - self.PrimaryAccuracy)
self:TakePrimaryAmmo(1)
self:EmitSound(self.Sound.SingleFire)
self:SetNextPrimaryFire( CurTime() + 0.1 )
self:SetNextPrimaryFire( CurTime() + self.Primary.RefireTime )
self.Weapon:EmitSound(self.Sound.SingleFire)
-- Apply recoil
self.Owner:ViewPunch( Angle(-1, 0, 0) * self.Recoil.SingleFire * (1 + (1 - self.PrimaryAccuracy)) )
if IsValid(self.Owner) then
self.Owner:ViewPunch( Angle(-1, 0, 0) * self.Recoil.SingleFire * (1 + (1 - self.PrimaryAccuracy)) )
self:ShootBullet(self.Primary.Damage, 1, 1.0 - self.PrimaryAccuracy)
end
-- Decrease accuracy
self.PrimaryAccuracy = math.Clamp(self.PrimaryAccuracy - self.Accuracy.Primary.Reduction, self.Accuracy.Primary.Min, self.Accuracy.Primary.Max)
else
-- Burst Mode: fire and take up to three bullets from the clip
local bulletCount = math.Clamp(self:Clip1(), 1, 3)
self:ShootBullet(self.Primary.Damage, bullet_count, 1.0 - self.PrimaryAccuracy)
self:TakePrimaryAmmo(bulletCount)
self:EmitSound(self.Sound.BurstFire)
self:SetNextPrimaryFire( CurTime() + 0.5 * (bulletCount / 3.0) )
self:SetNextPrimaryFire( CurTime() + self.Primary.RefireTime * bulletCount )
self.Weapon:EmitSound(self.Sound.BurstFire)
-- Apply recoil
self.Owner:ViewPunch(Angle(-1, 0, 0) * self.Recoil.BurstFire * (bulletCount / 3.0) * (1 + (1 - self.PrimaryAccuracy)))
-- Decrease accuracy
self.PrimaryAccuracy = math.Clamp(self.PrimaryAccuracy - self.Accuracy.Primary.Reduction * bulletCount, self.Accuracy.Primary.Min, self.Accuracy.Primary.Max)
for i = 1, bulletCount do
if (IsValid(self)) && (IsValid(self.Owner)) then
-- Apply recoil & shoot
self.Owner:ViewPunch(Angle(-1, 0, 0) * self.Recoil.BurstFire * (1 + (1 - self.PrimaryAccuracy)))
self:ShootBullet(self.Primary.Damage, 1, 1.0 - self.PrimaryAccuracy)
-- Decrease accuracy
self.PrimaryAccuracy = math.Clamp(self.PrimaryAccuracy - self.Accuracy.Primary.Reduction, self.Accuracy.Primary.Min, self.Accuracy.Primary.Max)
end
end
end
-- Set Animation and attack time.
@@ -147,17 +160,15 @@ function SWEP:PrimaryAttack()
return
end
-- Secondary Attack
function SWEP:CanSecondaryAttack()
if (self:Clip2() == 0) then
if (self:Ammo2() == 0) then
self:EmitSound(self.Sound.NoSecondaryAmmo)
self.Weapon:EmitSound(self.Sound.NoSecondaryAmmo)
self:SetNextSecondaryFire( CurTime() + 1.0 )
return false
else
self:SetClip2( 1 )
self.Owner:SetAmmo( self.Owner:GetAmmoCount( self:GetSecondaryAmmoType() ) - 1, self:GetSecondaryAmmoType() )
end
end
@@ -168,9 +179,11 @@ function SWEP:SecondaryAttack()
-- Can't fire without Ammo
if (!self:CanSecondaryAttack()) then return end
self.Owner:SetAmmo( self.Owner:GetAmmoCount( self:GetSecondaryAmmoType() ) - 1, self:GetSecondaryAmmoType() )
-- Emit a sound.
self:EmitSound(self.Sound.SecondaryFire)
self:SetNextSecondaryFire( CurTime() + 1.0 )
self.Weapon:EmitSound(self.Sound.SecondaryFire)
self:SetNextSecondaryFire( CurTime() + self.Secondary.RefireTime )
self:TakeSecondaryAmmo(1)
-- Create grenade
@@ -193,18 +206,38 @@ end
-- Reload: Combination of reloading and switching fire type.
function SWEP:Reload()
if self:DefaultReload(ACT_VM_RELOAD) then
self:EmitSound(self.Sound.Reload)
else
if (self.LastReload) && ((CurTime() - self.LastReload) > 1) then
self:GetOwner():ChatPrint("BurstToggle")
self.BurstFire = !self.BurstFire
-- Fix reload for secondary
if (self:Clip2() == 0) then
if (self:Ammo2() > 0) then
self:SetClip2( 1 )
end
end
self.LastReload = CurTime()
if self:DefaultReload(ACT_VM_RELOAD) then
self.Weapon:EmitSound(self.Sound.Reload)
else
if (self.LastReload) && ((CurTime() - self.LastReload) > 1) then
self.BurstFire = !self:GetNWBool("BurstFire")
self.LastReload = CurTime()
if (self.BurstFire) then
self.Weapon:EmitSound(self.Sound.SwitchBurst)
if SERVER then self:GetOwner():ChatPrint("Weapon: BurstFire is now on.") end
else
self.Weapon:EmitSound(self.Sound.SwitchSingle)
if SERVER then self:GetOwner():ChatPrint("Weapon: BurstFire is now off.") end
end
if SERVER then self:SetNWBool("BurstFire", self.BurstFire) end
end
end
return
end
function SWEP:ShootEffects()
end
-- Think: Restore accuracy over time.
function SWEP:Think()
local ThinkTime = CurTime()
@@ -27,6 +27,8 @@
-- ------------------------------------------------------------------------- --
include("sh_init.lua")
GM.UI = {}
include("client/cl_ui_help.lua")
include("client/cl_ui_teamselection.lua")
-- ------------------------------------------------------------------------- --
@@ -44,7 +46,6 @@ function GM:Initialize()
print("Prop Hunt CL: Complete.")
print("-------------------------------------------------------------------------")
end
function GM:Think() end
@@ -82,88 +83,6 @@ function GM:PlayerSpawn()
player_manager.RunClass(LocalPlayer(), "ClientSpawn")
end
function GM:HUDPaint()
local State = GetGlobalInt("RoundState", GAMEMODE.States.PreMatch)
-- Show Status at the top center
local statusX, statusY, statusW, statusH
statusW = 192
statusH = 64
statusX = ScrW() / 2 - statusW / 2
statusY = 16
--! States
-- Pre Match
if (State == GAMEMODE.States.PreMatch) then
-- Show Status at the top center
draw.RoundedBox(16, statusX, statusY, statusW, statusH, Color(0, 0, 0, 204))
surface.SetFont( "Trebuchet24" )
surface.SetTextColor( 255, 255, 255, 255 )
local w,h = surface.GetTextSize("Waiting...")
surface.SetTextPos( statusX + statusW/2 - w / 2, statusY + statusH/2 - h / 2)
surface.DrawText( "Waiting..." )
-- Pre Round
elseif (State == GAMEMODE.States.PreRound) then
-- Show Status at the top center
draw.RoundedBox(16, statusX, statusY, statusW, statusH, Color(0, 0, 0, 204))
surface.SetFont( "Trebuchet24" )
surface.SetTextColor( 255, 255, 255, 255 )
local w,h = surface.GetTextSize("Preparing...")
surface.SetTextPos( statusX + statusW/2 - w / 2, statusY + statusH/2 - h / 2)
surface.DrawText( "Preparing..." )
-- Hide!
elseif (State == GAMEMODE.States.Hide) then
local strTime = tostring(math.ceil(GetGlobalInt("RoundTime")))
-- Show Status at the top center
draw.RoundedBox(16, statusX, statusY, statusW, statusH, Color(0, 0, 0, 204))
surface.SetTextColor(255,255,255,255)
surface.SetFont("Trebuchet18")
local w,h = surface.GetTextSize("Seekers unblinded in:")
surface.SetTextPos(statusX + statusW/2 - w / 2, statusY + statusH/4 - h / 2)
surface.DrawText("Seekers unblinded in:")
surface.SetFont( "Trebuchet24" )
local w,h = surface.GetTextSize(strTime.." Seconds!")
surface.SetTextPos( statusX + statusW/2 - w / 2, statusY + statusH/1.5 - h / 2)
surface.DrawText(strTime.." Seconds!")
elseif (State == GAMEMODE.States.Seek) then
local intTime = math.ceil(GetGlobalInt("RoundTime"))
local strTime = string.format("%d:%02d", math.floor(intTime / 60), math.ceil(intTime % 60))
-- Show Status at the top center
draw.RoundedBox(16, statusX, statusY, statusW, statusH, Color(0, 0, 0, 204))
surface.SetTextColor(255,255,255,255)
surface.SetFont("Trebuchet18")
local w,h = surface.GetTextSize("Hunting Time!")
surface.SetTextPos(statusX + statusW/2 - w / 2, statusY + statusH/4 - h / 2)
surface.DrawText("Hunting Time!")
surface.SetFont( "Trebuchet24" )
local w,h = surface.GetTextSize(strTime)
surface.SetTextPos( statusX + statusW/2 - w / 2, statusY + statusH/1.5 - h / 2)
surface.DrawText(strTime)
elseif (State == GAMEMODE.States.PostRound) then
elseif (State == GAMEMODE.States.PostMatch) then
end
player_manager.RunClass(LocalPlayer(), "HUDPaint")
end
function GM:ShowTeamSelection()
TeamSelectionUI:Show()
end
concommand.Add("ph_select_team", function() GAMEMODE:ShowTeamSelection() end)
function GM:GetHandsModel()
return player_manager.RunClass(LocalPlayer(), "GetHandsModel")
end
function GM:PostDrawViewModel( vm, ply, weapon )
if ( weapon.UseHands || !weapon:IsScripted() ) then
local hands = LocalPlayer():GetHands()
@@ -174,9 +93,9 @@ end
-- ------------------------------------------------------------------------- --
--! Player Manager Binding
-- ------------------------------------------------------------------------- --
function GM:CalcView(ply, pos, ang, fov, nearZ, farZ)
return player_manager.RunClass(LocalPlayer(), "CalcView", {origin = pos, angles = ang, fov = fov, znear = nearZ, zfar = farZ})
end
function GM:HUDPaint() player_manager.RunClass(LocalPlayer(), "HUDPaint") end
function GM:CalcView(ply, pos, ang, fov, nearZ, farZ) return player_manager.RunClass(LocalPlayer(), "CalcView", {origin = pos, angles = ang, fov = fov, znear = nearZ, zfar = farZ}) end
function GM:GetHandsModel() return player_manager.RunClass(LocalPlayer(), "GetHandsModel") end
-- ------------------------------------------------------------------------- --
--! Gamemode Functionality
@@ -231,6 +150,28 @@ function GM:OnContextMenuClose()
LocalPlayer().Data.ThirdPerson = !LocalPlayer().Data.ThirdPerson
end
function GM:OnSpawnMenuOpen()
print("Prop Hunt CL: Enabling Prop Rotation")
LocalPlayer():SetNWBool("PropRotation", true)
net.Start("PlayerEnablePropRotation");net.SendToServer()
end
function GM:OnSpawnMenuClose()
print("Prop Hunt CL: Disabling Prop Rotation")
LocalPlayer():SetNWBool("PropRotation", false)
net.Start("PlayerDisablePropRotation");net.SendToServer()
end
function GM:ShowHelpUI()
self.UI.Help:Show()
end
concommand.Add("ph_show_help", function() GAMEMODE:ShowHelpUI() end)
function GM:ShowTeamSelection()
TeamSelectionUI:Show()
end
concommand.Add("ph_select_team", function() GAMEMODE:ShowTeamSelection() end)
-- ------------------------------------------------------------------------- --
--! Network Messages
-- ------------------------------------------------------------------------- --
@@ -0,0 +1,61 @@
--[[
The MIT License (MIT)
Copyright (c) 2015 Xaymar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
--]]
local PANEL = vgui.Create("DFrame")
PANEL:SetSize(400, 300)
PANEL:SetTitle("Help")
PANEL:SetDraggable(true)
PANEL:SetVisible(false)
PANEL:SetDraggable(true)
PANEL:SetSizable(true)
PANEL:ShowCloseButton(true)
PANEL:SetDeleteOnClose(false)
function PANEL:Init()
DFrame.Init(self)
-- Sheets
self.Sheets = vgui.Create("DPropertySheet", self)
self.Sheets:Dock(FILL)
-- Basic Info
self.BasicInfoSheet = vgui.Create("DPanel", self.Sheets)
function self.BasicInfoSheet:Paint(w, h)
draw.RoundedBox(4, 0, 0, 100, 100, Color(0,128,255))
end
self.Sheets:AddSheet("The Gamemode", self.BasicInfoSheet)
end
function PANEL:Show()
self:SetSize(ScrW(), ScrH())
self:Center()
self:SetVisible(true)
self:SetFocusTopLevel(true)
self:SlideDown(.5)
self:MakePopup()
end
GAMEMODE.UI.Help = PANEL
@@ -36,6 +36,7 @@ AddCSLuaFile("player_class/class_hider.lua")
-- Client-Only
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("client/cl_ui_help.lua")
AddCSLuaFile("client/cl_ui_teamselection.lua")
-- ------------------------------------------------------------------------- --
@@ -53,6 +54,7 @@ include "server/states/state_preround.lua"
include "server/states/state_hide.lua"
include "server/states/state_seek.lua"
include "server/states/state_postround.lua"
include "server/states/state_postmatch.lua"
function GM:Initialize()
print("-------------------------------------------------------------------------")
@@ -66,6 +68,8 @@ function GM:Initialize()
util.AddNetworkString("PlayerResetHull")
util.AddNetworkString("PlayerViewOffset")
util.AddNetworkString("PlayerRegisterPropEntity")
util.AddNetworkString("PlayerEnablePropRotation")
util.AddNetworkString("PlayerDisablePropRotation")
print("Prop Hunt: Initializing Gamemode Data...")
self.Data = {}
@@ -219,6 +223,14 @@ function GM:SetRoundState(State)
SetGlobalInt("RoundState", State)
end
function GM:SetRoundTime(Time)
SetGlobalInt("RoundTime", Time)
end
function GM:SetRoundWinner(Winner)
SetGlobalInt("RoundWinner", Winner)
end
function GM:PlayerHullFromEntity(ply, ent)
if (ent) && (ent:IsValid()) then
local hmin, hmax = ent:OBBMins(), ent:OBBMaxs()
@@ -268,7 +280,9 @@ end
--! Commands
-- ------------------------------------------------------------------------- --
-- F1/ShowHelp
function GM:ShowHelp(ply) end
function GM:ShowHelp(ply)
ply:ConCommand("ph_show_help")
end
-- F2/ShowTeam - Select Team
function GM:ShowTeam(ply)
@@ -305,6 +319,19 @@ concommand.Add("ph_debug_printplayers", function(ply, cmd, args, argStr)
end, nil, nil, FCVAR_CLIENTCMD_CAN_EXECUTE + FCVAR_CHEAT)
-- ------------------------------------------------------------------------- --
--! Network Messages
-- ------------------------------------------------------------------------- --
net.Receive("PlayerEnablePropRotation", function(len, ply)
print("Prop Hunt: Enabling Prop Rotation")
ply:SetNWBool("PropRotation", true)
end)
net.Receive("PlayerDisablePropRotation", function(len, ply)
print("Prop Hunt: Disabling Prop Rotation")
ply:SetNWBool("PropRotation", false)
end)
-- ------------------------------------------------------------------------- --
--! LEGACY CODE - TO BE REPLACED SOON
-- ------------------------------------------------------------------------- --
@@ -67,7 +67,7 @@ function CLASS:PostDeath() end
function CLASS:DoDeath() end
function CLASS:DeathThink()
if (CurTime() - self.Player.Data.AliveTime) > 2 then
if (CurTime() - self.Player.Data.AliveTime) > 5 then
self.Player:Spawn()
return true
end
@@ -128,7 +128,91 @@ function CLASS:ClientSpawn() end
-- View & HUD
function CLASS:GetHandsModel() return BaseClass.GetHandsModel(self) end
function CLASS:ShouldDrawLocal() return false end
function CLASS:HUDPaint() end
function CLASS:HUDPaint()
local State = GetGlobalInt("RoundState", GAMEMODE.States.PreMatch)
-- Show Status at the top center
local statusX, statusY, statusW, statusH
statusW = 192
statusH = 64
statusX = ScrW() / 2 - statusW / 2
statusY = 16
-- Status
if (State == GAMEMODE.States.PreMatch) then -- Pre Match
draw.RoundedBox(16, statusX, statusY, statusW, statusH, Color(0, 0, 0, 204))
surface.SetFont( "Trebuchet24" )
surface.SetTextColor( 255, 255, 255, 255 )
local w,h = surface.GetTextSize("Waiting for Players")
surface.SetTextPos( statusX + statusW/2 - w / 2, statusY + statusH/2 - h / 2)
surface.DrawText("Waiting for Players")
elseif (State == GAMEMODE.States.PreRound) then -- Pre Round
draw.RoundedBox(16, statusX, statusY, statusW, statusH, Color(0, 0, 0, 204))
surface.SetFont( "Trebuchet24" )
surface.SetTextColor( 255, 255, 255, 255 )
local w,h = surface.GetTextSize("Preparing...")
surface.SetTextPos( statusX + statusW/2 - w / 2, statusY + statusH/2 - h / 2)
surface.DrawText( "Preparing..." )
elseif (State == GAMEMODE.States.Hide) then -- Hide
local strTime = tostring(math.ceil(GetGlobalInt("RoundTime")))
-- Show Status at the top center
draw.RoundedBox(16, statusX, statusY, statusW, statusH, Color(0, 0, 0, 204))
surface.SetTextColor(255,255,255,255)
surface.SetFont("Trebuchet18")
local w,h = surface.GetTextSize("Seekers unblinded in:")
surface.SetTextPos(statusX + statusW/2 - w / 2, statusY + statusH/4 - h / 2)
surface.DrawText("Seekers unblinded in:")
surface.SetFont( "Trebuchet24" )
local w,h = surface.GetTextSize(strTime.." Seconds!")
surface.SetTextPos( statusX + statusW/2 - w / 2, statusY + statusH/1.5 - h / 2)
surface.DrawText(strTime.." Seconds!")
elseif (State == GAMEMODE.States.Seek) then -- Seek
local intTime = math.ceil(GetGlobalInt("RoundTime"))
local strTime = string.format("%d:%02d", math.floor(intTime / 60), math.ceil(intTime % 60))
-- Show Status at the top center
draw.RoundedBox(16, statusX, statusY, statusW, statusH, Color(0, 0, 0, 204))
surface.SetTextColor(255,255,255,255)
surface.SetFont("Trebuchet18")
local w,h = surface.GetTextSize("Hunting Time!")
surface.SetTextPos(statusX + statusW/2 - w / 2, statusY + statusH/4 - h / 2)
surface.DrawText("Hunting Time!")
surface.SetFont( "Trebuchet24" )
local w,h = surface.GetTextSize(strTime)
surface.SetTextPos( statusX + statusW/2 - w / 2, statusY + statusH/1.5 - h / 2)
surface.DrawText(strTime)
elseif (State == GAMEMODE.States.PostRound) then -- Post Round
-- Show Status at the top center
draw.RoundedBox(16, statusX, statusY, statusW, statusH, Color(0, 0, 0, 204))
surface.SetTextColor(255,255,255,255)
surface.SetFont("Trebuchet18")
local w,h = surface.GetTextSize("Match Result")
surface.SetTextPos(statusX + statusW/2 - w / 2, statusY + statusH/4 - h / 2)
surface.DrawText("Match Result")
local victor = GAMEMODE:GetRoundWinner()
local victorName = "Unknown"
if (victor == GAMEMODE.Teams.Spectator) then
victorName = "Draw"
elseif (victor == GAMEMODE.Teams.Hiders) then
victorName = "Hiders Win"
elseif (victor == GAMEMODE.Teams.Seekers) then
victorName = "Seekers Win"
end
surface.SetTextColor(team.GetColor(victor))
surface.SetFont( "Trebuchet24" )
local w,h = surface.GetTextSize(victorName)
surface.SetTextPos( statusX + statusW/2 - w / 2, statusY + statusH/1.5 - h / 2)
surface.DrawText(victorName)
elseif (State == GAMEMODE.States.PostMatch) then -- Post Match
end
end
function CLASS:CalcView(camdata) return camdata end
-- ------------------------------------------------------------------------- --
@@ -74,7 +74,12 @@ function CLASS:PostDeath(attacker, dmginfo)
BaseClass.PostDeath(self, inflictor, attacker)
-- Delete Hands Model
self.Player:GetHands():Remove()
if IsValid(self.Player:GetHands()) then
self.Player:GetHands():Remove()
end
if IsValid(self.Player.Data.Prop) then
self.Player.Data.Prop:Remove()
end
-- Collision Group
self.Player:SetCollisionGroup(COLLISION_GROUP_PLAYER)
@@ -186,14 +191,14 @@ function CLASS:CalcView(camdata)
end
-- Incremental Distance instead of instant.
viewDist = math.Clamp(viewDist * 0.9 + maxViewDist * 0.1, 0, maxViewDist) -- Zoom Out
viewDist = math.Clamp(viewDist * 0.95 + maxViewDist * 0.05, 0, maxViewDist) -- Zoom Out
else
if (IsValid(self.Player:GetHands())) then
self.Player:GetHands():SetRenderMode(RENDERMODE_TRANSALPHA)
self.Player:GetHands():SetColor(Color(255, 255, 255, 0))
end
viewDist = math.Clamp(viewDist * 0.9, 0, maxViewDist) -- Zoom In
viewDist = math.Clamp(viewDist * 0.95, 0, maxViewDist) -- Zoom In
end
-- Trace from Player to would-be camera position
@@ -94,7 +94,7 @@ function CLASS:DamageEntity(ent, att, dmg)
if IsValid(ent) && (!(ent:IsPlayer())) then
if (ent:GetClass() == "ph_prop") then
ent:GetOwner():TakeDamageInfo(dmg)
elseif (ent:GetClass() == "func_breakable") then -- ToDo: Make Configurable which entities don't hurt
elseif (ent:GetClass() == "func_breakable") then -- ToDo: Make Configurable which entities don't hurt?
else
att:TakeDamage(GAMEMODE.Config.Seeker:HealthPenalty(), ent, ent)
end
@@ -157,14 +157,13 @@ function CLASS:ClientSpawn()
end
function CLASS:HUDPaint()
BaseClass.HUDPaint(self)
local State = GetGlobalInt("RoundState", GAMEMODE.States.PreMatch)
if (State == GAMEMODE.States.Hide) then
local intTime = math.ceil(GetGlobalInt("RoundTime"))
local strTime = tostring(intTime)
-- Seekers are blinded in this Phase.
draw.RoundedBox(0, 0, 0, surface.ScreenWidth(), surface.ScreenHeight(), Color(0, 0, 0, 255))
-- Show Status at the center
surface.SetTextColor( 255, 255, 255, 255 )
if (intTime >= 1) then
@@ -192,9 +191,9 @@ function CLASS:CalcView(camdata)
-- First/Third
if (self.Player.Data.ThirdPerson) then
viewDist = math.Clamp(viewDist * 0.9 + maxViewDist * 0.1, 0, maxViewDist) -- Zoom Out
viewDist = math.Clamp(viewDist * 0.95 + maxViewDist * 0.05, 0, maxViewDist) -- Zoom Out
else
viewDist = math.Clamp(viewDist * 0.9, 0, maxViewDist) -- Zoom In
viewDist = math.Clamp(viewDist * 0.95, 0, maxViewDist) -- Zoom In
end
-- Trace from Player to would-be camera position
@@ -168,8 +168,8 @@ GM.Config.Lists.ModelBlacklist = {}
GM.Config.Lists.ModelBlacklist["models/props/cs_assault/dollar.mdl"] = true
GM.Config.Lists.ModelBlacklist["models/props/cs_assault/money.mdl"] = true
GM.Config.Lists.ModelBlacklist["models/props/cs_office/snowman_arm.mdl"] = true
GM.Config.Lists.ModelBlacklist["models/props_junk/garbage_plasticbottle001a.mdl"] = true
GM.Config.Lists.ModelBlacklist["models/props/cs_office/projector_remote.mdl"] = true
--GM.Config.Lists.ModelBlacklist["models/props_junk/garbage_plasticbottle001a.mdl"] = true
GM.Config.Lists.ConCmds.ModelBlacklistList = concommand.Add("ph_list_model_blacklist_list", function(ply, cmd, args, argStr)
print("Model Blacklist:")
@@ -32,19 +32,13 @@ function StateHide:OnEnter(OldState)
GAMEMODE.Data.RoundTime = math.abs(GAMEMODE.Config.Round:BlindTime())
GAMEMODE.Data.RoundStartTime = CurTime()
SetGlobalInt("RoundTime", GAMEMODE.Data.RoundTime)
-- Freeze Seekers
for i, ply in ipairs(team.GetPlayers(GAMEMODE.Teams.Seekers)) do
ply:Freeze(true)
ply:Lock()
end
GAMEMODE:SetRoundTime(GAMEMODE.Data.RoundTime)
end
function StateHide:Tick()
-- Update Game Time
GAMEMODE.Data.RoundTime = math.abs(GAMEMODE.Config.Round:BlindTime()) - (CurTime() - GAMEMODE.Data.RoundStartTime)
SetGlobalInt("RoundTime", math.ceil(GAMEMODE.Data.RoundTime))
GAMEMODE:SetRoundTime(GAMEMODE.Data.RoundTime)
-- Advance to Seeking State
if (GAMEMODE.Data.RoundTime <= 0) then
@@ -53,6 +47,13 @@ function StateHide:Tick()
GAMEMODE.RoundManager:SetState(StateSeek)
end
-- Freeze Seekers
for i, ply in ipairs(team.GetPlayers(GAMEMODE.Teams.Seekers)) do
ply:Freeze(true)
ply:Lock()
ply:ScreenFade(SCREENFADE.IN, color_black, 1, 9999)
end
-- ToDo: Logic for more game modes here?
end
@@ -26,7 +26,7 @@ StatePostMatch = {}
function StatePostMatch:OnEnter(OldState)
if GAMEMODE.Config:Debug() then print("StatePostMatch: OnEnter") end
GAMEMODE:SetRoundState(GAMEMODE.States.PostMatch)
GAMEMODE:SetRoundState(GAMEMODE.States.PostMatch)
end
function StatePostMatch:Tick()
@@ -27,11 +27,15 @@ StatePostRound = {}
function StatePostRound:OnEnter(OldState)
if GAMEMODE.Config:Debug() then print("StatePostRound: OnEnter") end
GAMEMODE:SetRoundState(GAMEMODE.States.PostRound)
GAMEMODE.Data.RoundStartTime = CurTime()
end
function StatePostRound:Tick()
-- Advance State
GAMEMODE.RoundManager:SetState(StatePreRound) -- Test: Reset to Hide
if (CurTime() - GAMEMODE.Data.RoundStartTime) >= 5 then -- ToDo: configureable time?
GAMEMODE.RoundManager:SetState(StatePostMatch)
end
end
function StatePostRound:OnLeave(NewState)
@@ -42,12 +46,12 @@ function StatePostRound:OnLeave(NewState)
-- Swap Teams
local hiders, seekers = team.GetPlayers(GAMEMODE.Teams.Hiders), team.GetPlayers(GAMEMODE.Teams.Seekers)
for i, ply in ipairs(hiders) do
ply:KillSilent()
ply:SetTeam(GAMEMODE.Teams.Seekers)
player_manager.SetPlayerClass(ply, "Seeker")
end
for i, ply in ipairs(seekers) do
ply:KillSilent()
ply:SetTeam(GAMEMODE.Teams.Hiders)
player_manager.SetPlayerClass(ply, "Hider")
end
-- TODO: Other Gamemodes
@@ -39,14 +39,12 @@ end
function StatePreRound:OnLeave(NewState)
if GAMEMODE.Config:Debug() then print("StatePreRound: OnLeave") end
-- Game Mode: Basic
if (GAMEMODE.Config:GameMode() == GAMEMODE.Modes.Original) then
-- Respawn Everyone
for i, ply in ipairs(player.GetAll()) do
ply:KillSilent()
ply.Data.Alive = true
ply:Spawn()
end
-- TODO: Other Gamemodes
-- Respawn Everyone
for i, ply in ipairs(player.GetAll()) do
ply:KillSilent()
ply.Data.Alive = true
ply:Spawn()
ply:ScreenFade(SCREENFADE.PURGE, color_black, 0, 0)
ply:ScreenFade(SCREENFADE.IN, color_black, 1, 0)
end
end
@@ -35,23 +35,22 @@ function StateSeek:OnEnter(OldState)
for i, ply in ipairs(team.GetPlayers(GAMEMODE.Teams.Seekers)) do
ply:Freeze(false)
ply:UnLock()
ply:ScreenFade(SCREENFADE.PURGE, color_black, 0, 0)
ply:ScreenFade(SCREENFADE.IN, color_black, 1, 0)
end
end
function StateSeek:Tick()
-- Update Game Time
GAMEMODE.Data.RoundTime = GAMEMODE.Config.Round:Time() - (CurTime() - GAMEMODE.Data.RoundStartTime)
SetGlobalInt("RoundTime", math.ceil(GAMEMODE.Data.RoundTime))
GAMEMODE:SetRoundTime(GAMEMODE.Data.RoundTime)
-- Conditions for moving to the next State
if (GAMEMODE.Data.RoundTime <= 0) then -- No Time remaining
GAMEMODE.Data.Winner = GAMEMODE.Teams.Hiders
GAMEMODE.RoundManager:SetState(StatePostRound)
end
-- Condition: No Seekers / Hiders alive.
-- Victory Conditions
local hiders, seekers = team.GetPlayers(GAMEMODE.Teams.Hiders), team.GetPlayers(GAMEMODE.Teams.Seekers)
local hiderAlive, seekerAlive = false, false
if GAMEMODE.Config:Debug() then
hiderAlive = true;seekerAlive = true
end
for i,ply in ipairs(hiders) do
if (ply.Data.Alive) then
hiderAlive = true
@@ -63,17 +62,22 @@ function StateSeek:Tick()
end
end
if (hiderAlive == false) then
if (seekerAlive == false) then
GAMEMODE.Data.Winner = GAMEMODE.Teams.Spectators -- Shows as Draw
if (seekerAlive == false) then -- Draw, both teams dead.
GAMEMODE:SetRoundWinner(GAMEMODE.Teams.Spectators)
GAMEMODE.RoundManager:SetState(StatePostRound)
else
GAMEMODE.Data.Winner = GAMEMODE.Teams.Seekers
else -- Seeker victory, Hiders dead
GAMEMODE:SetRoundWinner(GAMEMODE.Teams.Seekers)
GAMEMODE.RoundManager:SetState(StatePostRound)
end
else
if (seekerAlive == false) then
GAMEMODE.Data.Winner = GAMEMODE.Teams.Hiders
if (seekerAlive == false) then -- Hider Victory, Seeker dead.
GAMEMODE:SetRoundWinner(GAMEMODE.Teams.Hiders)
GAMEMODE.RoundManager:SetState(StatePostRound)
else
if (GAMEMODE.Data.RoundTime <= 0) then -- No Time remaining
GAMEMODE:SetRoundWinner(GAMEMODE.Teams.Hiders)
GAMEMODE.RoundManager:SetState(StatePostRound)
end
end
end
end
@@ -72,7 +72,6 @@ function GM:CreateTeams()
team.SetUp(self.Teams.Spectators, "Spectators", Color(127, 127, 127, 255))
team.SetSpawnPoint(self.Teams.Spectators, {
"info_player_deathmatch",
"info_player_axis",
"info_player_combine",
"info_player_counterterrorist",
"info_player_allies",
@@ -85,7 +84,6 @@ function GM:CreateTeams()
team.SetSpawnPoint(self.Teams.Seekers, {
"info_player_spawn",
"info_player_deathmatch",
"info_player_axis",
"info_player_combine",
"info_player_counterterrorist"
})
@@ -127,4 +125,12 @@ end
-- ------------------------------------------------------------------------- --
function GM:GetRoundState()
return GetGlobalInt("RoundState", self.States.PreMatch)
end
function GM:GetRoundTime()
return GetGlobalInt("RoundTime", 0)
end
function GM:GetRoundWinner()
return GetGlobalInt("RoundWinner", GAMEMODE.Teams.Spectator)
end
Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

After

Width:  |  Height:  |  Size: 152 KiB

+2 -5
View File
@@ -2,9 +2,6 @@
:: Fallback
SET "GARRYSMODPATH=C:\Program Files (x86)\Steam\steamapps\common\GarrysMod"
:: Retrieve Garry's Mod path from Regristry
::FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 4000" /v InstallLocation') DO SET "GARRYSMODPATH=%%B"
SET /P CHANGES=Changes:
"%GARRYSMODPATH%\bin\gmpublish.exe" update -id 468149739 -icon "Logo.jpg" -addon "Pack.gma" -changes "%CHANGES%
REM "%GARRYSMODPATH%\bin\gmpublish.exe" update -id 468149739
"%GARRYSMODPATH%\bin\gmpublish.exe" update -id 468149739 -icon "Logo.jpg" -addon "Pack.gma" -changes ""
PAUSE