Files
Gmod-PropHuntExtended/source/gamemodes/prophuntextended/gamemode/sh_init.lua
T

146 lines
4.7 KiB
Lua
Raw Normal View History

2016-06-14 07:28:36 +02:00
--[[
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.
--]]
-- ------------------------------------------------------------------------- --
--! Gamemode Information
-- ------------------------------------------------------------------------- --
GM.Name = "Prop Hunt Extended"
2017-11-24 01:05:18 +01:00
GM.Author = "Michael Fabian 'Xaymar' Dirks"
GM.Email = "info@xaymar.com"
2016-06-14 07:28:36 +02:00
GM.Website = "http://xaymar.com/"
GM.TeamBased = true
GM.AllowAutoTeam = true
GM.SecondsBetweenTeamSwitches = 10
-- ------------------------------------------------------------------------- --
--! Code
-- ------------------------------------------------------------------------- --
-- Game States
GM.States = {}
GM.States.PreMatch = 0
GM.States.PreRound = 1
GM.States.Hide = 2
GM.States.Seek = 3
GM.States.PostRound = 4
GM.States.PostMatch = 5
-- Game Modes
2017-11-19 21:12:58 +01:00
GM.Types = {}
GM.Types.Original = 0
GM.Types.TheDeadHunt = 1 -- One Hunter, Dead Prop become Hunter, Props can't see each other.
2016-06-14 07:28:36 +02:00
-- Teams
GM.Teams = {}
GM.Teams.Spectators = 0
GM.Teams.Seekers = 1
GM.Teams.Hiders = 2
function GM:CreateTeams()
-- Specators
team.SetUp(self.Teams.Spectators, "Spectators", Color(127, 127, 127, 255))
team.SetSpawnPoint(self.Teams.Spectators, {
"info_player_deathmatch",
"info_player_combine",
"info_player_counterterrorist",
"info_player_allies",
2017-11-19 21:12:58 +01:00
"info_player_terrorist",
"info_player_start"
2016-06-14 07:28:36 +02:00
})
team.SetClass(self.Teams.Spectators, { "Spectator", "Spectator" })
-- Seekers: "Hunters"
team.SetUp(self.Teams.Seekers, "Seekers", Color(0, 128, 255, 255))
team.SetSpawnPoint(self.Teams.Seekers, {
2017-11-19 21:12:58 +01:00
"info_player_start",
2016-06-14 07:28:36 +02:00
"info_player_spawn",
"info_player_deathmatch",
"info_player_combine",
"info_player_counterterrorist"
})
team.SetClass(self.Teams.Seekers, { "Seeker", "Spectator" })
-- Hiders: "Props"
team.SetUp(self.Teams.Hiders, "Hiders", Color(255, 128, 0, 255))
team.SetSpawnPoint(self.Teams.Hiders, {
2017-11-19 21:12:58 +01:00
"info_player_start",
2016-06-14 07:28:36 +02:00
"info_player_spawn",
"info_player_deathmatch",
"info_player_allies",
"info_player_terrorist"
})
team.SetClass(self.Teams.Hiders, { "Hider", "Spectator" })
end
-- ------------------------------------------------------------------------- --
--! Player Manager Binding
-- ------------------------------------------------------------------------- --
function GM:PlayerPostThink(ply)
return player_manager.RunClass(ply, "PostThink")
end
function GM:PlayerTick(ply, mv)
return player_manager.RunClass(ply, "Tick", mv)
end
function GM:PlayerHurt(victim, attacker, healthRemaining, damageTaken)
2017-11-19 21:12:58 +01:00
player_manager.RunClass(victim, "Hurt", victim, attacker, healthRemaining, damageTaken)
if (IsValid(attacker) && attacker:IsPlayer()) then
2016-06-14 07:28:36 +02:00
player_manager.RunClass(attacker, "Damage", victim, attacker, healthRemaining, damageTaken)
end
end
2017-11-19 21:12:58 +01:00
function GM:PlayerShouldTakeDamage(victim, attacker)
return player_manager.RunClass(victim, "ShouldTakeDamage", attacker)
end
2016-06-14 07:28:36 +02:00
-- ------------------------------------------------------------------------- --
--! Gamemode Functionality
-- ------------------------------------------------------------------------- --
2017-11-19 21:12:58 +01:00
function GM:GetRound()
return GetGlobalInt("Round", 0)
end
2016-06-14 07:28:36 +02:00
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)
2017-11-19 21:12:58 +01:00
end
-- ------------------------------------------------------------------------- --
--! Includes
-- ------------------------------------------------------------------------- --
include "sh_config.lua"
-- Player Classes
include "player_class/class_default.lua"
include "player_class/class_spectator.lua"
include "player_class/class_seeker.lua"
include "player_class/class_hider.lua"