Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions lua/map_scripts/maps/gm_darkfusion.lua
Original file line number Diff line number Diff line change
@@ -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 )
19 changes: 2 additions & 17 deletions lua/map_scripts/maps/gm_vacant_industry_revamped.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local entIds = {
local entIDs = {
2725, -- color correction
2716, -- high quality snowfall
2729, -- toggle skybox
Expand All @@ -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 )
28 changes: 28 additions & 0 deletions lua/map_scripts/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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