Skip to content

editor: fixes, random rotation func, getCurrentMapName func, updated scale func #633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0dc9b6e
Added function getCurrentMapName()
PrimelPrime Mar 21, 2025
56a69a8
Merge branch 'master' of https://github.com/PrimelPrime/mtasa-resources
PrimelPrime May 9, 2025
6a4b1d8
Fix: Issue #603
PrimelPrime May 9, 2025
68f9ce5
Fix: Issue #589
PrimelPrime May 10, 2025
655d983
Update scale functionality; remove deprecated functions setPedRotatio…
PrimelPrime May 10, 2025
94ae228
Only one value should be returned for scale
PrimelPrime May 10, 2025
e4b6c06
Remove unnecessary special handling of scale
PrimelPrime May 10, 2025
adf0b3e
Add advanced options for element scaling and random rotation function…
PrimelPrime May 10, 2025
b08ce6c
Add check for loadedMap in passNewMapSettings function
PrimelPrime May 10, 2025
8c0a266
Implement stripHexCode function and update output messages to remove …
PrimelPrime May 10, 2025
521787a
Fix: linter
PrimelPrime May 10, 2025
640c939
Revert "Remove unnecessary special handling of scale"
PrimelPrime May 10, 2025
4c0e8e6
Fix search being case sensitive
PrimelPrime May 12, 2025
1859c07
Fix search to handle special characters in resource names
PrimelPrime May 12, 2025
28c7ac7
Fix refreshGamemodeSettings to correctly handle new and existing sett…
PrimelPrime May 12, 2025
b5efa95
Quicktest F5 -> get last added gamemode
PrimelPrime May 17, 2025
7de8fad
Fix: create missing entries; validate entries -> remove if invalid
PrimelPrime May 17, 2025
10b89b3
Fix: #637 initalize currentMapSettings.addedGamemodes = {} outside se…
PrimelPrime May 17, 2025
669d1da
Fix: Update quickTest() to only update lastTestGamemode when GridList…
PrimelPrime May 17, 2025
cfb2e30
Add support for scaling markers up/down via keybind as well
PrimelPrime May 19, 2025
7cc935e
Fix: g_minZ = minZ -> g_minZ = minZ or 0 to fix vehicle element creation
PrimelPrime May 19, 2025
5759ca6
Remove redundant code
PrimelPrime May 19, 2025
6b57f8c
Fix: Cloning -> Only set rotation when random rot is enabled
PrimelPrime May 21, 2025
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
4 changes: 4 additions & 0 deletions [admin]/admin/conf/messages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@
<all>Chatbox cleared$by_admin_4all.</all>
<log>ADMIN: $admin has cleared the chatbox.</log>
</group>
<group action="setfpslimit" r="225" g="170" b="90">
<all>FPS limit set to '$data'$by_admin_4all.</all>
<log>ADMIN: $admin has set FPS limit to '$data'</log>
</group>
</server>
<bans>

Expand Down
6 changes: 3 additions & 3 deletions [admin]/admin/server/admin_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,9 @@ function aAction ( type, action, admin, player, data, more )

if ( node ) then
local r, g, b = node["r"], node["g"], node["b"]
if ( node["all"] ) then outputChatBox ( aStripString ( node["all"] ), root, r, g, b ) end
if ( node["admin"] ) and ( admin ~= player ) then outputChatBox ( aStripString ( node["admin"] ), admin, r, g, b ) end
if ( node["player"] ) then outputChatBox ( aStripString ( node["player"] ), player, r, g, b ) end
if ( node["all"] ) then outputChatBox ( aStripString ( node["all"] ), root, r, g, b, true ) end
if ( node["admin"] ) and ( admin ~= player ) then outputChatBox ( aStripString ( node["admin"] ), admin, r, g, b, true ) end
if ( node["player"] ) then outputChatBox ( aStripString ( node["player"] ), player, r, g, b, true ) end
if ( node["log"] ) then outputServerLog ( aStripString ( node["log"] ) ) end
end
end
Expand Down
87 changes: 48 additions & 39 deletions [editor]/edf/edf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -884,23 +884,29 @@ end

--Returns an element's scale, or its scale element data, or false
function edfGetElementScale(element)
local etype = getElementType(element)
if etype == "object" then
scale = getObjectScale(element)
else
local handle = edfGetHandle(element)
if handle then
scale = getObjectScale(handle)
else
scale = tonumber(getElementData(element,"scale"))
end
end

if scale then
return scale
else
return false
end
local etype = getElementType(element)
if etype == "object" then
scale = getObjectScale(element)
if type(scale) ~= "table" then
scale = select(1, scale) or 1
end
else
local handle = edfGetHandle(element)
if handle then
scale = getObjectScale(handle)
if type(scale) == "table" then
scale = select(1, scale) or 1
end
else
scale = tonumber(getElementData(element,"scale"))
end
end

if scale then
return scale
else
return false
end
end

--Sets an element's position, or its posX/Y/Z element data
Expand Down Expand Up @@ -965,28 +971,31 @@ end

