Skip to content

Commit

Permalink
Stable Public Release - v1.0.1
Browse files Browse the repository at this point in the history
- Added the noicon.png fallback if nobody has it.
- Added the "Recent Maps" feature, handles by the current gamemode
added.
- Added the "Updater" feature, it nags you if the version you have is
outdated.
- Added the "Duplicate Map and Map not installed" safety check.
- Added the "Map Library" feature, now worth doing better names.
(maplibrary.lua)
- Fixed issue where using the web console or srcds console on glmvs
would error out.
- Fixed issue with map images not loading within the garrysmod/download
folder.
- Fixed issue where you could add the same map twice then it would
de-sync for the client.
- Text tickers if it overflows. Useful for very long names.
- Documented a bit the functions in the module. (Tell me if I missed
one)
- Votes are not mentioned unless the map has some vote in it.
- Current Votes and Locked Maps are now sent to the player when first
joining. Delta-wise.
- Redid some few modules/fixed some small bugs. Kind of recoded some
parts.
- Renamed sh_addmaps.lua to addmaps.lua, removed shared.lua while at it.
- Redefined the README.md
and some other changes that I forgot or lazy to type them.
  • Loading branch information
ptown2 committed Jul 9, 2013
1 parent 12913f4 commit 2d46613
Show file tree
Hide file tree
Showing 31 changed files with 861 additions and 265 deletions.
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,9 +575,9 @@ If the program does terminal interaction, make it output a short notice like thi
when it starts in an interactive mode:

<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
under certain conditions; type 'show c' for details.

The hypothetical commands 'show w' and 'show c' should show the appropriate parts of
the General Public License. Of course, your program's commands might be different;
Expand Down
43 changes: 36 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,43 @@
GLMVS (Globalized Map Voting System)
GLMVS
=========

A globalized map voting management add-on for multiple gamemodes. Modular-ly coded to ensure easy modding and contributions for everyone.
GLMVS stands for Globalized Map Voting System, a globalized map voting management add-on to support multiple gamemodes at once. Modular coded to ensure easy modding and contributions for everyone.

