diff --git a/[admin]/admin/client/gui/admin_main.lua b/[admin]/admin/client/gui/admin_main.lua index 965b9a3c0..9b7ae1d41 100644 --- a/[admin]/admin/client/gui/admin_main.lua +++ b/[admin]/admin/client/gui/admin_main.lua @@ -18,6 +18,8 @@ aPlayers = {} aBans = {} aLastSync = 0 aResources = {} +glitchesData = {} +worldPropsData = {} local serverPassword = 'None' local hasResourceSetting @@ -270,6 +272,80 @@ y=y+B aTab1.VehicleHealth = guiCreateLabel ( 0.26, y, 0.25, 0.04, "Vehicle Heal aTab3.FPS = guiCreateEdit ( 0.35, 0.65, 0.135, 0.04, "38", true, aTab3.Tab ) aTab3.FPSSet = guiCreateButton ( 0.50, 0.65, 0.10, 0.04, "Set", true, aTab3.Tab, "setfpslimit" ) guiCreateLabel ( 0.63, 0.65, 0.1, 0.04, "( 25-32767 )", true, aTab3.Tab ) + + aTab3.ServerSettingsGridList = guiCreateGridList ( 0.04, 0.70, 0.55, 0.28, true, aTab3.Tab ) + guiGridListAddColumn( aTab3.ServerSettingsGridList, "Setting Type", 0.25 ) + guiGridListAddColumn( aTab3.ServerSettingsGridList, "Name", 0.45 ) + guiGridListAddColumn( aTab3.ServerSettingsGridList, "Status/Value", 0.2 ) + guiGridListSetSortingEnabled( aTab3.ServerSettingsGridList, false ) + + if not hasPermissionTo("command.setglitchenabled") or not hasPermissionTo("command.setworldspecprop") then + guiSetEnabled(aTab3.ServerSettingsGridList, false) + end + + local glitchData = { + {name = "Quick Reload", id = "quickreload"}, + {name = "Fast Move", id = "fastmove"}, + {name = "Fast Fire", id = "fastfire"}, + {name = "Crouch Bug", id = "crouchbug"}, + {name = "High Close Range Damage", id = "highcloserangedamage"}, + {name = "Hit Animation", id = "hitanim"}, + {name = "Fast Sprint", id = "fastsprint"}, + {name = "Bad Driveby Hitbox", id = "baddrivebyhitbox"}, + {name = "Quick Stand", id = "quickstand"}, + {name = "Kick Out Vehicle", id = "kickoutofvehicle_onmodelreplace"}, + {name = "Vehicle Rapid Stop", id = "vehicle_rapid_stop"} + } + + local worldPropData = { + {name = "Hover Cars", id = "hovercars"}, + {name = "Air Cars", id = "aircars"}, + {name = "Extra Bunny", id = "extrabunny"}, + {name = "Extra Jump", id = "extrajump"}, + {name = "Random Foliage", id = "randomfoliage"}, + {name = "Sniper Moon", id = "snipermoon"}, + {name = "Extra Air Resistance", id = "extraairresistance"}, + {name = "Underworld Warp", id = "underworldwarp"}, + {name = "Vehicle Sun Glare", id = "vehiclesunglare"}, + {name = "Corona Z Test", id = "coronaztest"}, + {name = "Water Creatures", id = "watercreatures"}, + {name = "Burn Flipped Cars", id = "burnflippedcars"}, + {name = "Fireball Destruct", id = "fireballdestruct"}, + {name = "Road Signs Text", id = "roadsignstext"}, + {name = "Extended Water Cannons", id = "extendedwatercannons"}, + {name = "Tunnel Weather Blend", id = "tunnelweatherblend"}, + {name = "Ignore Fire State", id = "ignorefirestate"}, + {name = "Flying Components", id = "flyingcomponents"}, + {name = "Vehicle Burn Explosions", id = "vehicleburnexplosions"}, + {name = "Vehicle Engine Autostart", id = "vehicle_engine_autostart"} + } + + aTab3.ServerSettings = {} + + for i, glitch in ipairs(glitchData) do + local row = guiGridListAddRow(aTab3.ServerSettingsGridList) + guiGridListSetItemText(aTab3.ServerSettingsGridList, row, 1, "Glitch", false, false) + guiGridListSetItemText(aTab3.ServerSettingsGridList, row, 2, glitch.name, false, false) + guiGridListSetItemText(aTab3.ServerSettingsGridList, row, 3, "Disabled", false, false) + guiGridListSetItemData(aTab3.ServerSettingsGridList, row, 1, "glitch") + guiGridListSetItemData(aTab3.ServerSettingsGridList, row, 2, glitch.id) + guiGridListSetItemColor(aTab3.ServerSettingsGridList, row, 3, 255, 0, 0) + aTab3.ServerSettings[glitch.id] = {row = row, type = "glitch", enabled = false} + end + + for i, prop in ipairs(worldPropData) do + local row = guiGridListAddRow(aTab3.ServerSettingsGridList) + guiGridListSetItemText(aTab3.ServerSettingsGridList, row, 1, "World Prop", false, false) + guiGridListSetItemText(aTab3.ServerSettingsGridList, row, 2, prop.name, false, false) + guiGridListSetItemText(aTab3.ServerSettingsGridList, row, 3, "Disabled", false, false) + guiGridListSetItemData(aTab3.ServerSettingsGridList, row, 1, "worldprop") + guiGridListSetItemData(aTab3.ServerSettingsGridList, row, 2, prop.id) + guiGridListSetItemColor(aTab3.ServerSettingsGridList, row, 3, 255, 0, 0) + aTab3.ServerSettings[prop.id] = {row = row, type = "worldprop", enabled = false} + end + aTab3.SettingsReset = guiCreateButton(0.61, 0.70, 0.15, 0.04, "Reset All", true, aTab3.Tab, "setglitchenabled") + aTab3.SettingsEnableAll = guiCreateButton(0.61, 0.75, 0.15, 0.04, "Enable All", true, aTab3.Tab, "setglitchenabled") + aTab3.SettingsDisableAll = guiCreateButton(0.61, 0.80, 0.15, 0.04, "Disable All", true, aTab3.Tab, "setglitchenabled") aTab4 = {} @@ -592,6 +668,19 @@ function aClientSync ( type, table, data ) guiSetText ( aTab3.MapName, "Map Name: "..( table["map"] or "None" ) ) guiSetText ( aTab3.FPSCurrent, "FPS Limit: "..( table["fps"] or "N/A" ) ) guiSetText ( aTab3.FPS, table["fps"] or "38" ) + if table["glitches"] and table["worldprops"] then + for settingId, gPropData in pairs(aTab3.ServerSettings) do + local enabled = false + if gPropData.type == "glitch" and table["glitches"][settingId] ~= nil then + enabled = table["glitches"][settingId] + elseif gPropData.type == "worldprop" and table["worldprops"][settingId] ~= nil then + enabled = table["worldprops"][settingId] + end + gPropData.enabled = enabled + guiGridListSetItemText(aTab3.ServerSettingsGridList, gPropData.row, 3, enabled and "Enabled" or "Disabled", false, false) + guiGridListSetItemColor(aTab3.ServerSettingsGridList, gPropData.row, 3, enabled and 0 or 255, enabled and 255 or 0, 0) + end + end elseif ( type == "bansdirty" ) then g_GotLatestBansList = false if aAdminForm and guiGetVisible ( aAdminForm ) and guiGetSelectedTab( aTabPanel ) == aTab4.Tab then @@ -983,6 +1072,27 @@ function aClientDoubleClick ( button ) local selserial = guiGridListGetItemText ( aTab4.BansList, guiGridListGetSelectedItem( aTab4.BansList ), 3 ) aBanDetails ( aBans["Serial"][selserial] and selserial or selip ) end + elseif ( source == aTab3.ServerSettingsGridList ) then + local selectedRow = guiGridListGetSelectedItem(aTab3.ServerSettingsGridList) + if selectedRow ~= -1 then + local settingType = guiGridListGetItemData(aTab3.ServerSettingsGridList, selectedRow, 1) + local settingId = guiGridListGetItemData(aTab3.ServerSettingsGridList, selectedRow, 2) + if settingType == "glitch" and hasPermissionTo("command.setglitchenabled") then + local currentStatus = aTab3.ServerSettings[settingId].enabled + local newStatus = not currentStatus + aTab3.ServerSettings[settingId].enabled = newStatus + guiGridListSetItemText(aTab3.ServerSettingsGridList, selectedRow, 3, newStatus and "Enabled" or "Disabled", false, false) + guiGridListSetItemColor(aTab3.ServerSettingsGridList, selectedRow, 3, newStatus and 0 or 255, newStatus and 255 or 0, 0) + triggerServerEvent("aServer", localPlayer, "setglitchenabled", settingId, newStatus) + elseif settingType == "worldprop" and hasPermissionTo("command.setworldspecprop") then + local currentStatus = aTab3.ServerSettings[settingId].enabled + local newStatus = not currentStatus + aTab3.ServerSettings[settingId].enabled = newStatus + guiGridListSetItemText(aTab3.ServerSettingsGridList, selectedRow, 3, newStatus and "Enabled" or "Disabled", false, false) + guiGridListSetItemColor(aTab3.ServerSettingsGridList, selectedRow, 3, newStatus and 0 or 255, newStatus and 255 or 0, 0) + triggerServerEvent("aServer", localPlayer, "setworldspecprop", settingId, newStatus) + end + end end end @@ -1115,6 +1225,46 @@ function aClientClick ( button ) elseif ( source == aTab3.FPSSet ) then triggerServerEvent ( "aServer", localPlayer, "setfpslimit", guiGetText ( aTab3.FPS ) ) triggerServerEvent ( "aSync", localPlayer, "server" ) + elseif ( source == aTab3.SettingsReset ) then + for settingId, data in pairs(aTab3.ServerSettings) do + if data.type == "glitch" then + local defaultValue = false + data.enabled = defaultValue + guiGridListSetItemText(aTab3.ServerSettingsGridList, data.row, 3, defaultValue and "Enabled" or "Disabled", false, false) + guiGridListSetItemColor(aTab3.ServerSettingsGridList, data.row, 3, defaultValue and 0 or 255, defaultValue and 255 or 0, 0) + triggerServerEvent("aServer", localPlayer, "setglitchenabled", settingId, defaultValue) + elseif data.type == "worldprop" then + local defaultValue = false + data.enabled = defaultValue + guiGridListSetItemText(aTab3.ServerSettingsGridList, data.row, 3, defaultValue and "Enabled" or "Disabled", false, false) + guiGridListSetItemColor(aTab3.ServerSettingsGridList, data.row, 3, defaultValue and 0 or 255, defaultValue and 255 or 0, 0) + triggerServerEvent("aServer", localPlayer, "setworldspecprop", settingId, defaultValue) + end + end + elseif ( source == aTab3.SettingsEnableAll ) then + for settingId, data in pairs(aTab3.ServerSettings) do + data.enabled = true + guiGridListSetItemText(aTab3.ServerSettingsGridList, data.row, 3, "Enabled", false, false) + guiGridListSetItemColor(aTab3.ServerSettingsGridList, data.row, 3, 0, 255, 0) + + if data.type == "glitch" then + triggerServerEvent("aServer", localPlayer, "setglitchenabled", settingId, true) + elseif data.type == "worldprop" then + triggerServerEvent("aServer", localPlayer, "setworldspecprop", settingId, true) + end + end + elseif ( source == aTab3.SettingsDisableAll ) then + for settingId, data in pairs(aTab3.ServerSettings) do + data.enabled = false + guiGridListSetItemText(aTab3.ServerSettingsGridList, data.row, 3, "Disabled", false, false) + guiGridListSetItemColor(aTab3.ServerSettingsGridList, data.row, 3, 255, 0, 0) + + if data.type == "glitch" then + triggerServerEvent("aServer", localPlayer, "setglitchenabled", settingId, false) + elseif data.type == "worldprop" then + triggerServerEvent("aServer", localPlayer, "setworldspecprop", settingId, false) + end + end end -- TAB 4, BANS elseif ( getElementParent ( source ) == aTab4.Tab ) then diff --git a/[admin]/admin/conf/ACL.xml b/[admin]/admin/conf/ACL.xml index ba89676c5..402fea81a 100644 --- a/[admin]/admin/conf/ACL.xml +++ b/[admin]/admin/conf/ACL.xml @@ -78,6 +78,8 @@ + + @@ -164,6 +166,8 @@ + + @@ -250,6 +254,8 @@ + + @@ -315,6 +321,8 @@ + + diff --git a/[admin]/admin/conf/commands.xml b/[admin]/admin/conf/commands.xml index 347547598..db98a3db3 100644 --- a/[admin]/admin/conf/commands.xml +++ b/[admin]/admin/conf/commands.xml @@ -53,6 +53,8 @@ + + diff --git a/[admin]/admin/conf/glitches.xml b/[admin]/admin/conf/glitches.xml new file mode 100644 index 000000000..0c14abf63 --- /dev/null +++ b/[admin]/admin/conf/glitches.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/[admin]/admin/conf/messages.xml b/[admin]/admin/conf/messages.xml index 4b75e843f..59a9ef4b4 100644 --- a/[admin]/admin/conf/messages.xml +++ b/[admin]/admin/conf/messages.xml @@ -253,6 +253,14 @@ FPS limit set to '$data'$by_admin_4all. ADMIN: $admin has set FPS limit to '$data' + + $data set to $data2$by_admin_4all. + ADMIN: $admin has set $data to $data2 + + + $data set to $data2$by_admin_4all. + ADMIN: $admin has set world special property $data to $data2 + diff --git a/[admin]/admin/conf/worldspecialproperties.xml b/[admin]/admin/conf/worldspecialproperties.xml new file mode 100644 index 000000000..5371201c4 --- /dev/null +++ b/[admin]/admin/conf/worldspecialproperties.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/[admin]/admin/meta.xml b/[admin]/admin/meta.xml index 69de3ce01..297b0e490 100644 --- a/[admin]/admin/meta.xml +++ b/[admin]/admin/meta.xml @@ -57,6 +57,8 @@ + + diff --git a/[admin]/admin/server/admin_commands.lua b/[admin]/admin/server/admin_commands.lua index c08517bca..2445f3c81 100644 --- a/[admin]/admin/server/admin_commands.lua +++ b/[admin]/admin/server/admin_commands.lua @@ -83,6 +83,15 @@ function aCommandToArgs ( argv, args ) elseif ( argt == "t" ) then argv[id] = { argv[id] } elseif ( argt == "s" ) then argv[id] = tostring ( argv[id] ) elseif ( argt == "i" ) then argv[id] = tonumber ( argv[id] ) + elseif ( argt == "b" ) then + if type(argv[id]) == "string" then + argv[id] = string.lower(argv[id]) + end + if argv[id] == "true" or argv[id] == "1" or argv[id] == "on" or argv[id] == "enable" then + argv[id] = true + elseif argv[id] == "false" or argv[id] == "0" or argv[id] == "off" or argv[id] == "disable" then + argv[id] = false + end elseif ( argt == "t-" ) then local atable = {} for i = id, #argv do table.insert ( atable, argv[id] ) table.remove ( argv, id ) end diff --git a/[admin]/admin/server/admin_server.lua b/[admin]/admin/server/admin_server.lua index b0a476d11..00150388b 100644 --- a/[admin]/admin/server/admin_server.lua +++ b/[admin]/admin/server/admin_server.lua @@ -17,6 +17,8 @@ aInteriors = {} aStats = {} aReports = {} aWeathers = {} +aGlitches = {} +aWorldSpecialProperties = {} local aUnmuteTimerList = {} local chatHistory = {} @@ -105,6 +107,38 @@ addEventHandler ( "onResourceStart", root, function ( resource ) end aSetupACL() aSetupCommands() + local glitchNode = xmlLoadFile("conf\\glitches.xml") + if glitchNode then + local glitches = xmlNodeGetChildren(glitchNode) + for _, childNode in ipairs(glitches) do + local name = xmlNodeGetAttribute(childNode, "name") + local enabled = xmlNodeGetAttribute(childNode, "enabled") == "true" + if name then + aGlitches[name] = enabled + local currentValue = isGlitchEnabled(name) + if currentValue ~= enabled then + setGlitchEnabled(name, enabled) + end + end + end + xmlUnloadFile(glitchNode) + end + local worldspecNode = xmlLoadFile("conf\\worldspecialproperties.xml") + if worldspecNode then + local properties = xmlNodeGetChildren(worldspecNode) + for _, propNode in ipairs(properties) do + local name = xmlNodeGetAttribute(propNode, "name") + local enabled = xmlNodeGetAttribute(propNode, "enabled") == "true" + if name then + aWorldSpecialProperties[name] = enabled + local currentValue = isWorldSpecialPropertyEnabled(name) + if currentValue ~= enabled then + setWorldSpecialPropertyEnabled(name, enabled) + end + end + end + xmlUnloadFile(worldspecNode) + end for id, player in ipairs ( getElementsByType ( "player" ) ) do aPlayerInitialize ( player ) if ( hasObjectPermissionTo ( player, "general.adminpanel" ) ) then @@ -1466,6 +1500,60 @@ addEventHandler ( "aServer", root, function ( action, data, data2 ) end elseif ( action == "clearchat" ) then clearChatBox() + elseif ( action == "setglitchenabled" ) then + local glitchName = data + local enabled = ( data2 == true or data2 == "true" or data2 == 1 ) + if not setGlitchEnabled(glitchName, enabled) then + action = nil + else + local glitchNode = xmlLoadFile("conf\\glitches.xml") + if glitchNode then + local glitches = xmlNodeGetChildren(glitchNode) + for _, childNode in ipairs(glitches) do + local name = xmlNodeGetAttribute(childNode, "name") + if name == glitchName then + xmlNodeSetAttribute(childNode, "enabled", tostring(enabled)) + break + end + end + xmlSaveFile(glitchNode) + xmlUnloadFile(glitchNode) + end + for id, player in ipairs(getElementsByType("player")) do + if hasObjectPermissionTo(player, "general.adminpanel") then + triggerEvent("aSync", player, "server") + end + end + mdata = data + mdata2 = enabled and "enabled" or "disabled" + end + elseif ( action == "setworldspecprop" ) then + local propName = data + local enabled = ( data2 == true or data2 == "true" or data2 == 1 ) + if not setWorldSpecialPropertyEnabled(propName, enabled) then + action = nil + else + local worldspecNode = xmlLoadFile("conf\\worldspecialproperties.xml") + if worldspecNode then + local properties = xmlNodeGetChildren(worldspecNode) + for _, propNode in ipairs(properties) do + local name = xmlNodeGetAttribute(propNode, "name") + if name == propName then + xmlNodeSetAttribute(propNode, "enabled", tostring(enabled)) + break + end + end + xmlSaveFile(worldspecNode) + xmlUnloadFile(worldspecNode) + end + for id, player in ipairs(getElementsByType("player")) do + if hasObjectPermissionTo(player, "general.adminpanel") then + triggerEvent("aSync", player, "server") + end + end + mdata = propName + mdata2 = enabled and "enabled" or "disabled" + end else action = nil end diff --git a/[admin]/admin/server/admin_sync.lua b/[admin]/admin/server/admin_sync.lua index bee57e357..e83bf80f3 100644 --- a/[admin]/admin/server/admin_sync.lua +++ b/[admin]/admin/server/admin_sync.lua @@ -125,6 +125,14 @@ function aSynchCoroutineFunc( type, data, typeOfTag, banSearchTag ) tableOut["map"] = getMapName() tableOut["password"] = getServerPassword() tableOut["fps"] = getFPSLimit() + tableOut["glitches"] = {} + for glitchName, defaultValue in pairs(aGlitches) do + tableOut["glitches"][glitchName] = isGlitchEnabled(glitchName) + end + tableOut["worldprops"] = {} + for propName, defaultValue in pairs(aWorldSpecialProperties) do + tableOut["worldprops"][propName] = isWorldSpecialPropertyEnabled(propName) + end elseif ( type == "bansdirty" ) then tableOut = nil g_Bans = nil diff --git a/[editor]/editor_main/client/elementcreation.lua b/[editor]/editor_main/client/elementcreation.lua index eacc038b5..afd9a884e 100644 --- a/[editor]/editor_main/client/elementcreation.lua +++ b/[editor]/editor_main/client/elementcreation.lua @@ -39,7 +39,7 @@ function doCreateElement ( elementType, resourceName, creationParameters, attach creationParameters = creationParameters or {} if not creationParameters.position then local targetX, targetY, targetZ = processCameraLineOfSight() - if not elementType == "object" or not elementType == "vehicle" then + if elementType ~= "object" and elementType ~= "vehicle" then creationParameters.position = nil else creationParameters.position = {targetX, targetY, targetZ + .5} diff --git a/[editor]/editor_main/client/main.lua b/[editor]/editor_main/client/main.lua index de1f55782..c2d90c915 100644 --- a/[editor]/editor_main/client/main.lua +++ b/[editor]/editor_main/client/main.lua @@ -1405,3 +1405,9 @@ function disableCharacterSounds() -- CJ stealth breathing, fall screaming etc. setWorldSoundEnabled ( 25, false ) end + +-- Sync server set world properties with client +addEvent("syncWorldProperties", true) +addEventHandler("syncWorldProperties", localPlayer, function(worldprop) + setWorldSpecialPropertyEnabled(worldprop, true) +end) \ No newline at end of file diff --git a/[editor]/editor_main/server/mapsettingssync.lua b/[editor]/editor_main/server/mapsettingssync.lua index 5427cf005..ef1f89a9c 100644 --- a/[editor]/editor_main/server/mapsettingssync.lua +++ b/[editor]/editor_main/server/mapsettingssync.lua @@ -16,6 +16,29 @@ local defaults = { maxplayers = 128, } +local worldSpecialProperties = { + "hovercars", + "aircars", + "extrabunny", + "extrajump", + "randomfoliage", + "snipermoon", + "extraairresistance", + "underworldwarp", + "vehiclesunglare", + "coronaztest", + "watercreatures", + "burnflippedcars", + "fireballdestruct", + "roadsignstext", + "extendedwatercannons", + "tunnelweatherblend", + "ignorefirestate", + "flyingcomponents", + "vehicleburnexplosions", + "vehicle_engine_autostart", +} + -- This function is required because defaults get overwritten. #7405 function makeSettingsDefault() defaults = { @@ -140,6 +163,11 @@ function setupMapSettings() mapSettingAction[setting](value) end end + for _, worldprop in ipairs(worldSpecialProperties) do + if isWorldSpecialPropertyEnabled(worldprop) then + triggerClientEvent("syncWorldProperties", root, worldprop) + end + end end addEventHandler ( "onResourceStart", resourceRoot, setupMapSettings )