diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-08 22:51:03 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-08 22:51:03 -0400 |
| commit | ccc507748a9b08ba7b7724ca551bf413c09caac2 (patch) | |
| tree | 05690afe6ded4bd453c982d78e4a91db3c00e355 | |
| parent | 6cf4530dffa7a6bb72b1bd904e127eb55f4b5c11 (diff) | |
| download | gmstranded-ccc507748a9b08ba7b7724ca551bf413c09caac2.tar.gz gmstranded-ccc507748a9b08ba7b7724ca551bf413c09caac2.tar.bz2 gmstranded-ccc507748a9b08ba7b7724ca551bf413c09caac2.zip | |
Changed f2 to be a help menu
| -rw-r--r-- | gamemode/cl_panels.lua | 197 | ||||
| -rw-r--r-- | gamemode/configure_me.lua | 44 |
2 files changed, 24 insertions, 217 deletions
diff --git a/gamemode/cl_panels.lua b/gamemode/cl_panels.lua index 33f32e5..fa346c5 100644 --- a/gamemode/cl_panels.lua +++ b/gamemode/cl_panels.lua @@ -295,7 +295,7 @@ end vgui.Register( "gms_SkillPanel", PANEL, "Panel" ) /*--------------------------------------------------------- - Resource panel + Help ---------------------------------------------------------*/ local PANEL = {} @@ -306,9 +306,6 @@ function PANEL:Init() self:SetSize( ScrW() / 6, 34 ) self:SetVisible( true ) self.Extended = false - self.ResourceLabels = {} - - self:RefreshResources() end @@ -321,71 +318,33 @@ function PANEL:Paint() surface.DrawLine( 0, 0, 0, self:GetTall() ) surface.DrawLine( self:GetWide() - 1, 0, self:GetWide() - 1, self:GetTall() ) surface.DrawLine( 0, self:GetTall() - 1, self:GetWide(), self:GetTall() - 1 ) + --print("test") if ( self.Extended ) then surface.DrawLine( 0, 33, self:GetWide(), 33 ) + draw.SimpleText("Q - Inventory, tribes, and building","HudHintTextSmall",10,30,StrandedTextColor) + draw.SimpleText("Use your fists to hit trees and rocks!","HudHintTextSmall",10,40,StrandedTextColor) + draw.SimpleText("Press E on water to drink,","HudHintTextSmall",10,50,StrandedTextColor) + draw.SimpleText("\tor E on the ground to forage for seeds.","HudHintTextSmall",10,60,StrandedTextColor) + draw.SimpleText("You can plant seeds by clicking on them.","HudHintTextSmall",10,70,StrandedTextColor) + draw.SimpleText("You craft a bed to sleep in.","HudHintTextSmall",10,80,StrandedTextColor) end - draw.SimpleText( "Resources ( F2 )", "ScoreboardSub", self:GetWide() / 2, 17, StrandedTextColor, 1, 1 ) + draw.SimpleText( "Help ( F2 )", "ScoreboardSub", self:GetWide() / 2, 17, StrandedTextColor, 1, 1 ) return true end -function PANEL:RefreshResources() - if ( IsValid( GAMEMODE.ResourcePackFrame ) ) then GAMEMODE.ResourcePackFrame:Update() end - for k, v in pairs( self.ResourceLabels ) do v:Remove() end - - self.ResourceLabels = {} - self.Line = 39 - self.Resourcez = 0 - - for k, v in SortedPairs( Resources ) do - if ( v > 0 ) then - local lbl = vgui.Create( "gms_ResourcePanel", self ) - lbl:SetPos( 0, self.Line ) - lbl:SetSize( self:GetWide(), 16 ) - lbl:SetResource( k ) - self.Resourcez = self.Resourcez + v - - self.Line = self.Line + lbl:GetTall() + 5 - table.insert( self.ResourceLabels, lbl ) - if ( !self.Extended ) then lbl:SetVisible( false ) end - end - end - - self.Line = self.Line + 21 - - local lblT = vgui.Create( "gms_ResourcePanelTotal", self ) - lblT:SetPos( 0, self.Line ) - lblT:SetSize( self:GetWide(), 16 ) - lblT:SetResources( self.Resourcez ) - - table.insert( self.ResourceLabels, lblT ) - if ( !self.Extended ) then lblT:SetVisible( false ) end - - if ( self.Extended ) then - self:SetSize( ScrW() / 6, 40 + ( ( table.Count( self.ResourceLabels ) + 1 ) * 21 ) ) - end - - if ( GAMEMODE.CommandsHud ) then GAMEMODE.CommandsHud:SetPos( ScrW() / 6 + 2, self:GetTall() ) end -end - function PANEL:ToggleExtend() self:SetExtended( !self.Extended ) end function PANEL:SetExtended( bool ) if ( bool ) then - self:SetSize( ScrW() / 6, 40 + ( ( table.Count( self.ResourceLabels ) + 1 ) * 21 ) ) + self:SetSize( ScrW() / 6, 200 ) self.Extended = true - for k,v in pairs( self.ResourceLabels ) do - v:SetVisible( true ) - end else self:SetSize( ScrW() / 6, 34 ) self.Extended = false - for k, v in pairs( self.ResourceLabels ) do - v:SetVisible( false ) - end end if ( GAMEMODE.CommandsHud ) then GAMEMODE.CommandsHud:SetPos( ScrW() / 6 + 2, self:GetTall() ) end end @@ -396,122 +355,6 @@ end vgui.Register( "gms_ResourcesHud", PANEL, "Panel" ) /*--------------------------------------------------------- - Resource Sub-Panel ----------------------------------------------------------*/ - -local PANEL = {} - -PANEL.GroundActions = {} -PANEL.GroundActions[ "Sprouts" ] = { cmd = "gms_planttree", name = "Plant" } -PANEL.GroundActions[ "Banana_Seeds" ] = { cmd = "gms_plantbanana", name = "Plant" } -PANEL.GroundActions[ "Orange_Seeds" ] = { cmd = "gms_plantorange", name = "Plant" } -PANEL.GroundActions[ "Grain_Seeds" ] = { cmd = "gms_plantgrain", name = "Plant" } -PANEL.GroundActions[ "Melon_Seeds" ] = { cmd = "gms_plantmelon", name = "Plant" } -PANEL.GroundActions[ "Berries" ] = { cmd = "gms_plantbush", name = "Plant" } - -PANEL.NormalActions = {} -PANEL.NormalActions[ "Berries" ] = { cmd = "gms_EatBerry", name = "Eat" } -PANEL.NormalActions[ "Medicine" ] = { cmd = "gms_TakeMedicine", name = "Take" } -PANEL.NormalActions[ "Water_Bottles" ] = { cmd = "gms_DrinkBottle", name = "Drink" } - -function PANEL:Init() - self:SetText( "" ) -end - -function PANEL:Paint() - surface.SetDrawColor( 0, 0, 0, 178 ) -- Resource bar background - surface.DrawRect( 5, 0, self:GetWide() - 10, self:GetTall() ) - - local XP = math.floor( Resources[ self.Resource ] / MaxResources * ( self:GetWide() - 10 ) ) - surface.SetDrawColor( 0, 128, 0, 200 ) -- Resource bar - surface.DrawRect( 5, 0, XP, self:GetTall() ) - - if ( self.Hovered ) then - surface.SetDrawColor( 255, 255, 255, 64 ) -- Resource bar background - surface.DrawRect( 5, 0, self:GetWide() - 10, self:GetTall() ) - end - - draw.SimpleText( self.TxtResource .. ": " .. Resources[ self.Resource ], "DefaultBold", self:GetWide() / 2, self:GetTall() / 2 - 1, Color( 255, 255, 255, 255 ), 1, 1 ) - return true -end - -function PANEL:DoRightClick() - local menu = DermaMenu() - - if ( self.GroundActions[ self.Resource ] ) then - menu:AddOption( self.GroundActions[ self.Resource ].name, function() - if ( self.GroundActions ) then - RunConsoleCommand( self.GroundActions[ self.Resource ].cmd ) - end - end ) - end - - if ( self.NormalActions[ self.Resource ] ) then - menu:AddOption( self.NormalActions[ self.Resource ].name, function() - if ( self.NormalActions ) then - RunConsoleCommand( self.NormalActions[ self.Resource ].cmd ) - end - end ) - end - - menu:AddSpacer() - - menu:AddOption( "Drop x1", function() RunConsoleCommand( "gms_DropResources", self.Resource, " 1" ) end ) - menu:AddOption( "Drop x10", function() RunConsoleCommand( "gms_DropResources", self.Resource, " 10" ) end ) - menu:AddOption( "Drop All", function() RunConsoleCommand( "gms_DropResources", self.Resource ) end ) - menu:AddOption( "Cancel", function() end ) - menu:Open() -end - -function PANEL:DoClick() - local tr = util.TraceLine( { - start = LocalPlayer():GetShootPos(), - endpos = LocalPlayer():GetShootPos() + LocalPlayer():GetAimVector() * 150, - filter = LocalPlayer() - } ) - - if ( self.GroundActions && self.GroundActions[ self.Resource ] && tr.HitWorld ) then - RunConsoleCommand( self.GroundActions[ self.Resource ].cmd ) - elseif ( self.NormalActions && self.NormalActions[ self.Resource ] ) then - RunConsoleCommand( self.NormalActions[ self.Resource ].cmd ) - end -end - -function PANEL:SetResource( str ) - self.TxtResource = string.gsub( str, "_", " " ) - self.Resource = str -end - -vgui.Register( "gms_ResourcePanel", PANEL, "DButton" ) - -/*--------------------------------------------------------- - Resource Total Sub-Panel ----------------------------------------------------------*/ -local PANEL = {} - -function PANEL:Init() - self.Res = 0 -end - -function PANEL:Paint() - surface.SetDrawColor( 0, 0, 0, 178 ) -- Resource bar background - surface.DrawRect( 5, 0, self:GetWide() - 10, self:GetTall() ) - - local XP = math.floor( self.Res / MaxResources * ( self:GetWide() - 10 ) ) - surface.SetDrawColor( 0, 128, 176, 220 ) -- Resource bar - surface.DrawRect( 5, 0, XP, self:GetTall() ) - - draw.SimpleText( "Total: " .. self.Res .. " / " .. MaxResources, "DefaultBold", self:GetWide() / 2, self:GetTall() / 2 - 1, Color( 255, 255, 255, 255 ), 1, 1 ) - return true -end - -function PANEL:SetResources( num ) - self.Res = num -end - -vgui.Register( "gms_ResourcePanelTotal", PANEL, "Panel" ) - -/*--------------------------------------------------------- Command panel ---------------------------------------------------------*/ @@ -966,14 +809,14 @@ end function PANEL:SetInfo( name, tbl ) //if ( tbl.Texture && Material( tbl.Texture ) ) then self.TexID = Material( tbl.Texture ) end - + local img = vgui.Create("DImage", self) img:SetPos(20, 10) img:SetSize(self:GetWide()-40, self:GetTall()-40) img:SetImage("vgui/avatar_default") PrintTable(tbl) - if (tbl.Results != nil) then - + if (tbl.Results != nil) then + for k,v in pairs(tbl.Results) do if(GMS.Resources[k] == nil) then --This resource is not registered! img:SetImage("vgui/avatar_default") @@ -986,24 +829,24 @@ function PANEL:SetInfo( name, tbl ) else img:SetImage(GMS.Resources[k].Icon) end - + end - + elseif (tbl.FoodValue != nil) then img:SetPos(0, 0) img:SetSize(self:GetSize()) img:SetImage("items/gms_none.png") - + else - + img:SetPos(0, -10) img:SetSize(self:GetSize()) img:SetImage("items/gms_weapon.png") - + end - + //if (GMS.GetResourceByName(name).Icon != nil) then img:SetImage(GMS.GetResourceByName(name).Icon) else img:SetImage("vgui/avatar_default") end - + self.Combi = name self.CombiTable = tbl end diff --git a/gamemode/configure_me.lua b/gamemode/configure_me.lua index 7deb922..6cd8b24 100644 --- a/gamemode/configure_me.lua +++ b/gamemode/configure_me.lua @@ -23,16 +23,16 @@ GMS.NETINT_BITCOUNT = 16 GMS.graveTime = { { - + rank = "user", time = "120", - + }, { - + rank = "owner", time = "240", - + }, } @@ -67,39 +67,3 @@ GMS.AllowedStools = { "colour", "material", } ---[[ -GMS.ProhibitedStools = { - "hydraulic", - "motor", - "muscle", - "nail", - "pulley", - "slider", - "balloon", - "rope", // We use gms_rope - "button", - "duplicator", - "dynamite", - "emitter", - "hoverball", - "ignite", - "keepupright", - "magnetise", - //"nocollide", - "physprop", - "spawner", - "thruster", - "turret", - "wheel", - "eyeposer", - "faceposer", - "finger", - "inflator", - "statue", - "trails", - "camera", - "paint", - "rtcamera", - "rb655_lightsaber" -} -]] |
