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

Add: Explosive open door #1257

Merged
merged 4 commits into from
Dec 10, 2021
Merged
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
5 changes: 4 additions & 1 deletion =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/compile.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ if (isServer) then {

//DOOR
btc_door_fnc_lock = compileScript ["core\fnc\door\lock.sqf"];
btc_door_fnc_get = compileScript ["core\fnc\door\get.sqf"];

//EH
btc_eh_fnc_server = compileScript ["core\fnc\eh\server.sqf"];
Expand Down Expand Up @@ -237,6 +238,9 @@ btc_chem_fnc_damage = compileScript ["core\fnc\chem\damage.sqf"];
btc_chem_fnc_deconShowerAnimLarge = {(_this select 0) setVariable ["BIN_Shower_Stop",false]; _this call BIN_fnc_deconShowerAnimLarge;};
btc_chem_fnc_damageLoop = compileScript ["core\fnc\chem\damageLoop.sqf"];

//DOOR
btc_door_fnc_broke = compileScript ["core\fnc\door\broke.sqf"];

//DEBUG
btc_debug_fnc_message = compileScript ["core\fnc\debug\message.sqf"];

Expand Down Expand Up @@ -315,7 +319,6 @@ if (!isDedicated) then {

//DOOR
btc_door_fnc_break = compileScript ["core\fnc\door\break.sqf"];
btc_door_fnc_broke = compileScript ["core\fnc\door\broke.sqf"];

//IED
btc_ied_fnc_effects = compileScript ["core\fnc\ied\effects.sqf"];
Expand Down
3 changes: 2 additions & 1 deletion =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/door/break.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ if (_door isEqualTo "") exitWith {
[player, objNull, ["isnotinside"]] call ace_common_fnc_canInteractWith
}, {
params ["_args"];
playSound3D ["\z\ace\addons\logistics_wirecutter\sound\wirecut.ogg", player];
_args call btc_door_fnc_broke;
}, {}, [_house, _door]] call CBA_fnc_progressBar;
}, {}, [_house, _door, player, 0.2]] call CBA_fnc_progressBar;
14 changes: 10 additions & 4 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/door/broke.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Description:
Parameters:
_house - House. [Object]
_door - Door name. [String]
_instigator - Who broke the door. [Object]
_phase - Range 0 (start point of the animation) to 1 (end point of the animation). [Number]
_speed - Boolean or Number: When true animation is instant. Since Arma 3 v1.66 Number > 0 is treated as config speed value multiplier.

Returns:

Expand All @@ -23,12 +26,15 @@ Author:

params [
["_house", objNull, [objNull]],
["_door", "", [""]]
["_door", "", [""]],
["_player", player, [objNull]],
["_phase", 1, [0]],
["_speed", false, [0, true]]
];
if (_door isEqualTo "") exitWith {};

_house setVariable [format ["bis_disabled_%1", _door], 0, true];
playSound3D ["\z\ace\addons\logistics_wirecutter\sound\wirecut.ogg", player];
[btc_rep_malus_breakDoor, player] remoteExecCall ["btc_rep_fnc_change", 2];
[btc_rep_malus_breakDoor, _player] remoteExecCall ["btc_rep_fnc_change", 2];

private _getDoorAnimations = [_house, _door] call ace_interaction_fnc_getDoorAnimations;
_getDoorAnimations params ["_animations"];
Expand All @@ -41,5 +47,5 @@ if (typeOf _house == "Land_Carrier_01_island_01_F") then {
};
// do incremental door opening
{
_house animate [_x, 0.2];
_house animate [_x, _phase, _speed];
} forEach _animations;
56 changes: 56 additions & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/door/get.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

/* ----------------------------------------------------------------------------
Function: btc_door_fnc_get

Description:
Get door infront of an object.

Parameters:
_distance - Distance to check intersect. [Number]
_object - From which ojects. [Object]
_offset - Off set for explosive. [Number]

Returns:

Examples:
(begin example)
[2] call btc_door_fnc_get;
(end)

Author:
commy2

---------------------------------------------------------------------------- */

params [
"_distance",
["_object", cameraOn, [objNull]],
["_offset", 0, [0]]
];

private _position0 = _object modelToWorld [0, 0, _offset];
private _position1 = _object modelToWorld [0, _distance, _offset];

private _intersections = lineIntersectsSurfaces [AGLToASL _position0, AGLToASL _position1, _object, objNull, true, 1, "GEOM"];

if (_intersections isEqualTo []) exitWith {[objNull, ""]};

private _house = _intersections select 0 select 2;

// shithouse is bugged
if (typeOf _house == "") exitWith {[objNull, ""]};

_intersections = [_house, "GEOM"] intersect [_position0, _position1];

private _door = toLower (_intersections select 0 select 0);

