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

Better Explosive Attachment #1515

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 22 additions & 2 deletions AGM_Explosives/functions/fn_SetupExplosive.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ _this spawn {
_config = _this select 2;
_timer = _this select 3;
AGM_Explosives_placer = _unit;

// Commented out due to the fact there is a distinction between who can deactivate mines and who can plant them in standard configs.
// Would require custom config entries (AGM_ExplosiveSpecialist/AGM_Specialist) which excludes custom mods.
//if ((AGM_Explosives_RequireSpecialist > 0) && {!([_unit] call AGM_Core_fnc_isEOD)}) exitWith {};
Expand All @@ -35,13 +36,14 @@ _this spawn {

AGM_Explosives_Setup = getText(ConfigFile >> "CfgMagazines" >> _class >> "AGM_SetupObject") createVehicleLocal [0,0,-10000];

AGM_Explosives_Setup enableSimulationGlobal false;
//AGM_Explosives_Setup enableSimulationGlobal false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this not need to be uncommented?

Copy link
Author

Choose a reason for hiding this comment

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

enableSimulationGlobal false disables EpeContactStart

Copy link
Contributor

Choose a reason for hiding this comment

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

EpeContactStart only needs to be activated when the left clicking for the first time.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather have this set to false here because anything could happen in a MP environment and I'd rather avoid weird issues related to collisions.

AGM_Explosives_Setup setVariable ["AGM_Class", _class];
AGM_Explosives_Setup setVariable ["AGM_Trigger", _config];
//AGM_Explosives_Setup setVariable ["AGM_Offset", GetArray(ConfigFile >> "CfgVehicles" >> typeof AGM_Explosives_Setup >> "AGM_Offset")];
if (!isNil "_timer") then {
AGM_Explosives_Setup setVariable ["AGM_Timer", _timer];
};
AGM_Explosives_Setup setVariable ["AGM_Enable_Place", 0];

_unit forceWalk true;
AGM_Explosives_TweakedAngle = 180;
Expand All @@ -59,7 +61,25 @@ _this spawn {
AGM_Explosives_Setup setDir (AGM_Explosives_TweakedAngle + getDir _player);
};
}] call BIS_fnc_addStackedEventHandler;
AGM_Explosives_Setup addEventHandler ["EpeContactStart", {
private ["_enabled","_disable"];
AGM_Explosives_Setup = _this select 0;
_enabled = AGM_Explosives_Setup getVariable ["AGM_Enable_Place", 0];
if (_enabled == 1) then{
call AGM_Explosives_fnc_Place_Approve;
};
_disable=0;
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the purpose of this?

Copy link
Author

Choose a reason for hiding this comment

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

The return value? or the assignment?

Copy link
Contributor

Choose a reason for hiding this comment

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

both

Copy link
Author

Choose a reason for hiding this comment

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

Essentially it just disables collisions

Copy link
Contributor

Choose a reason for hiding this comment

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

The entire _enabled/_disabled code should be removed. It should simply place upon having contact.

Copy link
Author

Choose a reason for hiding this comment

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

The reason for this is to stop vehicles from freaking out if the physics-less explosive is inside the collision box and then placed/moved. Vehicles from being pushed, and any other issues that can be caused by arma physics

_disable
}];
[localize "STR_AGM_Explosives_PlaceAction", localize "STR_AGM_Explosives_CancelAction",localize "STR_AGM_Explosives_ScrollAction"] call AGM_Interaction_fnc_showMouseHint;
_unit setVariable ["AGM_Explosive_Place", [_unit, "DefaultAction", {AGM_Explosives_pfeh_running AND !isNull (AGM_Explosives_setup)}, {call AGM_Explosives_fnc_Place_Approve;}] call AGM_Core_fnc_AddActionEventHandler];
_unit setVariable ["AGM_Explosive_Place", [_unit, "DefaultAction", {AGM_Explosives_pfeh_running AND !isNull (AGM_Explosives_setup)}, {
_unit = call AGM_Core_fnc_player;
AGM_Explosives_Setup setVariable ["AGM_Enable_Place", 1];
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this extra variable. It won't be needed. You can simply set AGM_Explosives_Setup enableSimulationGlobal true; to enable EPEContact related events and everything should work fine.

AGM_Explosives_Setup enableSimulationGlobal true;
[_unit, "DefaultAction", _unit getVariable ["AGM_Explosive_Place", -1]] call AGM_Core_fnc_removeActionEventHandler;
call AGM_Interaction_fnc_hideMouseHint;
[localize "STR_AGM_Explosives_PlantAction", localize "STR_AGM_Explosives_CancelAction",localize "STR_AGM_Explosives_ScrollAction"] call AGM_Interaction_fnc_showMouseHint;
_unit setVariable ["AGM_Explosive_Place", [_unit, "DefaultAction", {AGM_Explosives_pfeh_running AND !isNull (AGM_Explosives_setup)}, {AGM_Explosives_Setup enableSimulationGlobal false; call AGM_Explosives_fnc_Place_Approve;}] call AGM_Core_fnc_AddActionEventHandler];
Copy link
Contributor

Choose a reason for hiding this comment

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

AGM_Explosives_Setup enableSimulationGlobal false; is not really needed, no point in wasting potential CPU cycles on it.

Copy link
Author

Choose a reason for hiding this comment

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

Could probably replaced with AGM_Explosives_Setup setVariable ["AGM_Enable_Place", 0];

Copy link
Contributor

Choose a reason for hiding this comment

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

Just simply remove it, no need for anything else.

}] call AGM_Core_fnc_AddActionEventHandler];
_unit setVariable ["AGM_Explosive_Cancel", [_unit, "MenuBack", {AGM_Explosives_pfeh_running AND !isNull (AGM_Explosives_setup)}, {call AGM_Explosives_fnc_Place_Cancel;}] call AGM_Core_fnc_AddActionEventHandler];
};
14 changes: 13 additions & 1 deletion AGM_Explosives/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,19 @@
<German>Platzieren</German>
<Spanish>Colocar</Spanish>
<Polish>Umieść</Polish>
<French>Placer</French>
<French>Mettre</French>
<Czech>Položit</Czech>
<Italian>Piazza</Italian>
<Hungarian>Elhelyezés</Hungarian>
<Portuguese>Colocar</Portuguese>
<Russian>Положить</Russian>
</Key>
<Key ID="STR_AGM_Explosives_PlantAction">
<English>Plant</English>
<German>Platzieren</German>
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove all non-English translations otherwise they won't be fixed.

<Spanish>Colocar</Spanish>
<Polish>Umieść</Polish>
<French>Poser</French>
<Czech>Položit</Czech>
<Italian>Piazza</Italian>
<Hungarian>Elhelyezés</Hungarian>
Expand Down