Skip to content

Commit

Permalink
Add No vehicle clan logo component (#9018)
Browse files Browse the repository at this point in the history
* Add novehicleclanlogo component

* Documentation

* Update README.md

* Use selection name from vehicle config
  • Loading branch information
veteran29 authored Sep 1, 2022
1 parent 8c249a1 commit a6ced10
Show file tree
Hide file tree
Showing 14 changed files with 154 additions and 0 deletions.
1 change: 1 addition & 0 deletions addons/novehicleclanlogo/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
z\ace\addons\novehicleclanlogo
18 changes: 18 additions & 0 deletions addons/novehicleclanlogo/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

class Extended_PreStart_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_SCRIPT(XEH_preStart));
};
};

class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_SCRIPT(XEH_preInit));
};
};

class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_SCRIPT(XEH_postInit));
};
};
4 changes: 4 additions & 0 deletions addons/novehicleclanlogo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
novehicleclanlogo
=============

Prevents clan logo from being displayed on vehicles controlled by players.
1 change: 1 addition & 0 deletions addons/novehicleclanlogo/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PREP(removeClanLogo);
14 changes: 14 additions & 0 deletions addons/novehicleclanlogo/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "script_component.hpp"

// clan logos are not used in singleplayer
if (!isMultiplayer) exitWith {};

["CBA_settingsInitialized", {
TRACE_1("settingsInit eh",GVAR(enabled));

if (isServer && {GVAR(enabled)}) then {
["LandVehicle", "initPost", LINKFUNC(removeClanLogo), true, [], true] call CBA_fnc_addClassEventHandler;
["Air", "initPost", LINKFUNC(removeClanLogo), true, [], true] call CBA_fnc_addClassEventHandler;
["Ship", "initPost", LINKFUNC(removeClanLogo), true, [], true] call CBA_fnc_addClassEventHandler;
};
}] call CBA_fnc_addEventHandler;
11 changes: 11 additions & 0 deletions addons/novehicleclanlogo/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "script_component.hpp"

ADDON = false;

PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

#include "initSettings.sqf"

ADDON = true;
3 changes: 3 additions & 0 deletions addons/novehicleclanlogo/XEH_preStart.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "script_component.hpp"

#include "XEH_PREP.hpp"
17 changes: 17 additions & 0 deletions addons/novehicleclanlogo/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "script_component.hpp"

class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
author = ECSTRING(common,ACETeam);
authors[] = {"veteran29"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
};

#include "CfgEventHandlers.hpp"
26 changes: 26 additions & 0 deletions addons/novehicleclanlogo/functions/fnc_removeClanLogo.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "script_component.hpp"
/*
* Author: veteran29
* Replaces the vehicle clan logo with an empty texture.
*
* Arguments:
* 0: Vehicle <OBJECT>
*
* Return Value:
* None
*
* Example:
* [vehicle player] call ace_novehicleclanlogo_fnc_removeClanLogo
*
* Public: Yes
*/

params ["_vehicle"];

private _selectionClan = getText (configOf _vehicle >> "selectionClan");
if !(_selectionClan in selectionNames _vehicle) exitWith {
TRACE_2("vehicle does not have 'selectionClan' selection",_vehicle,_selectionLogo);
};

TRACE_1("replacing clan logo with empty texture",_vehicle);
_vehicle setObjectTextureGlobal [_selectionClan, "#(argb,1,1,1)color(0,0,0,0)"] // return
1 change: 1 addition & 0 deletions addons/novehicleclanlogo/functions/script_component.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "\z\ace\addons\novehicleclanlogo\script_component.hpp"
11 changes: 11 additions & 0 deletions addons/novehicleclanlogo/initSettings.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
private _category = [ELSTRING(common,ACEKeybindCategoryVehicles), LSTRING(DisplayName)],;

[
QGVAR(enabled), "CHECKBOX",
[LELSTRING(common,Enabled), LSTRING(Enabled_Tooltip)],
_category,
false,
true,
{},
true
] call CBA_fnc_addSetting;
16 changes: 16 additions & 0 deletions addons/novehicleclanlogo/script_component.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#define COMPONENT novehicleclanlogo
#define COMPONENT_BEAUTIFIED No Vehicle Clan Logo
#include "\z\ace\addons\main\script_mod.hpp"

// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE

#ifdef DEBUG_ENABLED_NOVEHICLECLANLOGO
#define DEBUG_MODE_FULL
#endif

#ifdef DEBUG_ENABLED_NOVEHICLECLANLOGO
#define DEBUG_SETTINGS DEBUG_ENABLED_NOVEHICLECLANLOGO
#endif

#include "\z\ace\addons\main\script_macros.hpp"
13 changes: 13 additions & 0 deletions addons/novehicleclanlogo/stringtable.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="Novehicleclanlogo">
<Key ID="STR_ACE_Novehicleclanlogo_DisplayName">
<English>Remove clan logo from vehicles</English>
<Polish>Usuń logo klanu z pojazdów</Polish>
</Key>
<Key ID="STR_ACE_Novehicleclanlogo_Enabled_Tooltip">
<English>Prevents clan logo from being displayed on vehicles controlled by players.</English>
<Polish>Zapobiega wyświetlaniu logo klanu na pojazdach kontrolowanych przez graczy.</Polish>
</Key>
</Package>
</Project>
18 changes: 18 additions & 0 deletions docs/wiki/feature/novehicleclanlogo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
layout: wiki
title: No vehicle clan logo
component: novehicleclanlogo
description: Removes clan logo from vehicles.
group: feature
category: realism
parent: wiki
mod: ace
version:
major: 3
minor: 15
patch: 1
---

## 1. Overview

Prevents clan logo from vehicles controlled by players. Can be toggled in ACE Vehicles settings category.

0 comments on commit a6ced10

Please sign in to comment.