#### SUPPORTED GAMEMODES: ####
* [Zombie Survival](http://facepunch.com/showthread.php?t=1160198) by [JetBoom](http://steamcommunity.com/profiles/76561197966880749) - (Tested and Fully Working)
* [Zombie Escape](http://facepunch.com/showthread.php?t=1187359) by [Samuel Maddock](http://steamcommunity.com/profiles/76561197991989781) - (Untested)
* [The Stalker](http://www.facepunch.com/showthread.php?t=1218503) by [Twoski](http://steamcommunity.com/profiles/76561197994990341) - (Barely, requires a hook to work. Need to talk Twoski about it!)
* [Trouble in Terrorist Town](http://ttt.badking.net/) by [BadKingUrgrain](http://steamcommunity.com/profiles/76561197964193008) - (Untested)

### CONTRIBUTIONS/DEVELOPMENT:
There is no dev branch until this add-on is ensured to be in a working state. You could still help but with some module ideas and such.
#### UPCOMING GAMEMODE SUPPORTS: ####
* Extreme Football Throwdown - (Maybe, if the fretta map voting doesn't come up for that gamemode.)
* Ultimate Chimera Hunt - (Need to talk Schythed about it!)
and many more soon! (Have one? REQUEST IT!)

#### CONVARS: ####
* `glmvs_svotepower` `0 - INF (int)` The starting votepower for the players (Default is 2).
* `glmvs_mvotepower` `more than glmvs_svotepower - INF (int)` The maximum votepower for the players, prevents taking complete control of the votemap. This convar is supposed to be higher than the starting votepower. (Default is 100).
* `glmvs_maplockthreshold` `0 - 1 (float)` The percentage of maps required to be locked (Default is 0.7).
* `glmvs_votedelay` `0 - INF (int/float)` The wait-time in seconds for the next vote to be produced. Place 0 or -1 to disable (Default is 2).
* `glmvs_notifyupdates` `0 - 1 (bool int)` Toggles the update notification (To players, doesn't disable for server console. Default is 1).
* `glmvs_optoutlist` `0 - 1 (bool int)` Opt-outs the GLMVS Server Listing (Sends the server info to the list. Default is 0).

### NOTE:
This add-on is still in under-development, any changes are very crucial and demanding.
#### UPDATE NOTIFICATOR: ####
GLMVS will notify the players about a new update in roll (anyone who's mentioned in the NotifyUsergroups) periodically. It captures the versioning within this github page and compares it with the one you've installed. It would be perfect not to modify the GLMVS module due to that reason. If the update notificator is too annoying, then you can disable the notification for players via the convar `glmvs_notifyupdate 0`. REMEMBER, it only disables the notification for the players, not for the server!

It would be better not to run this on a server... for now.
#### SERVER LISTING: ####
GLMVS will update/list your server upon every map change (soon to be daily or so). You can opt-out via the convar `glmvs_optoutlist 1`, but leaving it opt-in would help me keep stats/control of my addon. However, GLMVS will NOT SEND crucial server information. It will only send the following information:
* GLMVS Version
* Enviroment Realm (IP, without port)
* Server's Current Gamemode
* Server's Name
* Is it Dedicated?
* Is it Passworded?

If it captures information beyond that point, please notify me (ptown2) so I can thoroughly investigate.

#### CONTRIBUTIONS/DEVELOPMENT: ####
A working dev branch will come out soon. Hold on until further updates. You can still contribute to the addon by helping on the github wiki for function documentation and such.

#### NOTICES: ####
This add-on is still in under-development, any changes are very crucial and demanding. Make sure to be updated at all costs!
28 changes: 28 additions & 0 deletions lua/addmaps.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* ----------------------------------------------------------------------------------------
GLMVS - Map Adding System
This file is to add the maps you're registering for the server,
it uses a super easy format for everyone to follow and contribute for
GLMVS. It is undesirable to add maps anyone will barely play on.
But you can add as many as you please (until lua hangs itself).
Format to add maps in the library:
GLMVS.AddMap( mapname, playerreq )
Example:
GLMVS.AddToLibrary( "zs_relic" )
GLMVS.AddToLibrary( "zs_asylum_v1", 8 )
NOTES:
The map MUST exist on the server, if not then it will be ignored.
Duplicates of same map are also ignored.
Non-GM related maps are also ignored.
Playerreq is the MINIMUM AMOUNT of players required to play on that map.
It is advised NOT TO DO THIS ON ALL MAPS!!!
---------------------------------------------------------------------------------------- */

-- Use this as example.
GLMVS.AddMap( "ze_minecraft_v1_1" )
GLMVS.AddMap( "zs_asylum_reborn_b2", 2 )
GLMVS.AddMap( "zs_canyon" )
106 changes: 65 additions & 41 deletions lua/autorun/autorun.lua
Original file line number Diff line number Diff line change
@@ -1,64 +1,88 @@
/* ----------------------------------------
Autorun that shit
---------------------------------------- */
if SERVER then
AddCSLuaFile()
AddCSLuaFile( )
AddCSLuaFile( "fileload.lua" )
AddCSLuaFile( "init.lua" )
--AddCSLuaFile( "shared.lua" )
AddCSLuaFile( "sh_addmaps.lua" )
AddCSLuaFile( "cl_init.lua" )
end

-- AddCSLuaFile'd all modules manually...
AddCSLuaFile( "modules/glmvs/shared.lua" )
AddCSLuaFile( "modules/glmvs/sh_convars.lua" )
AddCSLuaFile( "modules/glmvs/cl_init.lua" )
AddCSLuaFile( "modules/gdebug/shared.lua" )
AddCSLuaFile( "modules/skin/cl_zombiesurvival.lua" )
AddCSLuaFile( "modules/utils/cl_init.lua" )
include( "fileload.lua" )

AddCSLuaFile( "gamemodes/gm_zs.lua" )
AddCSLuaFile( "gamemodes/gm_ttt.lua" )
AddCSLuaFile( "gamemodes/gm_zescape.lua" )
AddCSLuaFile( "gamemodes/gm_stalker.lua" )
end

/* ----------------------------------------
AddCSLua all of the lua folders
---------------------------------------- */
if SERVER then
include( "fileload.lua" )
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "addmaps.lua" )
AddCSLuaFile( "maplibrary.lua" )

GLoader.RegisterCSFile( "modules" )
GLoader.RegisterCSFile( "gamemodes" )
GLoader.RegisterCSFile( "localization" )
end

-- Included all modules manually...

/* ----------------------------------------
Include all of the modules
---------------------------------------- */
if SERVER then
-- Included all SERVER/SHARED modules manually...
include( "modules/glmvs/shared.lua" )
include( "modules/glmvs/sh_convars.lua" )
include( "modules/glmvs/init.lua" )
include( "modules/glmvs/sv_load.lua" )
include( "modules/gdebug/init.lua" )
include( "modules/gfile/init.lua" )
include( "modules/gdebug/shared.lua" )
include( "modules/utils/init.lua" )

include( "gamemodes/gm_zs.lua" )
include( "gamemodes/gm_ttt.lua" )
include( "gamemodes/gm_zescape.lua" )
include( "gamemodes/gm_stalker.lua" )

--include( "shared.lua" )
include( "sh_addmaps.lua" )
include( "init.lua" )
include( "modules/cmds/init.lua" )
include( "modules/util/init.lua" )
end

if CLIENT then
include( "fileload.lua" )

-- Included all modules manually...
-- Included all CLIENT/SHARED modules manually...
include( "modules/glmvs/shared.lua" )
include( "modules/glmvs/sh_convars.lua" )
include( "modules/glmvs/cl_init.lua" )
include( "modules/glmvs/cl_network.lua" )
include( "modules/gdebug/shared.lua" )
include( "modules/draw/cl_init.lua" )
include( "modules/util/cl_init.lua" )
include( "modules/skin/cl_zombiesurvival.lua" )
include( "modules/utils/cl_init.lua" )
end


/* ----------------------------------------
Include Gamemode Settings
---------------------------------------- */
include( "gamemodes/gm_zs.lua" )
include( "gamemodes/gm_ttt.lua" )
include( "gamemodes/gm_zescape.lua" )
include( "gamemodes/gm_stalker.lua" )

include( "gamemodes/gm_zs.lua" )
include( "gamemodes/gm_ttt.lua" )
include( "gamemodes/gm_zescape.lua" )
include( "gamemodes/gm_stalker.lua" )

--include( "shared.lua" )
include( "sh_addmaps.lua" )
/* ----------------------------------------
Include Rest of the crap
---------------------------------------- */
if SERVER then
include( "maplibrary.lua" )
include( "addmaps.lua" )
include( "init.lua" )
end

if CLIENT then
include( "maplibrary.lua" )
include( "addmaps.lua" )
include( "cl_init.lua" )
end
end


/* ----------------------------------------
GDebug functions to run
---------------------------------------- */
hook.Add( "Initialize", "GLMVS_GDebugPrint", function()
if SERVER then
GDebug.PrintResults()
GDebug.CheckForUpdates()
GDebug.OptToListing()
end
end )
51 changes: 14 additions & 37 deletions lua/autorun/fileload.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
GAME, LANG = {}, {}

module( "GLoader", package.seeall )

local function GetFileList( strDirectory )
Expand Down Expand Up @@ -30,59 +28,38 @@ local function LoadFile( strDirectory, strFile )

if ( prefix == "sh_" || strFile == "shared.lua" ) then
MsgN( "SHARED Lua file: ", realFile, " loaded." )
if SERVER then AddCSLuaFile( realFile ) end
include( realFile )
elseif ( prefix == "cl_" || strFile == "cl_init.lua" ) then
MsgN( "CLIENT Lua file: ", realFile, " loaded." )
if SERVER then AddCSLuaFile( realFile ) else include( realFile ) end
if CLIENT then include( realFile ) end
elseif ( prefix == "sv_" || strFile == "init.lua" ) then
MsgN( "SERVER Lua file: ", realFile, " loaded." )
if SERVER then include( realFile ) end
elseif strDirectory == "gamemodes" then
MsgN( "GAMEMODE Lua file: ", realFile, " loaded." )
if SERVER then AddCSLuaFile( realFile ) end
include( realFile )
end
end

function RegisterLuaFolder( strDirectory )
local fileList = GetFileList( strDirectory )

for i, filen in pairs( fileList ) do
if ( IsLuaFile( filen ) ) then
LoadFile( strDirectory, filen )
end
function RegisterCSFile( strDirectory )
local filelist = GetFileList( strDirectory )

if ( IsDirectory( filen ) ) then
RegisterLuaFolder( strDirectory.. "/" ..filen )
end
end
end
for i, filen in pairs( filelist ) do
local prefix = string.sub( filen, 0, 3 )

function RegisterGamemodes( strDirectory )
local included = {}
local gamemodelist = GetFileList( strDirectory )

for i, filen in pairs(gamemodelist) do
if IsLuaFile( filen ) then
LoadFile( strDirectory, filen )

if ( GAME.Name && GAME.ID ) then
GLMVS.Gamemodes[ GAME.ID ] = GAME
GLMVS.Gamemodes[ GAME.Name ] = GAME
if ( IsLuaFile( filen ) ) then
if ( prefix == "cl_" || prefix == "sh_" || prefix == "gm_" ) || ( filen == "shared.lua" || filen == "cl_init.lua") then
AddCSLuaFile( strDirectory.. "/" ..filen )
end
included[filen] = GAME
GAME = nil
else
RegisterCSFile( strDirectory.. "/" ..filen )
end
end
end

function RegisterGamemode( tblGame )
GLMVS.Gamemodes[ tblGame.ID ] = tblGame
GLMVS.Gamemodes[ tblGame.Name ] = tblGame
end

function RegisterLanguages( strDirectory )
local included = {}
--local langlist = GetFileList( strDirectory )
if ( tblGame.ID && tblGame.Name ) then
GLMVS.Gamemodes[ tblGame.ID ] = tblGame
GLMVS.Gamemodes[ tblGame.Name ] = tblGame
end
end
25 changes: 16 additions & 9 deletions lua/cl_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
local VoteFrame = nil

local function CreateFonts()
surface.CreateFont( "VoteTitle", { font = "Bebas Neue", size = util.Sizeto720p( 54, ScrH() ), weight = 500 })
surface.CreateFont( "VoteCaption", { font = "Bebas Neue", size = util.Sizeto720p( 28, ScrH() ), weight = 500 })
surface.CreateFont( "VoteTitle", { font = "Bebas Neue", size = util.SizeTo720p( 54, ScrH() ), weight = 500 })
surface.CreateFont( "VoteCaption", { font = "Bebas Neue", size = util.SizeTo720p( 26, ScrH() ), weight = 500 })
end

function Derma_Votemap()
Expand All @@ -29,12 +29,13 @@ function Derma_Votemap()
CreateFonts()

local w, h = ScrW(), ScrH()
local imapsize, globalspacing = util.Sizeto720p( 150, h ), util.Sizeto720p( 8, h )
local imapsize, globalspacing = util.SizeTo720p( 150, h ), util.SizeTo720p( 8, h )
local numframesw, numframesh = util.LowestSizeMult( w, imapsize ), util.LowestSizeMult( h, imapsize )
local fontheight = util.SizeTo720p( 54, ScrH() )

VoteFrame = vgui.Create("DFrame")
VoteFrame:SetTitle( " " )
VoteFrame:SetSize( ( numframesw * globalspacing ) + ( numframesw * imapsize ) + 35, ( numframesh * globalspacing ) + ( numframesh * imapsize ) + ( draw.GetFontHeight( "VoteTitle" ) ) + 20 )
VoteFrame:SetSize( ( numframesw * globalspacing ) + ( numframesw * imapsize ) + 35, ( numframesh * globalspacing ) + ( numframesh * imapsize ) + fontheight + 20 )
VoteFrame:SetSkin( "zsvotemap" )
VoteFrame:Center()

Expand All @@ -47,24 +48,30 @@ function Derma_Votemap()
TitleLabel:AlignTop( 10 )

local ScrlFrame = vgui.Create( "DScrollPanel", VoteFrame )
ScrlFrame:SetSize( ( numframesw * globalspacing ) + ( numframesw * imapsize ) - globalspacing, ( numframesh * globalspacing ) + ( numframesh * imapsize ) - 3 )
ScrlFrame:SetSize( ( numframesw * globalspacing ) + ( numframesw * imapsize ) + 12, ( numframesh * globalspacing ) + ( numframesh * imapsize ) - 3 )
ScrlFrame:CenterHorizontal()
ScrlFrame:AlignBottom( 10 )
ScrlFrame:AlignBottom( 8 )

local ListFrame = vgui.Create( "DIconLayout", ScrlFrame )
ListFrame:SetSize( ScrlFrame:GetWide(), ScrlFrame:GetTall() )
ListFrame:SetSpaceX( globalspacing )
ListFrame:SetSpaceY( globalspacing )

for id, info in pairs( GLMVS.Maplist ) do
for mapid, info in pairs( GLMVS.Maplist ) do
info.NextVote = info.TotalVotes
info.Votes = 0

local ListItem = ListFrame:Add( "DButton" )
ListItem:SetSize( imapsize, imapsize )
ListItem:SetText( " " )
ListItem:SetTooltip( info.Description )
ListItem:SetDisabled( tobool( info.Locked ) )
ListItem.MapName = info.Name || info.Map
--ListItem.ID = id
ListItem.MapID = id
ListItem.Author = info.Author
ListItem.MapID = info.ID
ListItem.Image = util.IsValidImage( info.Map )
ListItem.Ticker = draw.NewTicker( 4, 2 )
ListItem.Think = GLMVS.GenericThink
ListItem.Paint = GLMVS.GenericImgButton
ListItem.DoClick = GLMVS.Votemap
end
Expand Down
Loading

0 comments on commit 2d46613

Please sign in to comment.