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

Overpressure - Add editor range attribute for vehicles #10411

Merged
merged 33 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1848969
feat: overpressure settings
bluefieldcreator Oct 13, 2024
10c1601
fix: stuff
bluefieldcreator Oct 13, 2024
e19ee0e
feat: overpressure slider
bluefieldcreator Oct 13, 2024
365877e
style: remove macro padding
bluefieldcreator Oct 13, 2024
db5bdee
doc: fix typo
bluefieldcreator Oct 13, 2024
93cf975
lint: fix tabs
bluefieldcreator Oct 13, 2024
791022c
refactor: switch slider attribute to text attribute & add -1 check.
bluefieldcreator Oct 13, 2024
1f613f0
fix: change to localized strings
bluefieldcreator Oct 13, 2024
6285a18
fix: typo
bluefieldcreator Oct 13, 2024
dcbedf0
Update addons/overpressure/functions/fnc_firedEHOP.sqf
bluefieldcreator Oct 13, 2024
b10cd76
Update addons/overpressure/functions/fnc_firedEHOP.sqf
bluefieldcreator Oct 13, 2024
92b8b8b
Update addons/overpressure/functions/fnc_firedEHOP.sqf
bluefieldcreator Oct 13, 2024
1cb0ce0
Update addons/overpressure/functions/fnc_firedEHOP.sqf
bluefieldcreator Oct 13, 2024
c2273e9
Update addons/overpressure/functions/fnc_firedEHOP.sqf
bluefieldcreator Oct 13, 2024
9f85f2c
feat: rename CfgEden
bluefieldcreator Oct 13, 2024
0c3cc8f
Merge branch 'master' of github.com:anomia-org/ACE3
bluefieldcreator Oct 13, 2024
b6aae55
Rename: part 1
bluefieldcreator Oct 13, 2024
21c892a
Rename: Part 2
bluefieldcreator Oct 13, 2024
9865705
Update addons/overpressure/CfgEden.hpp
bluefieldcreator Oct 13, 2024
07df160
Update addons/overpressure/functions/fnc_firedEHOP.sqf
bluefieldcreator Oct 13, 2024
bdef984
Update fnc_firedEHOP.sqf
bluefieldcreator Oct 13, 2024
2ae3b15
Update addons/overpressure/functions/fnc_firedEHOP.sqf
bluefieldcreator Oct 14, 2024
773eab5
Update addons/overpressure/functions/fnc_firedEHOP.sqf
bluefieldcreator Oct 14, 2024
0c18cc6
Merge branch 'acemod:master' into master
bluefieldcreator Oct 19, 2024
8525e82
Update config.cpp
bluefieldcreator Oct 19, 2024
e1ee573
Update AUTHORS.txt
bluefieldcreator Oct 19, 2024
965429f
Update addons/overpressure/functions/fnc_firedEHOP.sqf
bluefieldcreator Oct 19, 2024
144bdd6
Update addons/overpressure/CfgEden.hpp
bluefieldcreator Oct 19, 2024
6b963d9
Update addons/overpressure/functions/fnc_firedEHOP.sqf
bluefieldcreator Oct 19, 2024
152115a
Update fnc_firedEHOP.sqf
bluefieldcreator Oct 19, 2024
f5d7dc4
Merge branch 'acemod:master' into master
bluefieldcreator Oct 20, 2024
7102c9c
Update fnc_firedEHOP.sqf
bluefieldcreator Oct 20, 2024
5fd440f
Merge branch 'acemod:master' into master
bluefieldcreator Oct 21, 2024
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
38 changes: 5 additions & 33 deletions addons/overpressure/cfgEden.hpp
LinkIsGrim marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,46 +1,18 @@
class Cfg3DEN {
class Attributes {
class Slider;
class GVAR(slider): Slider {
attributeLoad = "params [""_ctrlGroup""];\
private _slider = _ctrlGroup controlsGroupCtrl 100;\
private _edit = _ctrlGroup controlsGroupCtrl 101;\
_slider sliderSetPosition _value;\
_edit ctrlSetText ([_value, 1, 1] call CBA_fnc_formatNumber);";
attributeSave = "params [""_ctrlGroup""];\
sliderPosition (_ctrlGroup controlsGroupCtrl 100); ";
onLoad = "params [""_ctrlGroup""];\
private _slider = _ctrlGroup controlsGroupCtrl 100;\
private _edit = _ctrlGroup controlsGroupCtrl 101;\
_slider sliderSetRange [0, 10];\
_slider ctrlAddEventHandler [""SliderPosChanged"", {\
params [""_slider""];\
private _edit = (ctrlParentControlsGroup _slider) controlsGroupCtrl 101;\
private _value = sliderPosition _slider;\
_edit ctrlSetText ([_value, 1, 1] call CBA_fnc_formatNumber);\
}];\
_edit ctrlAddEventHandler [""KillFocus"", {\
params [""_edit""];\
private _slider = (ctrlParentControlsGroup _edit) controlsGroupCtrl 100;\
private _value = ((parseNumber ctrlText _edit) min 10) max 0;\
_slider sliderSetPosition _value;\
_edit ctrlSetText ([_value, 1, 1] call CBA_fnc_formatNumber);\
}];";
};
};
class Object {
class AttributeCategories {
class ace_attributes {
class Attributes {
class GVAR(overPressureDistanceSetting) {
property = QUOTE(overpressureDistanceCoefficient);
control = QGVAR(slider);
displayName = CSTRING(Overpressure_distanceCoefficient_displayName);
bluefieldcreator marked this conversation as resolved.
Show resolved Hide resolved
tooltip = CSTRING(Overpressure_distanceCoefficient_toolTip);
expression = QUOTE(if (_value >= 0.1) then {_this setVariable [ARR_3(QQEGVAR(overpressure,distance),_value,true)]});// Will return <null> if the slider is not set. NEEDS CHECKING!
property = QUOTE(overpressureDistanceCoefficient);
control = "Edit";
expression = QUOTE(_this setVariable [ARR_3(QQEGVAR(overpressure,distance),_value,true)]);
defaultValue = -1;
validate = "number";
typeName = "NUMBER";
condition = "objectVehicle";
defaultValue = 0;
};
};
};
Expand Down
7 changes: 5 additions & 2 deletions addons/overpressure/functions/fnc_firedEHOP.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ private _opValues = [_weapon, _ammo, _magazine] call FUNC(getOverPressureValues)

_opValues params ["_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"];

private _unitCoef = _unit getVariable [QEGVAR(overpressure,distance), GVAR(overpressureDistanceCoefficient)]; // Because object attribute slider is <null> we fall back to server settings.
private _unitOverpressureRangeAttribute = _unit getVariable QEGVAR(overpressure,distance);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will be undefined for most cases

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the editor attribute set it to -1 because of default value?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private _unitOverpressureRangeAttribute = _unit getVariable QEGVAR(overpressure,distance);
private _unitOverpressureRangeAttribute = _unit getVariable [QEGVAR(overpressure,distance), -1];

in any case


// If -1 (disabled) we return to server value, otherwise we use the given value.
if(_unitOverpressureRangeAttribute == -1) then { _unitOverpressureRangeAttribute = GVAR(overpressureDistanceCoefficient); };
bluefieldcreator marked this conversation as resolved.
Show resolved Hide resolved

_dangerZoneRange = _dangerZoneRange * _unitCoef;

_dangerZoneRange = _dangerZoneRange * _unitOverpressureRangeAttribute;

TRACE_3("cache",_dangerZoneAngle,_dangerZoneRange,_dangerZoneDamage);
bluefieldcreator marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
Loading