diff --git a/lua/autorun/client/cl_betterdupe.lua b/lua/autorun/client/cl_betterdupe.lua new file mode 100644 index 0000000..154eb22 --- /dev/null +++ b/lua/autorun/client/cl_betterdupe.lua @@ -0,0 +1,47 @@ +if not AdvDupe2 then + PrintMessage( 3, "Advanced duplicator 2 is not installed. Better dupe has been disabled." ) + return +end + +hook.Add( "PostGamemodeLoaded", "BetterDupeLoad", function() + local duper = weapons.GetStored( "gmod_tool" )["Tool"]["duplicator"] + + function duper.BuildCPanel( CPanel, tool ) + CPanel:ClearControls() + + CPanel:AddControl( "Header", { Description = "#tool.duplicator.desc" } ) + + CPanel:AddControl( "Button", { Text = "#tool.duplicator.showsaves", Command = "dupe_show" } ) + + if ( !tool && IsValid( LocalPlayer() ) ) then tool = LocalPlayer():GetTool( "duplicator" ) end + if ( !tool || !tool.CurrentDupeName ) then return end + + local info = "Name: " .. tool.CurrentDupeName + info = info .. "\nEntities: " .. tool.CurrentDupeEntCount + + CPanel:AddControl( "Label", { Text = info } ) + + if ( tool.CurrentDupeWSIDs && #tool.CurrentDupeWSIDs > 0 ) then + CPanel:AddControl( "Label", { Text = "Required workshop content:" } ) + for _, wsid in pairs( tool.CurrentDupeWSIDs ) do + local subbed = "" + if ( steamworks.IsSubscribed( wsid ) ) then subbed = " (Subscribed)" end + local b = CPanel:AddControl( "Button", { Text = wsid .. subbed } ) + b.DoClick = function( s, ... ) steamworks.ViewFile( wsid ) end + steamworks.FileInfo( wsid, function( result ) + if ( !IsValid( b ) ) then return end + b:SetText( result.title .. subbed ) + end ) + end + end + + if ( tool.CurrentDupeCanSave ) then + local b = CPanel:AddControl( "Button", { Text = "#dupes.savedupe", Command = "dupe_save" } ) + hook.Add( "DupeSaveUnavailable", b, function() b:Remove() end ) + end + + CPanel:AddControl( "Label", { Text = "" } ) + CPanel:AddControl( "Label", { Text = "!!! Advanced Duplicator 2 Settings In-Effect !!!" } ) + CPanel:AddControl( "Label", { Text = "Adjust Advanced Duplicator 2 to disable automatic freezing." } ) + end +end ) diff --git a/lua/autorun/server/sv_betterdupe.lua b/lua/autorun/server/sv_betterdupe.lua index 3c978c2..3d05f86 100644 --- a/lua/autorun/server/sv_betterdupe.lua +++ b/lua/autorun/server/sv_betterdupe.lua @@ -41,6 +41,9 @@ hook.Add( "PostGamemodeLoaded", "BetterDupeLoad", function() ply.AdvDupe2.Name = "Better dupe" ply.AdvDupe2.Revision = advDupe2Revision + ply.AdvDupe2.Pasting = true + AdvDupe2.Notify( ply, "Pasting..." ) + AdvDupe2.InitPastingQueue( ply, ply.AdvDupe2.Position, ply.AdvDupe2.Angle, nil, true, true, true, tobool( ply:GetInfo( "advdupe2_paste_protectoveride" ) ) ) end end )