if (isNil "_door") exitWith {[_house, ""]};

//Check if door is glass because then we need to find the proper location of the door so we can use it
if ((_door find "glass") != -1) then {
_door = [_distance, _house, _door] call ace_interaction_fnc_getGlassDoor;
};

if (isNil "_door") exitWith {[_house, ""]};

[_house, _door]
9 changes: 9 additions & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/eh/server.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ addMissionEventHandler ["BuildingChanged", btc_rep_fnc_buildingchanged];
[btc_rep_malus_player_respawn, _player] call btc_rep_fnc_change;
}] call CBA_fnc_addEventHandler;

["ace_explosives_detonate", {
params ["_player", "_explosive", "_delay"];
[
btc_door_fnc_broke,
([3, _explosive, 0.5] call btc_door_fnc_get) + [_player, 1, 2],
_delay
] call CBA_fnc_waitAndExecute;
}] call CBA_fnc_addEventHandler;

addMissionEventHandler ["HandleDisconnect", {
params ["_headless"];
if (_headless in (entities "HeadlessClient_F")) then {
Expand Down
2 changes: 1 addition & 1 deletion =BTC=co@30_Hearts_and_Minds.Altis/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
<Chinesesimp>上锁的门</Chinesesimp>
</Key>
<Key ID="STR_BTC_HAM_DOC_DOOR_TEXT">
<Original>&lt;img image='\A3\ui_f\data\igui\cfg\simpleTasks\types\meet_ca.paa' width='20' height='20'/&gt; &lt;marker name='blufor_base'&gt;House doors:&lt;/marker&gt;&lt;br/&gt; Civilian house door can be close. Depend on reputation level, civilian will lock their door and stay inside. Under low, all doors are locked, above normal, all door are unlocked. &lt;br/&gt;&lt;br/&gt; &lt;img image='\A3\Ui_f\data\IGUI\Cfg\Actions\open_door_ca.paa' width='20' height='20'/&gt; &lt;marker name='blufor_base'&gt;Break locked door:&lt;/marker&gt;&lt;br/&gt; You can still enter by breaking door lock with a wirecutter. &lt;img image='\z\ace\addons\logistics_wirecutter\ui\item_wirecutter_ca.paa' width='355' height='200'/&gt;</Original>
<Original>&lt;img image='\A3\ui_f\data\igui\cfg\simpleTasks\types\meet_ca.paa' width='20' height='20'/&gt; &lt;marker name='blufor_base'&gt;House doors:&lt;/marker&gt;&lt;br/&gt; Civilian house door can be close. Depend on reputation level, civilian will lock their door and stay inside. Under low, all doors are locked, above normal, all door are unlocked. &lt;br/&gt;&lt;br/&gt; &lt;img image='\A3\Ui_f\data\IGUI\Cfg\Actions\open_door_ca.paa' width='20' height='20'/&gt; &lt;marker name='blufor_base'&gt;Break locked door:&lt;/marker&gt;&lt;br/&gt; You can still enter by breaking door lock with a wirecutter. &lt;img image='\z\ace\addons\logistics_wirecutter\ui\item_wirecutter_ca.paa' width='355' height='200'/&gt; Or by using explosive.</Original>
<Chinesesimp>&lt;img image='\A3\ui_f\data\igui\cfg\simpleTasks\types\meet_ca.paa' width='20' height='20'/&gt; &lt;marker name='blufor_base'&gt;屋门:&lt;/marker&gt;&lt;br/&gt; 平民居住的房屋可能会锁门。基于声誉水平, 平民将会锁上他们的屋门并待在屋里。在声誉低时, 所有屋门均会上锁, 在声誉一般时, 所有屋门均不会上锁。&lt;br/&gt;&lt;br/&gt; &lt;img image='\A3\Ui_f\data\IGUI\Cfg\Actions\open_door_ca.paa' width='20' height='20'/&gt; &lt;marker name='blufor_base'&gt;撬锁:&lt;/marker&gt;&lt;br/&gt; 你仍然可以使用剪线钳来撬锁, 从而进入房屋。&lt;img image='\z\ace\addons\logistics_wirecutter\ui\item_wirecutter_ca.paa' width='355' height='200'/&gt;</Chinesesimp>
</Key>
</Container>
Expand Down
2 changes: 1 addition & 1 deletion docs/InGame-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ You can detect the origin of electromagnetic field with spectrum devices. The am
### House doors:
Civilian house door can be close. Depend on reputation level, civilian will lock their door and stay inside. Under low, all doors are locked, above normal, all door are unlocked.
### Break locked door:
You can still enter by breaking door lock with a wirecutter.
You can still enter by breaking door lock with a wirecutter. Or by using explosive.

## Vehicles
### Respawn:
Expand Down