Skip to content

Commit

Permalink
Feature lockers (#22)
Browse files Browse the repository at this point in the history
* feat: Reworked locker functions

With a few icons and notification feedback.

* Fix(build): add build step for lockers

Co-authored-by: Arwyn <10365998+ArwynFr@users.noreply.github.com>

* feat(locker): Add notification on preslot change
  • Loading branch information
ImplicitDeny authored Aug 29, 2022
1 parent 0aaf048 commit 327677c
Show file tree
Hide file tree
Showing 11 changed files with 386 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ jobs:
includes: '*.paa;*.xml'
flags: '"-clear","-prefix=fr\gsri\vests"'

- name: Build GSRI Lockers
uses: team-gsri/actions-build-addon@0.1.1
with:
source: 'addons/gsri_lockers'
target: 'addons'
prefix: 'fr\gsri\lockers'


- name: Upload pbo files
uses: actions/upload-artifact@v2
with:
Expand Down
41 changes: 41 additions & 0 deletions addons/gsri_lockers/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
class CfgPatches {
class gsri_lockers {
units[]={};
requiredVersion=0.1;
requiredAddons[]={"gsri_uniforms", "gsri_vests", "gsri_headgear", "gsri_backpacks"};
author="www.gsri.team";
};
};

class CfgFunctions {
class GSRI {
class preslots {
file="fr\gsri\lockers\functions\preslots";
class getRegular {};
class getTad {};
class getMedic {};
class getOperator {};
class getAbl {};
};
class lockers {
file="fr\gsri\lockers\functions\lockers";
class setAsLocker {};
class setMedicalSkills {};
};
};
};

class CfgNotifications {
class GSRI_locker_setMedicalSkills {
title = "%1";
iconPicture = "%2";
description = "%3";
duration = 5;
};
class GSRI_locker_getPreslot {
title = "$STR_GSRI_locker_getPreslotTitle";
iconPicture = "\A3\ui_f\data\igui\cfg\simpleTasks\types\armor_ca.paa";
description = "%1";
duration = 5;
};
};
63 changes: 63 additions & 0 deletions addons/gsri_lockers/functions/lockers/fn_setAsLocker.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Author: www.gsri.team
* Set given object as a locker, including actions for :
** Arsenal, ACE and BI
** Medical skills, doctor and/or untrained
** A bunch of preslots
*
* Arguments:
* _locker : object
*
* Return Value:
* None
*
* Example:
* [myCrate] call GSRI_fnc_setAsLocker
*
* Public: No
*/

// No serverside task
if(isDedicated) exitWith {};

// Direct type of target object must be Object
params[["_locker", objNull, [objNull]]];

// If target object not defined, abort
if(isNull _locker) exitWith {};

private [
"_actionArsenalMain",
"_arsenalActions",
"_actionPreslotMain",
"_preslotsActions",
"_actionMedicalMain",
"_medicalActions"
];
_arsenalActions = [];
_preslotsActions = [];
_medicalActions = [];

// Arsenal actions
_actionArsenalMain = ["actionArsenalMain",localize "STR_GSRI_locker_arsenalMain","\A3\ui_f\data\igui\cfg\simpleTasks\types\rifle_ca.paa",{},{true}] call ace_interact_menu_fnc_createAction;
_arsenalActions pushBack (["actionArsenalACE",localize "STR_GSRI_locker_openArsenalACE","",{params ["_target", "_player"];[_target,_player,true] call ace_arsenal_fnc_openBox},{true}] call ace_interact_menu_fnc_createAction);
_arsenalActions pushBack (["actionArsenalBI",localize "STR_GSRI_locker_openArsenalBI","",{["Open",true] spawn bis_fnc_arsenal},{true}] call ace_interact_menu_fnc_createAction);

// Preslot actions
_actionPreslotMain = ["actionPreslotMain",localize "STR_GSRI_locker_preslotMain","\A3\ui_f\data\igui\cfg\simpleTasks\types\armor_ca.paa",{},{true}] call ace_interact_menu_fnc_createAction;
_preslotsActions pushBack (["actionOperator",localize "STR_GSRI_locker_gearAsOperator","",GSRI_fnc_getOperator,{true}] call ace_interact_menu_fnc_createAction);
_preslotsActions pushBack (["actionTad",localize "STR_GSRI_locker_gearAsTad","",GSRI_fnc_getTad,{true}] call ace_interact_menu_fnc_createAction);
_preslotsActions pushBack (["actionMedic",localize "STR_GSRI_locker_gearAsMedic","",GSRI_fnc_getMedic,{true}] call ace_interact_menu_fnc_createAction);
_preslotsActions pushBack (["actionRegular",localize "STR_GSRI_locker_gearAsRegular","",GSRI_fnc_getRegular,{true}] call ace_interact_menu_fnc_createAction);
_preslotsActions pushBack (["actionAbl",localize "STR_GSRI_locker_gearAsAbl","",GSRI_fnc_getAbl,{true}] call ace_interact_menu_fnc_createAction);

// Medical skills actions
_actionMedicalMain = ["actionMedicalMain",localize "STR_GSRI_locker_medicalMain","\z\ace\addons\medical_gui\ui\cross.paa",{},{true}] call ace_interact_menu_fnc_createAction;
_medicalActions pushBack (["actionNoMed",localize "STR_GSRI_locker_medicalNoMed","\fr\gsri\lockers\ui\untrained_co.paa",{[0] call GSRI_fnc_setMedicalSkills},{true}] call ace_interact_menu_fnc_createAction);
_medicalActions pushBack (["actionDoctor",localize "STR_GSRI_locker_medicalDoctor","\z\ace\addons\medical_gui\ui\cross.paa",{[2] call GSRI_fnc_setMedicalSkills},{true}] call ace_interact_menu_fnc_createAction);

// Adding tree
{ [_locker, 0, ["ACE_MainActions"], _x] call ace_interact_menu_fnc_addActionToObject } forEach [_actionArsenalMain,_actionPreslotMain,_actionMedicalMain];
{ [_locker, 0, ["ACE_MainActions", "actionArsenalMain"], _x] call ace_interact_menu_fnc_addActionToObject } forEach _arsenalActions;
{ [_locker, 0, ["ACE_MainActions", "actionPreslotMain"], _x] call ace_interact_menu_fnc_addActionToObject } forEach _preslotsActions;
{ [_locker, 0, ["ACE_MainActions", "actionMedicalMain"], _x] call ace_interact_menu_fnc_addActionToObject } forEach _medicalActions;
29 changes: 29 additions & 0 deletions addons/gsri_lockers/functions/lockers/fn_setMedicalSkills.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Author: www.gsri.team
* Set ACE medical skills. On this server, only skill 0 (untrained) and 2 (doctor) are used, skill 1 (medic) is not expected to appear here.
*
* Arguments:
* _skill : Integer, 0 or 2
*
* Return Value:
* None
*
* Example:
* [2] call GSRI_fnc_setMedicalSkill
*
* Public: No
*/

params[["_skill", -1, [0]]];

// This will filter out any number other than 0 or 2. If the argument is not an integer, the default value -1 will be used (and a script error displayed), so this line will also catch it.
if !(_skill in [0,2]) exitWith { ["Skill level %1 unknown.", _skill] call BIS_fnc_error };

// There is apparently no better way to change a player's medical skill, ACE itself does it this way.
player setVariable ["ace_medical_medicClass", _skill, true];

private _notificationData = [
[localize "STR_GSRI_locker_nowNoMed", "\fr\gsri\lockers\ui\untrained_co.paa", localize "STR_GSRI_locker_nowNoMed_description"],
[localize "STR_GSRI_locker_nowDoctor", "\z\ace\addons\medical_gui\ui\cross.paa", localize "STR_GSRI_locker_nowDoctor_description"]
] select (_skill == 2);
["GSRI_locker_setMedicalSkills", _notificationData] call BIS_fnc_showNotification;
33 changes: 33 additions & 0 deletions addons/gsri_lockers/functions/preslots/fn_getAbl.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
removeAllWeapons player;
removeAllItems player;
removeAllAssignedItems player;
removeUniform player;
removeVest player;
removeBackpack player;
removeHeadgear player;
removeGoggles player;
player addWeapon "SMA_MK18MOEOD";
player addPrimaryWeaponItem "sma_gemtech_one_wdl";
player addPrimaryWeaponItem "optic_MRCO";
player addPrimaryWeaponItem "SMA_Gripod_01";
player addWeapon "tf47_at4_heat";
player forceAddUniform "GSRI_uniform";
player addVest "GSRI_vest_carrier";
player addBackpack "GSRI_Kitbag";
for "_i" from 1 to 10 do {player addItemToUniform "ACE_quikclot";};
for "_i" from 1 to 4 do {player addItemToUniform "ACE_splint";};
for "_i" from 1 to 4 do {player addItemToUniform "ACE_tourniquet";};
for "_i" from 1 to 2 do {player addItemToUniform "ACE_morphine";};
player addItemToUniform "ACE_EarPlugs";
for "_i" from 1 to 4 do {player addItemToUniform "ACE_CableTie";};
for "_i" from 1 to 10 do {player addItemToVest "SMA_30Rnd_556x45_Mk262";};
for "_i" from 1 to 3 do {player addItemToVest "SmokeShell";};
for "_i" from 1 to 3 do {player addItemToVest "ACE_M84";};
player addItemToBackpack "A3_GPNVG18_F";
for "_i" from 1 to 2 do {player addItemToBackpack "ACE_MRE_LambCurry";};
for "_i" from 1 to 4 do {player addItemToBackpack "ACE_WaterBottle";};
player addHeadgear "milgp_h_airframe_01_RGR";
player addGoggles "G_Balaclava_blk";
player linkItem "ItemWatch";
player linkItem "TFAR_anprc152";
["GSRI_locker_getPreslot", [localize "STR_GSRI_locker_gearAsAbl"]] call BIS_fnc_showNotification;
39 changes: 39 additions & 0 deletions addons/gsri_lockers/functions/preslots/fn_getMedic.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
removeAllWeapons player;
removeAllItems player;
removeAllAssignedItems player;
removeUniform player;
removeVest player;
removeBackpack player;
removeHeadgear player;
removeGoggles player;
player addWeapon "SMA_MK18MOEOD";
player addPrimaryWeaponItem "sma_gemtech_one_wdl";
player addPrimaryWeaponItem "optic_MRCO";
player addPrimaryWeaponItem "SMA_Gripod_01";
player forceAddUniform "GSRI_uniform";
player addVest "GSRI_vest_ga_carrier";
player addBackpack "GSRI_Kitbag";
for "_i" from 1 to 10 do {player addItemToUniform "ACE_quikclot";};
for "_i" from 1 to 4 do {player addItemToUniform "ACE_splint";};
for "_i" from 1 to 4 do {player addItemToUniform "ACE_tourniquet";};
for "_i" from 1 to 2 do {player addItemToUniform "ACE_morphine";};
for "_i" from 1 to 4 do {player addItemToUniform "ACE_CableTie";};
player addItemToUniform "ACE_EarPlugs";
for "_i" from 1 to 10 do {player addItemToVest "SMA_30Rnd_556x45_Mk262";};
for "_i" from 1 to 2 do {player addItemToVest "SmokeShell";};
for "_i" from 1 to 2 do {player addItemToVest "ACE_M84";};
for "_i" from 1 to 2 do {player addItemToVest "HandGrenade";};
for "_i" from 1 to 2 do {player addItemToBackpack "ACE_MRE_LambCurry";};
for "_i" from 1 to 4 do {player addItemToBackpack "ACE_WaterBottle";};
for "_i" from 1 to 30 do {player addItemToBackpack "ACE_packingBandage";};
for "_i" from 1 to 15 do {player addItemToBackpack "ACE_salineIV_500";};
for "_i" from 1 to 10 do {player addItemToBackpack "ACE_morphine";};
for "_i" from 1 to 10 do {player addItemToBackpack "ACE_epinephrine";};
for "_i" from 1 to 10 do {player addItemToBackpack "ACE_splint";};
player addItemToBackpack "ACE_surgicalKit";
player addItemToBackpack "A3_GPNVG18_F";
player addHeadgear "GSRI_helmet_modular_advanced";
player addGoggles "G_Balaclava_blk";
player linkItem "ItemWatch";
player linkItem "TFAR_anprc152";
["GSRI_locker_getPreslot", [localize "STR_GSRI_locker_gearAsMedic"]] call BIS_fnc_showNotification;
32 changes: 32 additions & 0 deletions addons/gsri_lockers/functions/preslots/fn_getOperator.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
removeAllWeapons player;
removeAllItems player;
removeAllAssignedItems player;
removeUniform player;
removeVest player;
removeBackpack player;
removeHeadgear player;
removeGoggles player;
player addWeapon "SMA_MK18MOEOD";
player addPrimaryWeaponItem "sma_gemtech_one_wdl";
player addPrimaryWeaponItem "optic_MRCO";
player addPrimaryWeaponItem "SMA_Gripod_01";
player forceAddUniform "GSRI_uniform";
player addVest "GSRI_vest_carrier";
player addBackpack "GSRI_Kitbag";
for "_i" from 1 to 10 do {player addItemToUniform "ACE_quikclot";};
for "_i" from 1 to 4 do {player addItemToUniform "ACE_splint";};
for "_i" from 1 to 4 do {player addItemToUniform "ACE_tourniquet";};
for "_i" from 1 to 2 do {player addItemToUniform "ACE_morphine";};
player addItemToUniform "ACE_EarPlugs";
for "_i" from 1 to 4 do {player addItemToUniform "ACE_CableTie";};
for "_i" from 1 to 10 do {player addItemToVest "SMA_30Rnd_556x45_Mk262";};
for "_i" from 1 to 3 do {player addItemToVest "SmokeShell";};
for "_i" from 1 to 3 do {player addItemToVest "ACE_M84";};
player addItemToBackpack "A3_GPNVG18_F";
for "_i" from 1 to 2 do {player addItemToBackpack "ACE_MRE_LambCurry";};
for "_i" from 1 to 4 do {player addItemToBackpack "ACE_WaterBottle";};
player addHeadgear "milgp_h_airframe_01_RGR";
player addGoggles "G_Balaclava_blk";
player linkItem "ItemWatch";
player linkItem "TFAR_anprc152";
["GSRI_locker_getPreslot", [localize "STR_GSRI_locker_gearAsOperator"]] call BIS_fnc_showNotification;
14 changes: 14 additions & 0 deletions addons/gsri_lockers/functions/preslots/fn_getRegular.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
removeAllWeapons player;
removeAllItems player;
removeAllAssignedItems player;
removeUniform player;
removeVest player;
removeBackpack player;
removeHeadgear player;
removeGoggles player;
player forceAddUniform "GSRI_uniform";
player addItemToUniform "ACE_Flashlight_XL50";
player addHeadgear "GSRI_beret";
player linkItem "ItemMap";
player linkItem "TFAR_anprc152";
["GSRI_locker_getPreslot", [localize "STR_GSRI_locker_gearAsRegular"]] call BIS_fnc_showNotification;
33 changes: 33 additions & 0 deletions addons/gsri_lockers/functions/preslots/fn_getTad.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
removeAllWeapons player;
removeAllItems player;
removeAllAssignedItems player;
removeUniform player;
removeVest player;
removeBackpack player;
removeHeadgear player;
removeGoggles player;
player addWeapon "arifle_SPAR_01_blk_F";
player addPrimaryWeaponItem "muzzle_snds_M";
player addPrimaryWeaponItem "optic_MRCO";
player addPrimaryWeaponItem "bipod_01_F_blk";
player forceAddUniform "GSRI_uniform";
player addVest "GSRI_vest_ga_carrier_lite";
player addBackpack "GSRI_Kitbag";
for "_i" from 1 to 10 do {player addItemToUniform "ACE_quikclot";};
for "_i" from 1 to 4 do {player addItemToUniform "ACE_splint";};
for "_i" from 1 to 4 do {player addItemToUniform "ACE_tourniquet";};
for "_i" from 1 to 2 do {player addItemToUniform "ACE_morphine";};
for "_i" from 1 to 4 do {player addItemToUniform "ACE_CableTie";};
player addItemToUniform "ACE_EarPlugs";
for "_i" from 1 to 5 do {player addItemToVest "150Rnd_556x45_Drum_Mag_Tracer_F";};
for "_i" from 1 to 4 do {player addItemToVest "SmokeShell";};
for "_i" from 1 to 2 do {player addItemToVest "ACE_M84";};
player addItemToBackpack "A3_GPNVG18_F";
for "_i" from 1 to 4 do {player addItemToBackpack "ACE_WaterBottle";};
for "_i" from 1 to 2 do {player addItemToBackpack "ACE_MRE_LambCurry";};
for "_i" from 1 to 2 do {player addItemToBackpack "150Rnd_556x45_Drum_Mag_Tracer_F";};
player addHeadgear "GSRI_helmet_modular_advanced";
player addGoggles "G_Balaclava_blk";
player linkItem "ItemWatch";
player linkItem "TFAR_anprc152_22";
["GSRI_locker_getPreslot", [localize "STR_GSRI_locker_gearAsTad"]] call BIS_fnc_showNotification;
Loading

0 comments on commit 327677c

Please sign in to comment.