Skip to content

Commit

Permalink
Prefix getters with "get"
Browse files Browse the repository at this point in the history
  • Loading branch information
Xandaros committed Mar 24, 2014
1 parent b94a320 commit ab35d3f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 46 deletions.
23 changes: 19 additions & 4 deletions lua/starfall/libs_sh/entities.lua
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ end
--- Returns the local position of the entity's mass center
-- @shared
-- @return The position vector of the mass center
function ents_methods:massCenter()
function ents_methods:getMassCenter ()
SF.CheckType(self,ents_metamethods)
local ent = unwrap(self)
local phys = getPhysObject(ent)
Expand All @@ -196,7 +196,7 @@ end
--- Returns the world position of the entity's mass center
-- @shared
-- @return The position vector of the mass center
function ents_methods:massCenterW()
function ents_methods:getMassCenterW ()
SF.CheckType(self,ents_metamethods)
local ent = unwrap(self)
local phys = getPhysObject(ent)
Expand Down Expand Up @@ -325,7 +325,7 @@ end
--- Gets the entitiy's eye angles
-- @shared
-- @return Angles of the entity's eyes
function ents_methods:eyeAngles()
function ents_methods:getEyeAngles ()
SF.CheckType(self,ents_metamethods)
local ent = unwrap(self)
if not isValid(ent) then return nil, "invalid entity" end
Expand All @@ -336,7 +336,7 @@ end
-- @shared
-- @return Eye position of the entity
-- @return In case of a ragdoll, the position of the other eye
function ents_methods:eyePos()
function ents_methods:getEyePos ()
SF.CheckType(self,ents_metamethods)
local ent = unwrap(self)
if not isValid(ent) then return nil, "invalid entity" end
Expand Down Expand Up @@ -399,3 +399,18 @@ function ents_methods:setSkin ( skinIndex )
ent:SetSkin( skinIndex )
return wrap( ent )
end

--- Gets the entities up vector
function ents_methods:getUp ()
return unwrap(self):GetUp ()
end

--- Gets the entities right vector
function ents_methods:getRight ()
return unwrap(self):GetRight ()
end

