mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
88e774c30d
* Group renaming self interact * UI base * Custom UI solution (looks terrible) * Improve GUI, optimise functions * Add exitWith return value to fnc_renameGroup * tabs to spaces * Small tweaks * newlines pre-empting newline gestapo * input prompt caps * Implement suggestions * Remove already inherited value * Per-side group name handling * Add same group case sensitive changes. * Suggestions - Use ace_common_fnc_displayTextStructured - Formatting - Phrasing of strings * replace spawn with CBA_fnc_execNextFrame * Update addons/interaction/initSettings.sqf Co-authored-by: PabstMirror <pabstmirror@gmail.com> Co-authored-by: PabstMirror <pabstmirror@gmail.com>
40 lines
975 B
Plaintext
40 lines
975 B
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: Seb
|
|
* Renames a group to a given string (groupID), whilst checking that it is not an invalid name.
|
|
*
|
|
* Arguments:
|
|
* 0: The group to be renamed <GROUP>
|
|
* 1: The new name of the group <STRING>
|
|
*
|
|
* Return Value:
|
|
* Whether the group was succesfully renamed <BOOL>
|
|
*
|
|
* Example:
|
|
* [group player, "leet squad"] call ace_interaction_fnc_renameGroup
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params [
|
|
["_group", grpNull, [grpNull]],
|
|
["_newName", "", [""]]
|
|
];
|
|
if (_newName isEqualTo (groupID _group)) exitWith {true};
|
|
|
|
private _lowerName = toLower _newName; // Case insensitive name search
|
|
private _nameAlreadyTaken = allGroups findIf {
|
|
side _x isEqualTo side _group
|
|
&& {_lowerName isEqualTo toLower (groupID _x)}
|
|
&& {_group != _x}
|
|
} != -1;
|
|
|
|
|
|
if (_nameAlreadyTaken) then {
|
|
[LLSTRING(RenameGroupAlreadyExists)] call EFUNC(common,displayTextStructured);
|
|
} else {
|
|
_group setGroupIdGlobal [_newName];
|
|
};
|
|
|
|
!_nameAlreadyTaken
|