Initial commit again - git information was lost
Thankfully the gitlog shows the previous history steps just not the patchesmaster
commit
2f46316c24
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"title" : "Humans versus Robots",
|
||||
"type" : "gamemode",
|
||||
"tags" : [ "roleplay", "fun" ],
|
||||
"ignore" :
|
||||
[
|
||||
"*.git",
|
||||
"*.psd",
|
||||
"*.vcproj",
|
||||
"*.svn*"
|
||||
]
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
Binary file not shown.
After Width: | Height: | Size: 582 KiB |
Binary file not shown.
After Width: | Height: | Size: 651 KiB |
Binary file not shown.
After Width: | Height: | Size: 668 KiB |
|
@ -0,0 +1,19 @@
|
|||
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "base_anim" )
|
||||
|
||||
ENT.PrintName = ""
|
||||
ENT.Author = ""
|
||||
ENT.Contact = ""
|
||||
ENT.Purpose = ""
|
||||
ENT.Instructions = ""
|
||||
|
||||
ENT.Spawnable = false
|
||||
|
||||
function ENT:Think() end
|
||||
function ENT:SetOverlayText( text ) end
|
||||
function ENT:GetOverlayText() end
|
||||
function ENT:SetPlayer( ply ) end
|
||||
function ENT:GetPlayer() end
|
||||
function ENT:GetPlayerIndex() end
|
||||
function ENT:GetPlayerName() end
|
|
@ -0,0 +1,105 @@
|
|||
fs = 32
|
||||
surface.CreateFont("StatFont", {font = "Coolvetica", size = 32})
|
||||
surface.CreateFont("HVR_SmallFont", {font = "Sans Serif", size = 16})
|
||||
|
||||
local sw = ScrW();
|
||||
local sh = ScrH();
|
||||
|
||||
function drawStatBox(rnd, x, y, w, h, sw, sh, col, statName, statVal)
|
||||
-- Because we needed less boilerplate in HUDPaintStats()
|
||||
draw.RoundedBox(rnd, (x-0.005)*sw, (y-0.005)*sh, (w+0.01)*sw, (h+0.01)*sh, Color(0, 0, 0, 0.5*(col.a)))
|
||||
draw.RoundedBox(rnd, x*sw, y*sh, w*sw, h*sh, Color(0, 0, 0, col.a))
|
||||
if (statVal > 0 ) then
|
||||
draw.RoundedBox(rnd, x*sw, y*sh, (w*sw)*(0.01*statVal), h*sh, col)
|
||||
end
|
||||
draw.SimpleText(string.format("%s: %d", statName, statVal), "StatFont", (x+(w/2))*sw, (y+(h/2))*sh, Color(255,255,255,a), 1, 1)
|
||||
end
|
||||
|
||||
function HVR.HUDPaintStats()
|
||||
-- Important local vars
|
||||
local boxWidth = 0.25
|
||||
local boxHeight = 0.04
|
||||
local boxYPos = 0.92
|
||||
local rnd = math.floor(0.005*sw)
|
||||
local ply = LocalPlayer()
|
||||
local alpha = 220
|
||||
|
||||
-- Stat/temporary testing variables
|
||||
local hp = ply:Health()
|
||||
local alpha = 220
|
||||
|
||||
-- Health
|
||||
drawStatBox(rnd, 0.0625, boxYPos, boxWidth, boxHeight, sw, sh, Color(150, 0, 0, alpha), "Health", hp)
|
||||
|
||||
if (RoundState > ROUND_PREP) then
|
||||
-- Twop
|
||||
local secondaryName = ""
|
||||
local secondaryCol = 0
|
||||
if (player_manager.GetPlayerClass(ply) == "player_hvr_robot") then
|
||||
secondaryName = "Energy"
|
||||
secondaryCol = Color(15, 167, 147, alpha)
|
||||
else
|
||||
secondaryName = "Hunger"
|
||||
secondaryCol = Color(121, 34, 11, alpha)
|
||||
end
|
||||
drawStatBox(rnd, 0.375, boxYPos, boxWidth, boxHeight, sw, sh, secondaryCol, secondaryName, ownSecondary)
|
||||
|
||||
-- Threep
|
||||
local tertiaryname = ""
|
||||
local tertiaryCol = 0
|
||||
if (player_manager.GetPlayerClass(ply) == "player_hvr_robot") then
|
||||
tertiaryName = "Oil"
|
||||
tertiaryCol = Color(162, 164, 12, alpha)
|
||||
else
|
||||
tertiaryName = "Energy"
|
||||
tertiaryCol = Color(53, 7, 137, alpha)
|
||||
end
|
||||
drawStatBox(rnd, 0.6875, boxYPos, boxWidth, boxHeight, sw, sh, tertiaryCol, tertiaryName, ownTertiary)
|
||||
end
|
||||
end
|
||||
|
||||
function HVR.HUDPaintPlayerClass()
|
||||
if (ownClass == 1) then
|
||||
draw.SimpleText("You are a robot", "HVR_SmallFont", 0.9*sw, 0.9*sh, Color(255,255,255,255), 1, 1)
|
||||
elseif (ownClass == 0) then
|
||||
draw.SimpleText("You are a human", "HVR_SmallFont", 0.9*sw, 0.9*sh, Color(255,255,255,255), 1, 1)
|
||||
end
|
||||
end
|
||||
|
||||
function HVR.HUDPaintRoundState()
|
||||
-- RoundTime
|
||||
draw.SimpleText(string.format("%d:%.2d", math.floor(RoundTime/60), RoundTime%60), "StatFont", (0.5*sw), fs, Color(255,255,255,255), 1, 1)
|
||||
|
||||
-- Round State
|
||||
if (RoundState == ROUND_PRE) then
|
||||
draw.SimpleText("The round will begin when there are more players", "HVR_SmallFont", 32, 32, Color(255,255,255,255), 0, 4)
|
||||
elseif (RoundState == ROUND_PREP) then
|
||||
draw.SimpleText("The round is beginning soon", "HVR_SmallFont", 32, 32, Color(255,255,255,255), 0, 4)
|
||||
elseif (RoundState == ROUND_CURRENT) then
|
||||
draw.SimpleText("The round has begun", "HVR_SmallFont", 32, 32, Color(255,255,255,255), 0, 4)
|
||||
elseif (RoundState == ROUND_POST) then
|
||||
draw.SimpleText("The round has finished and might begin again shortly", "HVR_SmallFont", 32, 32, Color(255,255,255,255), 0, 4)
|
||||
end
|
||||
end
|
||||
|
||||
function HVR.HUDPaint()
|
||||
-- A check to see if the hud should be drawn
|
||||
local shouldDraw = GetConVar("cl_drawhud")
|
||||
if (shouldDraw:GetInt() == 0 or !(LocalPlayer():Alive())) then return end
|
||||
|
||||
HVR.HUDPaintStats()
|
||||
HVR.HUDPaintPlayerClass()
|
||||
HVR.HUDPaintRoundState()
|
||||
end
|
||||
|
||||
hook.Add("HUDPaint", "HVR_HUDPaint", HVR.HUDPaint)
|
||||
|
||||
function HUDBlockElements(name)
|
||||
-- The gamemode calls this function to determine whether it will draw parts of the default HL2 UI
|
||||
local blockedElements = {CHudAmmo = true, CHudBattery = true, CHudHealth = true, CHudSecondaryAmmo = true}
|
||||
if (blockedElements[name]) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
hook.Add("HUDShouldDraw", "HUDBlockElements", HUDBlockElements)
|
|
@ -0,0 +1,119 @@
|
|||
HVR = {}
|
||||
include("player_classes/hvr_baseclass.lua")
|
||||
include("cl_hud.lua")
|
||||
include("shared.lua")
|
||||
include("cl_sound.lua")
|
||||
|
||||
tStatSounds = {
|
||||
["Hunger"] = {
|
||||
"npc/barnacle/barnacle_digesting1.wav",
|
||||
"npc/barnacle/barnacle_digesting2.wav"
|
||||
},
|
||||
["humanEnergy"] = {
|
||||
"ambient/voices/cough1.wav",
|
||||
"ambient/voices/cough2.wav",
|
||||
"ambient/voices/cough3.wav",
|
||||
"ambient/voices/cough4.wav"
|
||||
},
|
||||
["robotEnergy"] = "ambient/energy/electric_loop.wav",
|
||||
["Oil"] = "doors/gate_move1.wav"
|
||||
}
|
||||
|
||||
ownSecondary = 0
|
||||
ownTertiary = 0
|
||||
ownClass = -1
|
||||
|
||||
RoundState = 0
|
||||
RoundTime = 0
|
||||
RoundsLeft = 0
|
||||
|
||||
function HVR.StatDamageNoise()
|
||||
if (ownSecondary == 0) then
|
||||
print("Will call PlaySoundStat(2)")
|
||||
HVR.PlayStatSound(2)
|
||||
end
|
||||
if (ownTertiary == 0) then
|
||||
print("Will call PlaySoundStat(3)")
|
||||
HVR.PlayStatSound(3)
|
||||
end
|
||||
end
|
||||
|
||||
net.Receive("ply_stats",
|
||||
function(length, ply)
|
||||
ownSecondary = net.ReadDouble()
|
||||
ownTertiary = net.ReadDouble()
|
||||
if ((ownSecondary == 0) or (ownTertiary == 0)) then
|
||||
print("Will call StatDamageNoise()")
|
||||
HVR.StatDamageNoise()
|
||||
else
|
||||
timer.Stop("statdamage_noise")
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
net.Receive("ply_class",
|
||||
function(ln, ply)
|
||||
ownClass = net.ReadInt(2)
|
||||
end
|
||||
)
|
||||
|
||||
net.Receive("rnd_status",
|
||||
function(ln, ply)
|
||||
RoundState = net.ReadUInt(2)
|
||||
RoundTime = net.ReadUInt(14)
|
||||
RoundsLeft = net.WriteUInt(8)
|
||||
end
|
||||
)
|
||||
|
||||
net.Receive("team_win",
|
||||
function(ln, ply)
|
||||
wonTeam = net.ReadString()
|
||||
hook.Add("HUDPaint", "HUDPaint_TeamWin",
|
||||
function()
|
||||
if (wonTeam == "Humans" or wonTeam == "Robots") then
|
||||
draw.SimpleText("The " .. wonTeam .. " have won the round!", "StatFont", ScrW()/2, ScrH()/2, Color(255,255,255,255), 1, 1)
|
||||
else
|
||||
draw.SimpleText(wonTeam .. " has won the round ", "StatFont", ScrW()/2, ScrH()/2, Color(255,255,255,255), 1, 1)
|
||||
end
|
||||
end
|
||||
)
|
||||
ownClass = -1
|
||||
timer.Simple(5, function() hook.Remove("HUDPaint", "HUDPaint_TeamWin") end)
|
||||
end
|
||||
)
|
||||
|
||||
net.Receive("end_game",
|
||||
function(ln, ply)
|
||||
local HumanWins = net.ReadUInt(8)
|
||||
local RobotWins = net.ReadUInt(8)
|
||||
local WonTeam = ""
|
||||
local HumanPlural = ""
|
||||
local RobotPlural = ""
|
||||
|
||||
if (HumanWins > RobotWins) then
|
||||
WonTeam = "the Humans"
|
||||
elseif (RobotWins > HumanWins) then
|
||||
WonTeam = "the Robots"
|
||||
else
|
||||
WonTeam = "Nobody"
|
||||
end
|
||||
|
||||
if (HumanWins > 1) then HumanPlural = "s" end
|
||||
if (RobotWins > 1) then RobotPlural = "s" end
|
||||
|
||||
local EndFrame
|
||||
EndFrame = vgui.Create("DFrame")
|
||||
EndFrame:SetSize(ScrW() * 0.7 , ScrH() * 0.7)
|
||||
EndFrame:Center()
|
||||
EndFrame:SetDraggable(false)
|
||||
EndFrame:SetSizable(false)
|
||||
EndFrame:SetTitle("HVR: End of Map")
|
||||
|
||||
EndText = vgui.Create("RichText", EndFrame)
|
||||
EndText:Dock(FILL)
|
||||
EndText:SetText(string.format("In this match of Humans versus Robots, the Humans won %d round%s, while the Robots won %d round%s. Overall, %s won the game.",
|
||||
HumanWins, HumanPlural, RobotWins, RobotPlural, WonTeam))
|
||||
|
||||
EndFrame:MakePopup()
|
||||
end
|
||||
)
|
|
@ -0,0 +1,36 @@
|
|||
HVR.Sound = {}
|
||||
|
||||
function HVR.Sound.HumanSecondaryDamageNoise()
|
||||
surface.PlaySound(tStatSounds["Hunger"][math.random(1,2)])
|
||||
end
|
||||
|
||||
function HVR.Sound.HumanTertiaryDamageNoise()
|
||||
surface.PlaySound(tStatSounds["humanEnergy"][math.random(1,4)])
|
||||
end
|
||||
|
||||
function HVR.Sound.RobotSecondaryDamageNoise()
|
||||
surface.PlaySound(tStatSounds["robotEnergy"])
|
||||
end
|
||||
|
||||
function HVR.Sound.RobotTertiaryDamageNoise()
|
||||
surface.PlaySound(tStatSounds["Oil"])
|
||||
end
|
||||
|
||||
function HVR.PlayStatSound(stat)
|
||||
print("PlayStatSound called. ownClass = " .. ownClass)
|
||||
--Human
|
||||
if (ownClass == 0) then
|
||||
if (stat == 2) then
|
||||
HVR.Sound.HumanSecondaryDamageNoise()
|
||||
elseif (stat == 3) then
|
||||
HVR.Sound.HumanTertiaryDamageNoise()
|
||||
end
|
||||
--Robot
|
||||
elseif (ownClass == 1) then
|
||||
if (stat == 2) then
|
||||
HVR.Sound.RobotSecondaryDamageNoise()
|
||||
elseif (stat == 3) then
|
||||
HVR.Sound.RobotTertiaryDamageNoise()
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,25 @@
|
|||
function HVR.PrintGameStatus()
|
||||
local rstate = ""
|
||||
if (RoundState == ROUND_PRE) then rstate = "Pre-round" end
|
||||
if (RoundState == ROUND_PREP) then rstate = "Preparation" end
|
||||
if (RoundState == ROUND_CURRENT) then rstate = "In progress" end
|
||||
if (RoundState == ROUND_POST) then rstate = "Post-round" end
|
||||
print(string.format("Round state: %s Time left: %d:%.2d", rstate, math.floor(RoundTime/60), RoundTime%60))
|
||||
-- The sum of RoundsLeft and RoundsPlayed is the total number of rounds
|
||||
print(string.format("Currently on round: %d/%d", RoundsPlayed+1, RoundsLeft+RoundsPlayed))
|
||||
print(string.format("Team wins (H|R): %d|%d (ratio: %.2f)", HumanWins, RobotWins, HumanWins/RobotWins))
|
||||
|
||||
for id, ply in pairs(player.GetAll()) do
|
||||
local living
|
||||
if (ply:Alive()) then living = "Alive" else living = "Dead" end
|
||||
print(ply, player_manager.GetPlayerClass(ply), living)
|
||||
end
|
||||
end
|
||||
|
||||
concommand.Add("hvr_status", HVR.PrintGameStatus, nil, "Prints the important variables that control the round state as well as a list of connected players and their player classes", 0)
|
||||
|
||||
function HVR.ForceEndRound(ply, cmd, tArgs, sArgs)
|
||||
if (RoundState == ROUND_CURRENT) then HVR.TeamWin(tArgs[1]) end
|
||||
end
|
||||
|
||||
concommand.Add("hvr_endround", HVR.ForceEndRound, nil, "Forcibly ends the round by making its argument win", 0)
|
|
@ -0,0 +1,202 @@
|
|||
HVR = {}
|
||||
util.AddNetworkString("ply_stats")
|
||||
util.AddNetworkString("ply_class")
|
||||
util.AddNetworkString("rnd_status")
|
||||
util.AddNetworkString("team_win")
|
||||
util.AddNetworkString("end_game")
|
||||
AddCSLuaFile("shared.lua")
|
||||
AddCSLuaFile("cl_init.lua")
|
||||
AddCSLuaFile("cl_hud.lua")
|
||||
AddCSLuaFile("cl_sound.lua")
|
||||
include("shared.lua")
|
||||
include("player.lua")
|
||||
include("concommands.lua")
|
||||
include("player_classes/hvr_baseclass.lua")
|
||||
include("player_classes/hvr_human.lua")
|
||||
include("player_classes/hvr_robot.lua")
|
||||
|
||||
-- Config globals (config NYI)
|
||||
robot_human_ratio = 0.5
|
||||
min_players = 2
|
||||
prep_time = 10
|
||||
rndtime = 300
|
||||
|
||||
-- Globals that change
|
||||
RoundState = ROUND_PRE
|
||||
RoundTime = 0
|
||||
RoundsLeft = 5
|
||||
RoundsPlayed = 0
|
||||
HumanWins = 0
|
||||
RobotWins = 0
|
||||
|
||||
function HVR.BeginRoundPrep()
|
||||
RoundState = ROUND_PREP
|
||||
RoundTime = prep_time
|
||||
timer.Create("round_prep", 10, 1, HVR.BeginRound)
|
||||
end
|
||||
|
||||
function HVR.BeginRound()
|
||||
RoundState = ROUND_CURRENT
|
||||
RoundTime = rndtime
|
||||
HVR.ChoosePlayerRoles()
|
||||
timer.Create("stats_attrition", 1, 0, HVR.StatsAttrition)
|
||||
|
||||
for id, ply in pairs(player.GetAll()) do
|
||||
player_manager.RunClass(ply, "Loadout")
|
||||
end
|
||||
end
|
||||
|
||||
function HVR.EndGame()
|
||||
net.Start("end_game")
|
||||
net.WriteUInt(HumanWins, 8)
|
||||
net.WriteUInt(RobotWins, 8)
|
||||
net.Broadcast()
|
||||
|
||||
RoundTime = 20
|
||||
timer.Simple(20, game.LoadNextMap)
|
||||
end
|
||||
|
||||
function HVR.CheckForConnectedPlayers(source)
|
||||
local source = source or nil
|
||||
local modifier = 0
|
||||
if (source == "PlayerConnect") then modifier = 1 end
|
||||
if (source == "PlayerDisconnected") then modifier = -1 end
|
||||
if ((#player.GetAll()+modifier) >= min_players) then
|
||||
if (RoundState == ROUND_PRE) then
|
||||
HVR.BeginRoundPrep()
|
||||
end
|
||||
else
|
||||
if (RoundState == ROUND_CURRENT) then
|
||||
HVR.TeamWin("Nobody")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function HVR.CheckForLiving()
|
||||
local humans = 0
|
||||
local robots = 0
|
||||
for id, ply in pairs(player.GetAll()) do
|
||||
if (ply:Alive()) then
|
||||
if (player_manager.GetPlayerClass(ply) == "player_hvr_human") then
|
||||
humans = humans + 1
|
||||
elseif (player_manager.GetPlayerClass(ply) == "player_hvr_robot") then
|
||||
robots = robots + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (humans == 0) then
|
||||
HVR.TeamWin("Robots")
|
||||
elseif (robots == 0) then
|
||||
HVR.TeamWin("Humans")
|
||||
end
|
||||
|
||||
return humans, robots
|
||||
end
|
||||
|
||||
hook.Add("PostPlayerDeath", "PlayerDeath_CheckForLiving", HVR.CheckForLiving)
|
||||
|
||||
function HVR.TeamWin(team)
|
||||
RoundState = ROUND_POST
|
||||
RoundTime = 10
|
||||
if (team == "Robots") then RobotWins = RobotWins + 1 end
|
||||
if (team == "Humans") then HumanWins = HumanWins + 1 end
|
||||
RoundsPlayed = RoundsPlayed + 1
|
||||
net.Start("team_win")
|
||||
net.WriteString(team)
|
||||
net.Broadcast()
|
||||
HVR.PostRound()
|
||||
end
|
||||
|
||||
function HVR.PreRound()
|
||||
RoundState = ROUND_PRE
|
||||
HVR.CheckForConnectedPlayers()
|
||||
|
||||
for id, ply in pairs(player.GetAll()) do
|
||||
ply:Spawn()
|
||||
end
|
||||
end
|
||||
|
||||
function HVR.PostRound()
|
||||
timer.Stop("stats_attrition")
|
||||
for id, ply in pairs(player.GetAll()) do
|
||||
ply.secondary = 100
|
||||
ply.tertiary = 100
|
||||
ply:UpdateStats()
|
||||
ply:StripAmmo()
|
||||
ply:StripWeapons()
|
||||
end
|
||||
|
||||
RoundsLeft = RoundsLeft - 1
|
||||
|
||||
if (RoundsLeft < 1) then
|
||||
HVR.EndGame()
|
||||
return
|
||||
end
|
||||
timer.Simple(10, HVR.PreRound)
|
||||
end
|
||||
|
||||
|
||||
function HVR.StatsAttrition()
|
||||
for id, ply in pairs(player.GetAll()) do
|
||||
ply.secondary = math.max(ply.secondary - 0.8, 0)
|
||||
ply.tertiary = math.max(ply.tertiary - 0.45, 0)
|
||||
ply:UpdateStats()
|
||||
if (ply.secondary == 0) then ply:TakeDamage(10) end
|
||||
if (ply.tertiary == 0) then ply:TakeDamage(5) end
|
||||
end
|
||||
end
|
||||
|
||||
function HVR.RoundStatusUpdate()
|
||||
RoundTime = math.max(RoundTime - 1, 0)
|
||||
if (RoundTime == 0 and RoundState == ROUND_CURRENT) then
|
||||
local h
|
||||
local r
|
||||
h,r = HVR.CheckForLiving()
|
||||
if (h == r) then HVR.TeamWin("Nobody") end
|
||||
end
|
||||
net.Start("rnd_status")
|
||||
net.WriteUInt(RoundState, 2)
|
||||
net.WriteUInt(RoundTime, 14)
|
||||
net.WriteUInt(RoundsLeft, 8)
|
||||
net.Send(player.GetAll())
|
||||
end
|
||||
|
||||
timer.Create("rnd_status_update", 1, 0, HVR.RoundStatusUpdate)
|
||||
|
||||
function HVR.ChoosePlayerRoles()
|
||||
local robot_quota = math.floor(#player.GetAll() * robot_human_ratio)
|
||||
local player_class
|
||||
local tblPlys = {}
|
||||
|
||||
for id, ply in pairs(player.GetAll()) do table.insert(tblPlys, ply) end
|
||||
|
||||
while (tblPlys) do
|
||||
index = math.random(1, #tblPlys)
|
||||
local ply = tblPlys[index]
|
||||
|
||||
local num_humans, num_robots = 0, 0
|
||||
for id, ply in pairs(player.GetAll()) do
|
||||
if (player_manager.GetPlayerClass(ply) == "player_hvr_human") then
|
||||
num_humans = num_humans + 1
|
||||
elseif (player_manager.GetPlayerClass(ply) == "player_hvr_robot") then
|
||||
num_robots = num_robots + 1
|
||||
end
|
||||
end
|
||||
|
||||
if (num_robots >= robot_quota) then
|
||||
player_class = 0
|
||||
player_manager.SetPlayerClass(ply, "player_hvr_human")
|
||||
else
|
||||
player_class = 1
|
||||
player_manager.SetPlayerClass(ply, "player_hvr_robot")
|
||||
end
|
||||
|
||||
net.Start("ply_class")
|
||||
net.WriteInt(player_class, 2)
|
||||
net.Send(ply)
|
||||
|
||||
table.remove(tblPlys, index)
|
||||
if (tblPlys[1] == nil) then tblPlys = nil end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,45 @@
|
|||
local PlyMeta = FindMetaTable("Player")
|
||||
|
||||
function GM:PlayerConnect(name, address)
|
||||
HVR.CheckForConnectedPlayers("PlayerConnect")
|
||||
end
|
||||
|
||||
function GM:PlayerDisconnected(ply)
|
||||
HVR.CheckForConnectedPlayers("PlayerDisconnected")
|
||||
end
|
||||
|
||||
function PlyMeta:UpdateStats()
|
||||
net.Start("ply_stats")
|
||||
net.WriteDouble(self.secondary)
|
||||
net.WriteDouble(self.tertiary)
|
||||
net.Send(self)
|
||||
end
|
||||
|
||||
function GM:PlayerSpawn(pl)
|
||||
pl.secondary = 100
|
||||
pl.tertiary = 100
|
||||
|
||||
if (RoundState ~= ROUND_CURRENT) then
|
||||
player_manager.SetPlayerClass(pl, "player_hvr_baseclass")
|
||||
end
|
||||
|
||||
--[[--
|
||||
Previously this was used to call the Base Gamemode's PlayerSpawn(), but now the code has been merged
|
||||
so this function is just an override
|
||||
BEGIN self.BaseClass.PlayerSpawn(self, pl)
|
||||
--]]--
|
||||
pl:UnSpectate()
|
||||
player_manager.OnPlayerSpawn( pl )
|
||||
player_manager.RunClass( pl, "Spawn" )
|
||||
hook.Call( "PlayerLoadout", GAMEMODE, pl )
|
||||
hook.Call( "PlayerSetModel", GAMEMODE, pl )
|
||||
pl:SetupHands()
|
||||
-- END self.BaseClass.PlayerSpawn(self, pl)
|
||||
end
|
||||
|
||||
function GM:PlayerDeathThink(pl)
|
||||
-- This will allow respawns by the standard rules before the round starts
|
||||
if (Roundstate == 0) then
|
||||
self.BaseClass.PlayerDeathThink(pl)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,33 @@
|
|||
AddCSLuaFile()
|
||||
-- Necessary for inheritance
|
||||
DEFINE_BASECLASS("player_default")
|
||||
|
||||
local PLAYER = {}
|
||||
|
||||
PLAYER.DisplayName = "HvR Base Class"
|
||||
|
||||
|
||||
function PLAYER:Loadout()
|
||||
if (RoundState == ROUND_CURRENT) then
|
||||
self.Player:Give("weapon_rpg")
|
||||
self.Player:Give("weapon_fists")
|
||||
self.Player:Give("weapon_medkit")
|
||||
self.Player:GiveAmmo(10, "rpg", true)
|
||||
end
|
||||
end
|
||||
|
||||
function PLAYER:SetModel()
|
||||
if (tobool(math.random(0,1))) then
|
||||
-- Male
|
||||
self.Player:SetModel("models/player/group01/male_0" .. math.random(1,9) .. ".mdl")
|
||||
else
|
||||
-- Female
|
||||
self.Player:SetModel("models/player/group01/female_0" .. math.random(1,6) .. ".mdl")
|
||||
end
|
||||
end
|
||||
|
||||
function PLAYER:GetHandsModel()
|
||||
return player_manager.TranslatePlayerHands(player_manager.TranslateToPlayerModelName(self.Player:GetModel()))
|
||||
end
|
||||
|
||||
player_manager.RegisterClass("player_hvr_baseclass", PLAYER, "player_default")
|
|
@ -0,0 +1,7 @@
|
|||
DEFINE_BASECLASS("player_hvr_baseclass")
|
||||
|
||||
local PLAYER = {}
|
||||
PLAYER.SecondaryName = "Hunger"
|
||||
PLAYER.TertiaryName = "Energy"
|
||||
|
||||
player_manager.RegisterClass("player_hvr_human", PLAYER, "player_hvr_baseclass")
|
|
@ -0,0 +1,7 @@
|
|||
DEFINE_BASECLASS("player_hvr_baseclass")
|
||||
|
||||
local PLAYER = {}
|
||||
PLAYER.SecondaryName = "Energy"
|
||||
PLAYER.TertiaryName = "Oil"
|
||||
|
||||
player_manager.RegisterClass("player_hvr_robot", PLAYER, "player_hvr_baseclass")
|
|
@ -0,0 +1,10 @@
|
|||
GM.Name = "Humans versus Robots"
|
||||
GM.Author = "Montandalar"
|
||||
GM.Email = ""
|
||||
GM.Website = ""
|
||||
GM.TeamBased = false
|
||||
|
||||
ROUND_PRE = 0
|
||||
ROUND_PREP = 1
|
||||
ROUND_CURRENT = 2
|
||||
ROUND_POST = 3
|
|
@ -0,0 +1,11 @@
|
|||
"hvr"
|
||||
{
|
||||
"base" "base"
|
||||
"title" "Humans versus Robots"
|
||||
"maps" "^hvr_"
|
||||
"menusystem" "1"
|
||||
|
||||
"settings"
|
||||
{
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 302 B |
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
|
@ -0,0 +1,351 @@
|
|||
commit 60ac4b69d91c6836f333789434af30d46970e77f
|
||||
Merge: 349609f 6ff471c
|
||||
|
||||
Date: Wed Aug 5 22:34:11 2015 +1000
|
||||
|
||||
Merge https://github.com/Montandalar/hvr
|
||||
|
||||
commit 6ff471c8d3e2146a86d01b78f3f961c8f09a1214
|
||||
|
||||
Date: Wed Aug 5 22:18:26 2015 +1000
|
||||
|
||||
Initial commit - stub
|
||||
|
||||
commit 349609f7f531df4adf175b6dae9685d2a7869fe3
|
||||
|
||||
Date: Wed Aug 5 20:49:00 2015 +1000
|
||||
|
||||
Make hvr_status print RoundState information and update its help text
|
||||
|
||||
commit d7a5786c82cdebecb4420196fc17cdf8bd261515
|
||||
|
||||
Date: Wed Aug 5 20:15:13 2015 +1000
|
||||
|
||||
Move player_class selection from GM:PlayerSpawn to new function HVR.ChoosePlayerRoles to be called in HVR.BeginRound. HVR.ChoosePlayerRoles will also select all players' roles randomly
|
||||
|
||||
commit 197484c76cb88b8526627d77b963e0510a2ce589
|
||||
|
||||
Date: Wed Aug 5 19:43:30 2015 +1000
|
||||
|
||||
Update End of Map panel to use proper pluralisation
|
||||
|
||||
commit 0aa4616296cbbadb0a039a7786e72193c1b16eaf
|
||||
|
||||
Date: Wed Aug 5 17:59:26 2015 +1000
|
||||
|
||||
Rearrange the client HUD code into several functions in the HVR namespace
|
||||
|
||||
commit a688238f723ffad11346c15094eace01e0699b66
|
||||
|
||||
Date: Wed Aug 5 12:06:47 2015 +1000
|
||||
|
||||
Implement a system whereby the server will change levels after the config
|
||||
variable RoundsLeft reaches zero and have a report display clientside
|
||||
about which team won overall
|
||||
|
||||
commit e7865ff2406039c97f07878db2c89da056d264d1
|
||||
|
||||
Date: Tue Aug 4 13:07:12 2015 +1000
|
||||
|
||||
Update HVR.PostRound to strip weapons and ammo and call a new function HVR.PreRound to handle the pre-round tasks
|
||||
|
||||
commit b211d53b250319e3c89be6ea829ce6dda7e8156d
|
||||
|
||||
Date: Mon Aug 3 09:58:42 2015 +1000
|
||||
|
||||
Call PLAYER:Loadout in HVR.BeginRound and add check in PLAYER:Loadout to only run when RoundState == ROUND_CURRENT
|
||||
|
||||
commit aba863e611d88d3b9f3511480757f6692d71de6f
|
||||
|
||||
Date: Thu Jul 30 12:18:49 2015 +1000
|
||||
|
||||
Remove unused constants from human and robot player classes
|
||||
|
||||
commit e63304eee5c7db0b5c57d48f9cbbd0be5740aaa0
|
||||
|
||||
Date: Thu Jul 30 12:15:36 2015 +1000
|
||||
|
||||
Move player classes to be entirely serverside
|
||||
|
||||
commit 963fe3212fe606b9354ca6c4d8f05dd16306b9d7
|
||||
|
||||
Date: Thu Jul 30 12:02:19 2015 +1000
|
||||
|
||||
Move rnd_status_update timer to HVR.RoundStatusUpdate() and make it call CheckForLiving and use the result for stalemate conditions
|
||||
|
||||
commit ae39afe32e567304aebf85086d279a4c93b98991
|
||||
|
||||
Date: Wed Jul 29 17:07:09 2015 +1000
|
||||
|
||||
Move BeginRoundPrep timed function to HVR.BeginRound which uses rndtime as config variable to set timer
|
||||
|
||||
commit 6d41340d315d6f960b5a769657bb897a06e2d1cf
|
||||
|
||||
Date: Wed Jul 29 17:00:36 2015 +1000
|
||||
|
||||
Add a 10s delay for ROUND_PREP before ROUND_CURRENT, under prep_time to be configured later
|
||||
|
||||
commit 823b96627ec21ad7bf5b35f93e079e31932bcbfe
|
||||
|
||||
Date: Tue Jul 28 14:38:18 2015 +1000
|
||||
|
||||
Move HVR.CheckForLiving() to PostPlayerDeath hook so that players actually count as dead
|
||||
|
||||
commit c30cb7a1a0c2796dddadb7a4b6bebf26b9765b71
|
||||
|
||||
Date: Mon Jul 27 11:52:17 2015 +1000
|
||||
|
||||
Share ROUND_* enums with client and have them display in the HUD with text messages
|
||||
|
||||
commit 091ae7235597a883978361b35e57776aa845209a
|
||||
|
||||
Date: Thu Jul 23 12:25:38 2015 +1000
|
||||
|
||||
Replace magic numbers for RoundState with ROUND_* enumerations
|
||||
|
||||
commit 021ee3a7e5b6d2bcd00cb658f3761259f78499e4
|
||||
|
||||
Date: Thu Jul 23 12:23:25 2015 +1000
|
||||
|
||||
Add hvr_endround concommand to forcibly end the round
|
||||
|
||||
commit c67a66d2192b132d9fc8116be1fbedc1d356795f
|
||||
|
||||
Date: Wed Jul 22 17:25:53 2015 +1000
|
||||
|
||||
Make hvr_status print whether a player is alive
|
||||
|
||||
commit 6889a97fbac6df5bf38c628cb8cc308d7ae962b9
|
||||
|
||||
Date: Wed Jul 22 17:07:18 2015 +1000
|
||||
|
||||
Add CheckForConnectedPlayers in PostRound() timer
|
||||
|
||||
commit 86c4f4a3dd34c49ec0ccbdb76d341cc36bbfa277
|
||||
|
||||
Date: Wed Jul 22 16:35:22 2015 +1000
|
||||
|
||||
Respawn players after the end of the round
|
||||
|
||||
commit 4ec2656fd298628cad3c8463893240d931d67490
|
||||
|
||||
Date: Mon Jul 20 10:08:43 2015 +1000
|
||||
|
||||
Add hvr_status concommand to list players and their classes
|
||||
|
||||
commit 3686b67d8db9773981c0a4c66144e21d659d3277
|
||||
|
||||
Date: Thu Jul 16 14:40:11 2015 +1000
|
||||
|
||||
Add a new font 'HVR_SmallFont' and draw the RoundState in it
|
||||
|
||||
commit dbd0f38f4003fec36f0c5c680b8bd6bb213078cf
|
||||
|
||||
Date: Fri Jul 10 11:57:55 2015 +1000
|
||||
|
||||
Move player-related functions to player.lua instead of init.lua
|
||||
|
||||
commit 518b9b484cedc06009e9f234f0fea4a34e8d674e
|
||||
|
||||
Date: Thu Jul 9 16:07:30 2015 +1000
|
||||
|
||||
Add seperate check for living players and connected players
|
||||
|
||||
commit b55e335f4c5c883e8b15eda165af162cda9bd6d1
|
||||
|
||||
Date: Thu Jul 9 10:25:56 2015 +1000
|
||||
|
||||
Network full Round* information to client, and add networked function for when a team wins to display on client
|
||||
|
||||
commit 5a44a82b34afb20fefc11c1cf51346002074a027
|
||||
|
||||
Date: Thu Jul 9 09:01:42 2015 +1000
|
||||
|
||||
Make seconds in RoundTime display correctly with two digits at all times, and RoundTime not underflow
|
||||
|
||||
commit afb7fa1e20635b02a6ac3e772ed05d28a0bc2e30
|
||||
|
||||
Date: Thu Jul 9 08:50:30 2015 +1000
|
||||
|
||||
Transmit integer RoundTime from client to server and display in HUD
|
||||
|
||||
commit 941b732248a644042411292495a3ebb0cd256400
|
||||
|
||||
Date: Mon Jul 6 21:44:53 2015 +1000
|
||||
|
||||
Fixed hands appearing as the wrong skin tone. pl:SetupHands was using the old playermodel.
|
||||
|
||||
commit 4209f0f3db378ae69712fbc1be4eaff151a492b1
|
||||
|
||||
Date: Mon Jul 6 20:34:10 2015 +1000
|
||||
|
||||
First attempt at solving bug where hands appear as the wrong skin tone
|
||||
|
||||
commit d602f625e64d1ebe65fcbacf49d468ee843e8d63
|
||||
|
||||
Date: Mon Jul 6 18:12:27 2015 +1000
|
||||
|
||||
Remove useless code for PLAYER:SetModel()
|
||||
|
||||
commit dd496f01b0f00d6d2f181b45b4724ceca74a810a
|
||||
|
||||
Date: Mon Jul 6 17:26:44 2015 +1000
|
||||
|
||||
Forcefully choose hands model from the player model
|
||||
|
||||
commit 4457bc0570dd0011401a6c90e41af7208edcb005
|
||||
|
||||
Date: Mon Jul 6 16:34:49 2015 +1000
|
||||
|
||||
Merge base gamemode code for GM:PlayerSpawn()
|
||||
|
||||
commit f57dee25508933716093e63de426d23e88805c21
|
||||
|
||||
Date: Mon Jul 6 12:14:20 2015 +1000
|
||||
|
||||
Fix CheckForPlayers to correctly compensate for #players being out by one
|
||||
|
||||
commit 9d28f6702184dbd36ecf39606923e8f6513ad8d4
|
||||
|
||||
Date: Mon Jul 6 12:02:49 2015 +1000
|
||||
|
||||
Add checks for #players on connect and disconnect
|
||||
|
||||
commit 719ce667a11e4620bdc4a827b5fb5ea1fafe8c3e
|
||||
|
||||
Date: Mon Jul 6 10:43:19 2015 +1000
|
||||
|
||||
Add config and round state globals
|
||||
|
||||
commit 5194c70d356928642ef7abc6f8e5c5236953b503
|
||||
|
||||
Date: Mon Jul 6 10:16:29 2015 +1000
|
||||
|
||||
Specify gamemode information in shared.lua
|
||||
|
||||
commit 7eaae52742d9e783dabe8caf6aa8dd4c822144ca
|
||||
|
||||
Date: Tue Jun 16 21:02:13 2015 +1000
|
||||
|
||||
Spawn with a random playermodel from Half-Life 2
|
||||
|
||||
commit 4342fa0dd75e7c62fc432e81dd58c67c8f44ecf0
|
||||
|
||||
Date: Mon Jun 15 17:42:52 2015 +1000
|
||||
|
||||
Modify spawning to make it fit a ratio
|
||||
|
||||
commit efd801d37351652714cae528cbeefc3133e815c3
|
||||
|
||||
Date: Mon Jun 15 17:18:40 2015 +1000
|
||||
|
||||
Make HUD not draw when LocalPlayer is dead
|
||||
|
||||
commit b9b86cd110d8ca304b6635ab392c81477e02f045
|
||||
|
||||
Date: Sun Jun 14 16:33:17 2015 +1000
|
||||
|
||||
Make HUD not draw stat colour when stat = 0
|
||||
|
||||
commit ec4835b98007f93ae1ed1721e662a0bc05cbee98
|
||||
|
||||
Date: Sun Jun 14 16:15:13 2015 +1000
|
||||
|
||||
Make stats drain over time
|
||||
|
||||
commit 2d148db1b84b918c3c08862abcbcbaa6ab30c7e2
|
||||
|
||||
Date: Sun Jun 14 15:26:33 2015 +1000
|
||||
|
||||
Moved stat updates to the Player metatable
|
||||
|
||||
commit 60e2a77cd89eb69eec6a191eedcb759801e9f8d1
|
||||
|
||||
Date: Sun Jun 14 14:26:54 2015 +1000
|
||||
|
||||
Display stats appropriate to player class by colour and string
|
||||
|
||||
commit 2be4f6f7dcb317916b9912af347953b8f548d6c0
|
||||
|
||||
Date: Thu Jun 11 21:53:23 2015 +1000
|
||||
|
||||
Send clients their class and have it display in their HUD
|
||||
|
||||
commit aa391383abd4b38a5a6d5676af8235dfb317e9f1
|
||||
|
||||
Date: Thu Jun 4 12:23:22 2015 +1000
|
||||
|
||||
Add random spawning as human or robot for testing
|
||||
|
||||
commit 6abc3543f81167528ae693c79ce4c4adb00554dd
|
||||
|
||||
Date: Sat May 30 22:25:17 2015 +1000
|
||||
|
||||
Fix baseclass issues for player classes
|
||||
|
||||
commit b56d59cd868190e134957567d37afe5803fd8ce8
|
||||
|
||||
Date: Sat May 30 21:15:57 2015 +1000
|
||||
|
||||
Add human and robot player classes
|
||||
|
||||
commit 9caeb4c6113c5542068dab7e07a8c22119f024a1
|
||||
|
||||
Date: Sat May 30 19:18:42 2015 +1000
|
||||
|
||||
Implement player_hvr_baseclass player class in hvr_baseclass.lua and make
|
||||
it the default class
|
||||
|
||||
commit c1117e58c4fba19ece3100dd1a53aca4d0e8164e
|
||||
|
||||
Date: Thu Jun 11 12:42:27 2015 +1000
|
||||
|
||||
Update random stats for all players
|
||||
|
||||
commit 089dc5e4da71ad139b8d9a05a96ed5831c355aca
|
||||
|
||||
Date: Wed Jun 10 22:23:44 2015 +1000
|
||||
|
||||
Have server send random stats to client and display them in HUD
|
||||
|
||||
commit ee7f001fd48521892eeb21c99e2738bebbf0e488
|
||||
|
||||
Date: Wed Jun 10 22:15:50 2015 +1000
|
||||
|
||||
Convert cl_hud.lua to tabs not spaces
|
||||
|
||||
commit 2c3d01b83678d58bd0fb192576c33b6ef385d119
|
||||
|
||||
Date: Wed Jun 10 21:31:21 2015 +1000
|
||||
|
||||
Add base_gmodentity to stop client addons complaining
|
||||
|
||||
commit 9356d4a15538de152825a9cb10a18f659fc48607
|
||||
|
||||
Date: Tue Jun 9 13:36:14 2015 +1000
|
||||
|
||||
Add missing curly bracket at end of hvr.txt
|
||||
|
||||
commit 86bb7a2d225d73dc379fb8f8c71bea11ae911287
|
||||
|
||||
Date: Wed May 20 17:24:40 2015 +1000
|
||||
|
||||
Fix HUD code and reduce boilerplate
|
||||
|
||||
commit 0ef2a51d6f72d299bfd6848450c6f5271b79cb9b
|
||||
|
||||
Date: Mon May 18 11:44:34 2015 +1000
|
||||
|
||||
Commit non-code files to the repository
|
||||
|
||||
commit 1def029371bd759c74f796684b22fc4860ba9786
|
||||
|
||||
Date: Mon May 18 11:23:49 2015 +1000
|
||||
|
||||
Merge HUD experiment code
|
||||
|
||||
commit c5f5c650ce28f4d956277f656df638f03f93276c
|
||||
|
||||
Date: Fri May 8 14:35:39 2015 +1000
|
||||
|
||||
Add a hello world message to the client
|
Loading…
Reference in New Issue