Skip to content
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

#359 Hedit delete handlings #360

Merged
merged 21 commits into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
1b5033d
Make grid a little smaller to add delete button and shift other butto…
ricksterhd123 Oct 30, 2021
483b238
Add message for successful delete (only english)
ricksterhd123 Oct 30, 2021
125b913
Create function to delete node from save file
ricksterhd123 Oct 30, 2021
b9570cb
Correct the debug messages
ricksterhd123 Oct 30, 2021
a318b2b
Add Arabic translation by [SW]Falcon
ricksterhd123 Oct 30, 2021
3653216
Add Turkish translation by ᴏᴠ | Gürkan
ricksterhd123 Oct 30, 2021
703da78
Update polish.lua
Inder00 Oct 30, 2021
c788216
Merge pull request #3 from Inder00/patch-5
ricksterhd123 Oct 30, 2021
e5ec614
Added Russian translation by Google Translate
ricksterhd123 Oct 31, 2021
76388a6
Add Spanish translation by Fantome
ricksterhd123 Oct 31, 2021
53c3f08
Refactor variable
ricksterhd123 Oct 31, 2021
62919c9
Update russian.lua
Disinterpreter Nov 2, 2021
fc3aa7c
ru fix typo
Disinterpreter Nov 2, 2021
4eb40c6
Merge pull request #4 from Disinterpreter/hedit-delete-handlings
ricksterhd123 Nov 4, 2021
038828f
Revert "Add Spanish translation by Fantome"
ricksterhd123 Nov 11, 2021
fb35128
Revert "Added Russian translation by Google Translate"
ricksterhd123 Nov 11, 2021
b38f2d5
Revert "Update polish.lua"
ricksterhd123 Nov 11, 2021
13e2a0d
Revert "Add Turkish translation by ᴏᴠ | Gürkan"
ricksterhd123 Nov 11, 2021
d11408a
Revert "Add Arabic translation by [SW]Falcon"
ricksterhd123 Nov 11, 2021
ccfe4cd
Merge remote-tracking branch 'fork/hedit-delete-handlings' into hedit…
ricksterhd123 Nov 11, 2021
d1beb87
Revert "Update russian.lua"
ricksterhd123 Nov 11, 2021
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
1 change: 1 addition & 0 deletions [gameplay]/hedit/client/gui/languages/arabic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ guiLanguage.arabic = {

successSave = "تم حفظ اعدادات وزانيتك بنجاح",
successLoad = "تم تحميل اعدادات وزانيتك بنجاح",
successDelete = "",

wantTheSettings = "هل انت متاكد من انك تريد تطبيق هذه الاعدادات ? معدل وزانيات سيتم اعادة تشغيله",

Expand Down
2 changes: 2 additions & 0 deletions [gameplay]/hedit/client/gui/languages/english.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ guiLanguage.english = {

successSave = "Successfully saved your handling settings!",
successLoad = "Successfully loaded your handling settings!",
sucessDelete = "Successfully deleted your handling settings!",

wantTheSettings = "Are you sure you would like to apply these settings? The handling editor will restart.",

Expand Down Expand Up @@ -154,6 +155,7 @@ guiLanguage.english = {
descriptionLabel = "Description",
saveButton = "Save",
loadButton = "Load",
deleteButton = "Delete",
grid = "",
nameEdit = "",
descriptionEdit = ""
Expand Down
3 changes: 2 additions & 1 deletion [gameplay]/hedit/client/gui/languages/polish.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ guiLanguage.polish = {

successSave = "Pomyslnie zapisano twoje ustawienia",
successLoad = "Pomyslnie wczytano twoje ustawienia!",

sucessDelete = "",

wantTheSettings = "Czy na pewno chcesz zastosowac te ustawienia? Edytor uruchomi sie ponownie.",

vehicle = "Pojazd",
Expand Down
1 change: 1 addition & 0 deletions [gameplay]/hedit/client/gui/languages/russian.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

successSave = "Вы успешно сохранили ваш хэндлинг!",
successLoad = "Вы успешно загрузили ваш хэндлинг!",
sucessDelete = "",

wantTheSettings = "Вы уверены, что хотите применить эти настройки? Редактор хэндлинга будет перезагружен.",

Expand Down
1 change: 1 addition & 0 deletions [gameplay]/hedit/client/gui/languages/spanish.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

successSave = "Se guardo el handling con exito!",
successLoad = "Se cargo el handling con exito!",
sucessDelete = "",

confirmVersionReset = "Estas seguro de que deseas establecer la version del editor a la de este servidor? Tus handlings guardados pueden llegar a ser incompatibles.",
successVersionReset = "La version de editor se ha actualizado.",
Expand Down
1 change: 1 addition & 0 deletions [gameplay]/hedit/client/gui/languages/turkish.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ guiLanguage.turkish = {

successSave = "Başarıyla işleme ayarlarını kurtardı!",
successLoad = "Başarıyla senin kullanımı ayarlarını yüklenen!",
sucessDelete = "",

wantTheSettings = "Bu ayarları uygulamak istiyorum emin misiniz? Taşıma editörü yeniden başlar.",

Expand Down
31 changes: 28 additions & 3 deletions [gameplay]/hedit/client/gui/templates/default.lua
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ template.viewcontents = {
grid = {
type = "gridlist",
pos = { 72, 83 },
size = { 285, 246 },
size = { 285, 220 },
runfunction = function ( this )
guiGridListAddColumn ( this, "Name", 0.5 )
guiGridListAddColumn ( this, "Model", 0.4 )
Expand Down Expand Up @@ -782,7 +782,7 @@ template.viewcontents = {
},
saveButton = {
type = "button",
pos = { 289, 334 },
pos = { 289, 309 },
size = { 68, 25 },
events = {
onClick = function ( this )
Expand Down Expand Up @@ -813,7 +813,7 @@ template.viewcontents = {

loadButton = {
type = "button",
pos = { 289, 359 },
pos = { 289, 334 },
size = { 68, 25 },
events = {
onClick = function ( this )
Expand All @@ -838,6 +838,31 @@ template.viewcontents = {
end
end
}
},

deleteButton = {
type = "button",
pos = { 289, 359 },
size = { 68, 25 },
events = {
onClick = function ( this )
local content = heditGUI.viewItems.save.guiItems
local row,col = guiGridListGetSelectedItem ( content.grid )

if row ~= -1 and col ~= -1 then
local name = string.lower ( guiGridListGetItemText ( content.grid, row, col ) )

local function func ( )
if deleteClientHandling ( pVehicle, name ) then
guiCreateWarningMessage ( getText ( "sucessDelete" ), 3 )
end
end

guiCreateWarningMessage ( getText ( "confirmDelete" ), 2, {func} )
return true
end
end
}
}
}
},
Expand Down
27 changes: 27 additions & 0 deletions [gameplay]/hedit/client/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,33 @@ function loadClientHandling ( vehicle, name )
return true
end

function deleteClientHandling ( vehicle, name )
if not isValidVehicle ( vehicle ) then
if DEBUGMODE then
error ( "Invalid vehicle element at 'deleteClientHandling'! ["..tostring(vehicle).."]", 2 )
end

return false
end

if not isClientHandlingExisting ( name ) then
if DEBUGMODE then
error ( "Handling name given at 'deleteClientHandling' does not exist! ["..tostring(name).."]", 2 )
end

return false
end

name = string.lower ( name )
local handling = xmlCache.clientsaves[name].saveNode

xmlDestroyNode ( handling )
xmlSaveFile ( xmlFile[client_handling_file] )

xmlCache.clientsaves[name] = nil

return true
end

-- Imports a handling line in handling.cfg format, given a proper method.
-- Valid methods: III, VC, SA, and IV
Expand Down