--- Gets the entities forward vector
function ents_methods:getForward ()
return unwrap(self):GetForward ()
end
40 changes: 20 additions & 20 deletions lua/starfall/libs_sh/players.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ end
--- Returns whether the player is alive
-- @shared
-- @return True if player alive
function player_methods:alive( )
function player_methods:getAlive ()
SF.CheckType( self, player_metamethods )
local ent = SF.Entities.Unwrap( self )
return ent and ent:Alive()
Expand All @@ -45,7 +45,7 @@ end
--- Returns the players armor
-- @shared
-- @return Armor
function player_methods:armor( )
function player_methods:getArmor ()
SF.CheckType( self, player_metamethods )
local ent = SF.Entities.Unwrap( self )
return ent and ent:Armor()
Expand All @@ -54,7 +54,7 @@ end
--- Returns whether the player is crouching
-- @shared
-- @return True if player crouching
function player_methods:crouching( )
function player_methods:isCrouching ()
SF.CheckType( self, player_metamethods )
local ent = SF.Entities.Unwrap( self )
return ent and ent:Crouching()
Expand All @@ -63,7 +63,7 @@ end
--- Returns the amount of deaths of the player
-- @shared
-- @return Amount of deaths
function player_methods:deaths( )
function player_methods:getDeaths ()
SF.CheckType( self, player_metamethods )
local ent = SF.Entities.Unwrap( self )
return ent and ent:Deaths()
Expand All @@ -81,7 +81,7 @@ end
--- Returns the amount of kills of the player
-- @shared
-- @return Amount of kills
function player_methods:frags( )
function player_methods:getFrags ()
SF.CheckType( self, player_metamethods )
local ent = SF.Entities.Unwrap( self )
return ent and ent:Frags()
Expand All @@ -90,7 +90,7 @@ end
--- Returns the name of the player's active weapon
-- @shared
-- @return Name of weapon
function player_methods:activeWeapon( )
function player_methods:getActiveWeapon ()
SF.CheckType( self, player_metamethods )
local ent = SF.Entities.Unwrap( self )
return ent and ent:GetActiveWeapon():ClassName()
Expand All @@ -99,7 +99,7 @@ end
--- Returns the player's aim vector
-- @shared
-- @return Aim vector
function player_methods:aimVector( )
function player_methods:getAimVector ()
SF.CheckType( self, player_metamethods )
local ent = SF.Entities.Unwrap( self )
return ent and ent:GetAimVector()
Expand All @@ -108,7 +108,7 @@ end
--- Returns the player's field of view
-- @shared
-- @return Field of view
function player_methods:fov()
function player_methods:getFOV ()
SF.CheckType( self, player_metamethods )
local ent = SF.Entities.Unwrap( self )
return ent and ent:GetFOV()
Expand All @@ -117,7 +117,7 @@ end
--- Returns the player's jump power
-- @shared
-- @return Jump power
function player_methods:jumpPower( )
function player_methods:getJumpPower ()
SF.CheckType( self, player_metamethods )
local ent = SF.Entities.Unwrap( self )
return ent and ent:GetJumpPower()
Expand All @@ -126,7 +126,7 @@ end
--- Returns the player's maximum speed
-- @shared
-- @return Maximum speed
function player_methods:maxSpeed( )
function player_methods:getMaxSpeed ()
SF.CheckType( self, player_metamethods )
local ent = SF.Entities.Unwrap( self )
return ent and ent:GetMaxSpeed()
Expand All @@ -135,7 +135,7 @@ end
--- Returns the player's name
-- @shared
-- @return Name
function player_methods:name( )
function player_methods:getName ()
SF.CheckType( self, player_metamethods )
local ent = SF.Entities.Unwrap( self )
return ent and ent:GetName()
Expand All @@ -144,7 +144,7 @@ end
--- Returns the player's running speed
-- @shared
-- @return Running speed
function player_methods:runSpeed( )
function player_methods:getRunSpeed ()
SF.CheckType( self, player_metamethods )
local ent = SF.Entities.Unwrap( self )
return ent and ent:GetRunSpeed()
Expand All @@ -153,7 +153,7 @@ end
--- Returns the player's shoot position
-- @shared
-- @return Shoot position
function player_methods:shootPos( )
function player_methods:getShootPos ()
SF.CheckType( self, player_metamethods )
local ent = SF.Entities.Unwrap( self )
return ent and ent:GetShootPos()
Expand Down Expand Up @@ -244,7 +244,7 @@ end
--- Returns the player's current ping
-- @shared
-- @return ping
function player_methods:ping()
function player_methods:getPing ()
SF.CheckType( self, player_metamethods )
local ent = SF.Entities.Unwrap( self )
return ent and ent:Ping()
Expand All @@ -253,7 +253,7 @@ end
--- Returns the player's steam ID
-- @shared
-- @return steam ID
function player_methods:steamID( )
function player_methods:getSteamID ()
SF.CheckType( self, player_metamethods )
local ent = SF.Entities.Unwrap( self )
return ent and ent:SteamID()
Expand All @@ -262,7 +262,7 @@ end
--- Returns the player's community ID
-- @shared
-- @return community ID
function player_methods:steamID64( )
function player_methods:getSteamID64 ()
SF.CheckType( self, player_metamethods )
local ent = SF.Entities.Unwrap( self )
return ent and ent:SteamID64( )
Expand All @@ -271,7 +271,7 @@ end
--- Returns the player's current team
-- @shared
-- @return team
function player_methods:team( )
function player_methods:getTeam ()
SF.CheckType( self, player_metamethods )
local ent = SF.Entities.Unwrap( self )
return ent and ent:Team()
Expand All @@ -280,7 +280,7 @@ end
--- Returns the name of the player's current team
-- @shared
-- @return team name
function player_methods:teamName( )
function player_methods:getTeamName ()
SF.CheckType( self, player_metamethods )
local ent = SF.Entities.Unwrap( self )
return ent and team.GetName(ent:Team())
Expand All @@ -289,7 +289,7 @@ end
--- Returns the player's unique ID
-- @shared
-- @return unique ID
function player_methods:uniqueID( )
function player_methods:getUniqueID ()
SF.CheckType( self, player_metamethods )
local ent = SF.Entities.Unwrap( self )
return ent and ent:UniqueID()
Expand All @@ -298,7 +298,7 @@ end
--- Returns the player's user ID
-- @shared
-- @return user ID
function player_methods:userID()
function player_methods:getUserID ()
SF.CheckType( self, player_metamethods )
local ent = SF.Entities.Unwrap( self )
return ent and ent:UserID()
Expand Down
14 changes: 7 additions & 7 deletions lua/starfall/libs_sh/serverinfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@ local serverinfo_library, _ = SF.Libraries.Register("serverinfo")

--- Returns a table containing physics environment settings. See GLua's physenv.GetPerformanceSettings()
-- for more info.
function serverinfo_library.performanceSettings()
function serverinfo_library.getPerformanceSettings ()
return table.Copy(physenv.GetPerformanceSettings())
end

--- Returns the server's acceleration due to gravity vector.
function serverinfo_library.gravity()
function serverinfo_library.getGravity ()
return physenv.GetGravity()
end

--- Returns the air density. See Glua's physenv.GetAirDensity()
function serverinfo_library.airDensity()
function serverinfo_library.getAirDensity ()
return physenv.GetAirDensity()
end

--- Returns the map name
function serverinfo_library.map()
function serverinfo_library.getMap ()
return game.GetMap()
end

--- Returns The hostname
function serverinfo_library.hostname()
function serverinfo_library.getHostname ()
return GetConVar("hostname"):GetString()
end

Expand All @@ -35,12 +35,12 @@ function serverinfo_library.isLan()
end

--- Returns the gamemode as a String
function serverinfo_library.gamemode()
function serverinfo_library.getGamemode ()
return gmod.GetGamemode().Name
end

--- Returns whether or not the current game is single player
function serverinfo_library.isSinglePlayer()
function serverinfo_library.isSinglePlayer ()
return SinglePlayer()
end

Expand Down
15 changes: 0 additions & 15 deletions lua/starfall/libs_sv/entities.lua
Original file line number Diff line number Diff line change
Expand Up @@ -406,18 +406,3 @@ function ents_methods:isWeldedTo()

return wrap( ent1or2(this,constraint.FindConstraint(this, "Weld")) )
end

--- Gets the entities up vector
function ents_methods:getUp()
return unwrap(self):GetUp()
end

--- Gets the entities right vector
function ents_methods:getRight()
return unwrap(self):GetRight()
end

--- Gets the entities forward vector
function ents_methods:getForward()
return unwrap(self):GetForward()
end

0 comments on commit ab35d3f

Please sign in to comment.