diff --git a/lua/map_scripts/maps/gm_darkfusion.lua b/lua/map_scripts/maps/gm_darkfusion.lua new file mode 100644 index 0000000..650504d --- /dev/null +++ b/lua/map_scripts/maps/gm_darkfusion.lua @@ -0,0 +1,30 @@ +local entIDs = { + 6609, -- sound precaching button + 6084, -- cheese dark fusion fuel cells + 4005, -- ditto + 6281, -- cheese stasis charges + 4909, -- ditto + 4454, -- ditto + 4145, -- 1 reactor tps + 4557, -- 2 reactor tps + 5630, -- cleanup debris now + 4050, -- superfast debris cleanup + 5207, -- disable debris cleanup + 5501, -- DISABLE light flickering + 1899, -- Enable infinite fall in core chamber + 4174, -- Disable core disintegration hitbox NOW + 6025, -- actually kill players upon Destruction + 4593, -- DISABLE logic clock + 5203, -- spawn stasis cells RIGHT NOW RIGHT HERE + 6130, -- do something weird with the sound + 4985, -- FORCE STASIS FAILURE (toggle) + 5460, -- force toggle particle enrichment + 4061, -- force toggle ALL lights in case of messed up flickering + 4288, -- color correction, clear + 5192, -- color correction, Pre Explosion + 5959, -- color correction, Dark Energy Limbo +} + +hook.Add( "CFC_MapScripts_PostMapEntsSpawn", "CFC_MapScripts_darkfusion_removeadminbuttons", function() + MapScripts.Utils.RemoveButtonsByID( entIDs ) +end ) \ No newline at end of file diff --git a/lua/map_scripts/maps/gm_vacant_industry_revamped.lua b/lua/map_scripts/maps/gm_vacant_industry_revamped.lua index 6f6aced..b08336f 100644 --- a/lua/map_scripts/maps/gm_vacant_industry_revamped.lua +++ b/lua/map_scripts/maps/gm_vacant_industry_revamped.lua @@ -1,4 +1,4 @@ -local entIds = { +local entIDs = { 2725, -- color correction 2716, -- high quality snowfall 2729, -- toggle skybox @@ -10,21 +10,6 @@ local entIds = { 2718, -- fast } -local buttonClass = "func_button" - hook.Add( "CFC_MapScripts_PostMapEntsSpawn", "CFC_MapScripts_vacant_removeadminbuttons", function() - local removedEnts = 0 - for _, entId in ipairs( entIds ) do - local ent = ents.GetMapCreatedEntity( entId ) - if not IsValid( ent ) then - ErrorNoHaltWithStack( "Admin button removal: Couldn't find map ent " .. entId ) - continue - end - if ent:GetClass() ~= buttonClass then - ErrorNoHaltWithStack( "Admin button removal: Map entity " .. entId .. " is not a button!" ) - continue - end - removedEnts = removedEnts + 1 - SafeRemoveEntity( ent ) - end + MapScripts.Utils.RemoveButtonsByID( entIDs ) end ) diff --git a/lua/map_scripts/utils.lua b/lua/map_scripts/utils.lua index 8aaef60..b2451bb 100644 --- a/lua/map_scripts/utils.lua +++ b/lua/map_scripts/utils.lua @@ -27,3 +27,31 @@ function Utils.DisableShadowControl() shadowControl:Fire( "SetShadowsDisabled", 1 ) end end + +local buttonClasses = { + ["func_button"] = true, + ["func_rot_button"] = true, +} + +--- Removes func_button entities by their entity IDs +--- @param ids table List of entity IDs to remove +--- @return number Number of entities successfully removed +function Utils.RemoveButtonsByID( ids ) + local removedEnts = 0 + + for _, entID in ipairs( ids ) do + local ent = ents.GetMapCreatedEntity( entID ) + if not IsValid( ent ) then + ErrorNoHaltWithStack( "Admin button removal: Couldn't find map ent " .. entID ) + continue + end + if not buttonClasses[ent:GetClass()] then + ErrorNoHaltWithStack( "Admin button removal: Map entity " .. entID .. " is not a button!" ) + continue + end + removedEnts = removedEnts + 1 + SafeRemoveEntity( ent ) + end + + return removedEnts +end \ No newline at end of file