diff --git a/[gameplay]/hedit/client/gui/languages/arabic.lua b/[gameplay]/hedit/client/gui/languages/arabic.lua index 83f6d82f6..5f721835d 100644 --- a/[gameplay]/hedit/client/gui/languages/arabic.lua +++ b/[gameplay]/hedit/client/gui/languages/arabic.lua @@ -36,6 +36,7 @@ guiLanguage.arabic = { successSave = "تم حفظ اعدادات وزانيتك بنجاح", successLoad = "تم تحميل اعدادات وزانيتك بنجاح", + successDelete = "", wantTheSettings = "هل انت متاكد من انك تريد تطبيق هذه الاعدادات ? معدل وزانيات سيتم اعادة تشغيله", diff --git a/[gameplay]/hedit/client/gui/languages/english.lua b/[gameplay]/hedit/client/gui/languages/english.lua index 730251551..b7b73ecb4 100644 --- a/[gameplay]/hedit/client/gui/languages/english.lua +++ b/[gameplay]/hedit/client/gui/languages/english.lua @@ -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.", @@ -154,6 +155,7 @@ guiLanguage.english = { descriptionLabel = "Description", saveButton = "Save", loadButton = "Load", + deleteButton = "Delete", grid = "", nameEdit = "", descriptionEdit = "" diff --git a/[gameplay]/hedit/client/gui/languages/polish.lua b/[gameplay]/hedit/client/gui/languages/polish.lua index cb365cd23..a106f2cba 100644 --- a/[gameplay]/hedit/client/gui/languages/polish.lua +++ b/[gameplay]/hedit/client/gui/languages/polish.lua @@ -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", diff --git a/[gameplay]/hedit/client/gui/languages/russian.lua b/[gameplay]/hedit/client/gui/languages/russian.lua index 0e201b237..47266b451 100644 --- a/[gameplay]/hedit/client/gui/languages/russian.lua +++ b/[gameplay]/hedit/client/gui/languages/russian.lua @@ -36,6 +36,7 @@ successSave = "Вы успешно сохранили ваш хэндлинг!", successLoad = "Вы успешно загрузили ваш хэндлинг!", + sucessDelete = "", wantTheSettings = "Вы уверены, что хотите применить эти настройки? Редактор хэндлинга будет перезагружен.", diff --git a/[gameplay]/hedit/client/gui/languages/spanish.lua b/[gameplay]/hedit/client/gui/languages/spanish.lua index 85f831ba2..2589c63ab 100644 --- a/[gameplay]/hedit/client/gui/languages/spanish.lua +++ b/[gameplay]/hedit/client/gui/languages/spanish.lua @@ -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.", diff --git a/[gameplay]/hedit/client/gui/languages/turkish.lua b/[gameplay]/hedit/client/gui/languages/turkish.lua index 3ce90ef81..c656e1c47 100644 --- a/[gameplay]/hedit/client/gui/languages/turkish.lua +++ b/[gameplay]/hedit/client/gui/languages/turkish.lua @@ -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.", diff --git a/[gameplay]/hedit/client/gui/templates/default.lua b/[gameplay]/hedit/client/gui/templates/default.lua index 951710513..d456387ae 100644 --- a/[gameplay]/hedit/client/gui/templates/default.lua +++ b/[gameplay]/hedit/client/gui/templates/default.lua @@ -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 ) @@ -782,7 +782,7 @@ template.viewcontents = { }, saveButton = { type = "button", - pos = { 289, 334 }, + pos = { 289, 309 }, size = { 68, 25 }, events = { onClick = function ( this ) @@ -813,7 +813,7 @@ template.viewcontents = { loadButton = { type = "button", - pos = { 289, 359 }, + pos = { 289, 334 }, size = { 68, 25 }, events = { onClick = function ( this ) @@ -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 + } } } }, diff --git a/[gameplay]/hedit/client/utils.lua b/[gameplay]/hedit/client/utils.lua index eb05e8c80..ed36357e1 100644 --- a/[gameplay]/hedit/client/utils.lua +++ b/[gameplay]/hedit/client/utils.lua @@ -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