--Sets an element's scale, or its scale element data
function edfSetElementScale(element, scale)
local ancestor = edfGetAncestor(element) or element
setElementData(ancestor, "scale", scale)
local etype = getElementType(element)
if etype == "object" then
if setObjectScale(element, scale) then
triggerEvent ( "onElementPropertyChanged", ancestor, "scale" )
return true
end
else
local handle = edfGetHandle(element)
if handle then
if setObjectScale(handle, scale) then
triggerEvent ( "onElementPropertyChanged", ancestor, "scale" )
return true
end
else
setElementData(element, "scale", scale or 1)
triggerEvent ( "onElementPropertyChanged", ancestor, "scale" )
return true
end
end
return false
local ancestor = edfGetAncestor(element) or element
setElementData(ancestor, "scale", scale)
local etype = getElementType(element)
if type(scale) == "table" then
scale = scale[1]
end
if etype == "object" then
if setObjectScale(element, scale) then
triggerEvent ( "onElementPropertyChanged", ancestor, "scale" )
return true
end
else
local handle = edfGetHandle(element)
if handle then
if setObjectScale(handle, scale) then
triggerEvent ( "onElementPropertyChanged", ancestor, "scale" )
return true
end
else
setElementData(element, "scale", scale or 1)
triggerEvent ( "onElementPropertyChanged", ancestor, "scale" )
return true
end
end
return false
end

function edfGetElementInterior(element)
Expand Down
3 changes: 3 additions & 0 deletions [editor]/edf/edf_client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ end
--Sets an element's scale, or its scale element data
function edfSetElementScale(element, scale)
if scale then
if type(scale) == "table" then
scale = scale[1]
end
if isBasic[getElementType(element)] then
return setElementData(element, "scale", scale)
else
Expand Down
2 changes: 1 addition & 1 deletion [editor]/editor_gui/client/elementproperties.lua
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ local function addPropertyControl( controlType, controlLabelName, controlDescrip
if selectedElement then
if newControl:getLabel() == "model" and (elementType == "object" or elementType == "vehicle") then
local minX, minY, minZ = getElementBoundingBox(selectedElement)
g_minZ = minZ
g_minZ = minZ or 0
local handlerFunction = function ()
local minX2, minY2, minZ2 = getElementBoundingBox(selectedElement)
if minX2 and minY2 and minZ2 then
Expand Down
3 changes: 2 additions & 1 deletion [editor]/editor_gui/client/load.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ function openSearch()
guiGridListSetItemText ( loadDialog.mapsList, row, 3, res["version"], false, false )
end
else
local escapedText = string.gsub(string.lower(text), "([%-%.%+%*%?%[%]%^%$%(%)%%])", "%%%1")
for i,res in ipairs(openResources) do
if string.find(res["friendlyName"],text) then
if string.find(res["friendlyName"], escapedText) then
local row = guiGridListAddRow ( loadDialog.mapsList )
guiGridListSetItemText ( loadDialog.mapsList, row, 1, res["friendlyName"], false, false )
guiGridListSetItemText ( loadDialog.mapsList, row, 2, res["gamemodes"], false, false )
Expand Down
7 changes: 5 additions & 2 deletions [editor]/editor_gui/client/mapsettings_gamemodesettings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ function refreshGamemodeSettings()
mapsettings.rowValues[subRow] = dataInfo.default
if currentMapSettings.newSettings and currentMapSettings.newSettings[dataName] then
mapsettings.rowValues[subRow] = currentMapSettings.newSettings[dataName]
mapsettings.gamemodeSettings = copyTable ( mapsettings.rowValues )
end

if currentMapSettings.gamemodeSettings and currentMapSettings.gamemodeSettings[subRow] then
mapsettings.rowValues[subRow] = currentMapSettings.gamemodeSettings[subRow]
end
end
if count == 0 then
Expand All @@ -58,7 +61,7 @@ function refreshGamemodeSettings()
local row = guiGridListAddRow ( mapsettings.settingsList )
guiGridListSetItemText ( mapsettings.settingsList, row, 1, "No Settings definitions", true, false )
end
currentMapSettings.newSettings = nil
mapsettings.gamemodeSettings = copyTable ( mapsettings.rowValues )
end

local requiredText = { [true]="REQUIRED" }
Expand Down
10 changes: 9 additions & 1 deletion [editor]/editor_gui/client/options_action.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ function optionsActions.elemScalingSnap(value)
optionsData.elemScalingSnap = tonumber(value)
end

function optionsActions.randomizeRotation(value)
optionsData.randomizeRotation = value
end

function optionsActions.randomizeRotationAxis(value)
optionsData.randomizeRotationAxis = value
end

function optionsActions.enableColPatch(value)
local success, isLoaded = editor_main.toggleColPatch(value)
if success then
Expand Down Expand Up @@ -170,7 +178,7 @@ function setEditorMoveSpeeds()
move_cursor.setRotateSpeeds ( dialog.slowElemRotate:getValue(), dialog.normalElemRotate:getValue(), dialog.fastElemRotate:getValue() )
move_freecam.setRotateSpeeds ( dialog.slowElemRotate:getValue(), dialog.normalElemRotate:getValue(), dialog.fastElemRotate:getValue() )

move_keyboard.setScaleIncrement ( dialog.elemScaling:getValue() )
move_keyboard.setScalingSpeeds ( dialog.slowElemScale:getValue(), dialog.normalElemScale:getValue(), dialog.fastElemScale:getValue() )

move_keyboard.toggleAxesLock ( dialog.lockToAxes:getValue() )
end
Expand Down
Loading
Loading