diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-22 15:30:54 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-22 15:30:54 -0400 |
| commit | e84d85263c6ef55af98cb213c5462107a0170506 (patch) | |
| tree | af6e8e48478734a6d270ebdde9c587023dae3664 /gamemode | |
| parent | 83e1d1f833f036e0c7bc205bc2d39f0e9f083f54 (diff) | |
| download | gmstranded-e84d85263c6ef55af98cb213c5462107a0170506.tar.gz gmstranded-e84d85263c6ef55af98cb213c5462107a0170506.tar.bz2 gmstranded-e84d85263c6ef55af98cb213c5462107a0170506.zip | |
Since the new item system, the old way of createing camp fires will no longer work
Diffstat (limited to 'gamemode')
| -rw-r--r-- | gamemode/chatcommands.lua | 12 | ||||
| -rw-r--r-- | gamemode/init.lua | 55 | ||||
| -rw-r--r-- | gamemode/processes.lua | 26 | ||||
| -rw-r--r-- | gamemode/server/entity_functions.lua | 19 |
4 files changed, 12 insertions, 100 deletions
diff --git a/gamemode/chatcommands.lua b/gamemode/chatcommands.lua index 1cb38ec..374d483 100644 --- a/gamemode/chatcommands.lua +++ b/gamemode/chatcommands.lua @@ -173,18 +173,6 @@ GMS.RegisterChatCmd( CHATCMD ) ---------------------------------------------------------------------------------------------------- local CHATCMD = {} -CHATCMD.Command = "campfire" -CHATCMD.Desc = "Make a camp fire." -CHATCMD.CCName = "gms_makefire" - -function CHATCMD:Run( ply ) - GAMEMODE.MakeCampfire( ply ) -end -GMS.RegisterChatCmd( CHATCMD ) - ----------------------------------------------------------------------------------------------------- - -local CHATCMD = {} CHATCMD.Command = "drink" CHATCMD.Desc = "Drink a water bottle." diff --git a/gamemode/init.lua b/gamemode/init.lua index 85d2a56..48acecd 100644 --- a/gamemode/init.lua +++ b/gamemode/init.lua @@ -65,47 +65,47 @@ util.AddNetworkString('removeEntity') util.AddNetworkString('giveres') net.Receive('removeEntity', function(len, ply) - + local ent = net.ReadEntity() if (ent:GetClass() == "gms_generic_plantable") then ply:SetNWInt( "plants", ply:GetNWInt( "plants" ) - 1 ) end if ent.IsPlantChild then - + local plant = ent.PlantParent if (plant.Children <= 1) then plant:Fadeout() end end ent:Remove() - + end) net.Receive('giveres', function(len, ply) - + local target = net.ReadEntity() local r = net.ReadString() local a = net.ReadInt(32) - + target:IncResource( r, a ) - + end) net.Receive('adminCMenuResRequest', function(len, ply) - + local target = net.ReadEntity() net.Start( 'adminCMenuResSend' ) net.WriteTable( target.Resources ) net.Send( ply ) - - + + end) net.Receive('adminCMenuSkillRequest', function(len, ply) - + local target = net.ReadEntity() net.Start( 'adminCMenuSkillSend' ) net.WriteTable( target.Skills ) net.Send( ply ) - - + + end) -- Give player weapons from grave @@ -952,37 +952,6 @@ function GM.PlayerStuck( ply, cmd, args ) end concommand.Add( "gms_stuck", GM.PlayerStuck ) -function GM.MakeCampfire( ply, cmd, args ) - if ( GetConVarNumber( "gms_campfire" ) == 1 ) then - local tr = ply:TraceFromEyes( 150 ) - - if ( !tr.HitNonWorld or !tr.Entity ) then ply:SendMessage( "Aim at the prop( s ) to use for campfire.", 3, Color( 255, 255, 255, 255 ) ) return end - - local ent = tr.Entity - local cls = tr.Entity:GetClass() - - if ( ent:IsOnFire() or cls != "prop_physics" and cls != "prop_physics_multiplayer" and cls != "prop_dynamic" ) then - ply:SendMessage( "Aim at the prop( s ) to use for campfire.", 3, Color( 255, 255, 255, 255 ) ) - return - end - - local mat = tr.MatType - - if ( ply:GetResource( "Wood" ) < 5 ) then ply:SendMessage( "You need at least 5 wood to make a fire.", 5, Color( 255, 255, 255, 255 ) ) return end - - if ( mat != MAT_WOOD ) then ply:SendMessage( "Prop has to be wood, or if partially wood, aim at the wooden part.", 5, Color( 255, 255, 255, 255 ) ) return end - - local data = {} - data.Entity = ent - - if ( SPropProtection.PlayerCanTouch( ply, ent ) ) then - ply:DoProcess( "Campfire", 5, data ) - return - end - end -end -concommand.Add( "gms_makefire", GM.MakeCampfire ) - /* ---------------------------------------------------------------------------------------------------- Player spawn ---------------------------------------------------------------------------------------------------- */ diff --git a/gamemode/processes.lua b/gamemode/processes.lua index e11da6b..c647dd1 100644 --- a/gamemode/processes.lua +++ b/gamemode/processes.lua @@ -471,32 +471,6 @@ end GMS.RegisterProcess( "HarvestBush", PROCESS ) /*--------------------------------------------------------- - Make Campfire process ----------------------------------------------------------*/ -local PROCESS = {} - -function PROCESS:OnStart() - if ( GetConVarNumber( "gms_campfire" ) <= 0 ) then return end - self.Owner:MakeProcessBar( "Making Campfire", self.Time, self.Cancel ) - self.Owner:EmitSound( "stranded/start_campfire.wav" ) -end - -function PROCESS:OnStop() - if ( GetConVarNumber( "gms_campfire" ) <= 0 ) then return end - local num = math.random( 1, 3 ) - - if ( num == 1 ) then - self.Owner:SendMessage( "Failed.", 3, Color( 200, 0, 0, 255 ) ) - else - self.Data.Entity:MakeCampfire() - self.Owner:SendMessage( "Made campfire.", 5, Color( 10, 200, 100, 255 ) ) - self.Owner:DecResource( "Wood", 5 ) - end -end - -GMS.RegisterProcess( "Campfire", PROCESS ) - -/*--------------------------------------------------------- Wood cutting ---------------------------------------------------------*/ local PROCESS = {} diff --git a/gamemode/server/entity_functions.lua b/gamemode/server/entity_functions.lua index 4894ad1..564d6f6 100644 --- a/gamemode/server/entity_functions.lua +++ b/gamemode/server/entity_functions.lua @@ -57,25 +57,6 @@ function EntityMeta:IsLootableNPC() return table.HasValue( GMS.LootableNPCs, self:GetClass() ) end -function EntityMeta:MakeCampfire() - if ( GetConVarNumber( "gms_campfire" ) <= 0 ) then return end - - local min, max = self:OBBMins(), self:OBBMaxs() - local vol = math.abs( max.x - min.x ) * math.abs( max.y - min.y ) * math.abs( max.z - min.z ) - local mul = math.min( math.sqrt( vol ) / 200, 1 ) - - if ( !self.CampFire ) then self:SetHealth( 1337 ) end - self.CampFire = true - - timer.Create( "gms_removecampfire_" .. self:EntIndex(), 480 * mul, 1, function() if ( IsValid( self ) ) then self:Fadeout() end end ) - - if ( GetConVarNumber( "gms_SpreadFire" ) >= 1 ) then - self:Ignite( 360, ( self:OBBMins() - self:OBBMaxs() ):Length() + 10 ) - else - self:Ignite( 360, 0.001 ) - end -end - /* ---------------------------------------------------------------------------------------------------- Entity Fading ---------------------------------------------------------------------------------------------------- */ |
