Skip to content

Commit

Permalink
Made player_manager.TranslateToPlayerModelName case insensitive.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo98 committed Jun 6, 2014
1 parent acb13c5 commit 92c5862
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions garrysmod/lua/includes/modules/player_manager.lua
Expand Up @@ -6,6 +6,7 @@ local ErrorNoHalt = ErrorNoHalt
local baseclass = baseclass
local setmetatable = setmetatable
local SERVER = SERVER
local string = string
local util = util

module( "player_manager" )
Expand All @@ -22,7 +23,7 @@ local HandNames = {}
function AddValidModel( name, model )
ModelList[ name ] = model
ModelListRev[ model ] = name
ModelListRev[ string.lower( model ) ] = name
end
Expand All @@ -44,25 +45,27 @@ end
--[[---------------------------------------------------------
Translate the simple name of a model
Translate the simple name of a model
into the full model name
-----------------------------------------------------------]]
function TranslatePlayerModel( name )
if ( ModelList[ name ] != nil ) then
return ModelList[ name ]
end
return "models/player/kleiner.mdl"
end
-- Translate from the full model name to simple model name
function TranslateToPlayerModelName( model )
model = string.lower( model )
if ( ModelListRev[ model ] != nil ) then
return ModelListRev[ model ]
end
return "kleiner"
end
Expand All @@ -74,7 +77,7 @@ function TranslatePlayerHands( name )
if ( HandNames[ name ] != nil ) then
return HandNames[ name ]
end
return { model = "models/weapons/c_arms_citizen.mdl", skin = 0, body = "100000000" }
end
Expand All @@ -85,7 +88,7 @@ end
AddValidModel( "alyx", "models/player/alyx.mdl" )
AddValidHands( "alyx", "models/weapons/c_arms_citizen.mdl", 0, "0000000" )
AddValidModel( "barney", "models/player/barney.mdl" )
AddValidModel( "barney", "models/player/barney.mdl" )
AddValidHands( "barney", "models/weapons/c_arms_combine.mdl", 0, "0000000" )
AddValidModel( "breen", "models/player/breen.mdl" )
Expand All @@ -99,20 +102,20 @@ AddValidHands( "chell", "models/weapons/c_arms_chell.mdl", 0, "0000000" )
AddValidModel( "corpse", "models/player/corpse1.mdl" )
AddValidHands( "corpse", "models/weapons/c_arms_citizen.mdl", 2, "0000000" )
AddValidModel( "combine", "models/player/combine_soldier.mdl" )
AddValidHands( "combine", "models/weapons/c_arms_combine.mdl", 0, "0000000" )
AddValidModel( "combineprison", "models/player/combine_soldier_prisonguard.mdl" )
AddValidHands( "combineprison", "models/weapons/c_arms_combine.mdl", 0, "0000000" )
AddValidModel( "combineelite", "models/player/combine_super_soldier.mdl" )
AddValidHands( "combineelite", "models/weapons/c_arms_combine.mdl", 0, "0000000" )
AddValidModel( "eli", "models/player/eli.mdl" )
AddValidHands( "eli", "models/weapons/c_arms_citizen.mdl", 1, "0000000" )
AddValidModel( "gman", "models/player/gman_high.mdl" )
AddValidModel( "gman", "models/player/gman_high.mdl" )
AddValidHands( "gman", "models/weapons/c_arms_citizen.mdl", 0, "0000000" )
AddValidModel( "kleiner", "models/player/kleiner.mdl" )
Expand Down Expand Up @@ -303,7 +306,7 @@ function RegisterClass( name, table, base )
Type[ name ] = table;
--
-- If we have a base method then hook
-- If we have a base method then hook
-- it up in the meta table
--
if ( base ) then
Expand Down Expand Up @@ -377,7 +380,7 @@ local function LookupPlayerClass( ply )
method.Player = ply
method.ClassID = id
method.Func = function() end
setmetatable( method, { __index = t } )
ply.m_CurrentPlayerClass = method
Expand Down Expand Up @@ -424,4 +427,4 @@ function OnPlayerSpawn( ply )
ply:SetNoCollideWithTeammates( class.TeammateNoCollide )
ply:SetAvoidPlayers( class.AvoidPlayers )
end
end

0 comments on commit 92c5862

Please sign in to comment.