Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file added CO_MCC_SANDBOX_V153.IsolaDiCapraia.pbo
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added CO_MCC_SANDBOX_V153.IsolaDiCapraia/Sounds/pig.ogg
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//by Bon_Inf*
#include "dialog\definitions.sqf"
disableSerialization;

private ['_splashpos'];

_requestor = player;
_dlg = findDisplay BON_ARTY_DIALOG;

arti_already_adjusting = true;

// read out the dialog input
_spotter_xpos = (parseNumber ctrlText (_dlg displayCtrl BON_ARTY_XRAYEDIT)) mod 100000;
_spotter_ypos = (parseNumber ctrlText (_dlg displayCtrl BON_ARTY_YANKEEEDIT)) mod 100000;
_degrees = (parseNumber ctrlText (_dlg displayCtrl BON_ARTY_DIRECTION)) mod 360;
_distance = abs (parseNumber ctrlText (_dlg displayCtrl BON_ARTY_DISTANCE));
_height_disp = abs sliderPosition BON_ARTY_HEIGHT;
_firedelay = abs (parseNumber ctrlText (_dlg displayCtrl BON_ARTY_DELAYEDIT));
_x_correction = parseNumber ctrlText (_dlg displayCtrl BON_ARTY_XCORRECTION);
_y_correction = parseNumber ctrlText (_dlg displayCtrl BON_ARTY_YCORRECTION);

arty_LastData = [_spotter_xpos,_spotter_ypos,_degrees,_distance,_height_disp,_firedelay];

_splashpos = _requestor getVariable "Arti_adj_splashpos";
if(isNil "_splashpos") then{
_splashpos = [_spotter_xpos,_spotter_ypos,_degrees,_distance,_height_disp] call arti_func_getSplashPos;
_splashpos = [(_splashpos select 0) + 25 - random 50,(_splashpos select 1) + 25 - random 50,_splashpos select 2];
};

_modelpos = _requestor worldToModel _splashpos;
_modelpos = [(_modelpos select 0) + _x_correction, (_modelpos select 1) + _y_correction, _modelpos select 2];
_splashpos = _requestor modelToWorld _modelpos;
_requestor setVariable ["Arti_adj_splashpos",_splashpos,false];

closeDialog 0;

sleep (15 + random 5);
_adjustround = "SmokeShellRed" createVehicle [_splashpos select 0,_splashpos select 1,0];
sleep 3;
deleteVehicle _adjustround;
sleep 20;
arti_already_adjusting = false;

if(true) exitWith{};
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//by Bon_Inf*

_requestor = _this;

[playerSide,"HQ"] sideChat "Fire Mission canceled";
CloseDialog 0;

// clean up
Server setVariable [format["Arti_%1_requestor",playerSide],ObjNull,true];
_requestor setVariable ["requesting_cannons",nil,true];

for "_i" from 1 to HW_Arti_CannonNumber do {
_requestor setVariable [format["Arti_%2_Cannon%1",_i,playerSide],nil,true];
_requestor setVariable [format["Arti_%2_Cannon%1summary",_i,playerSide],nil,false];
};

arty_LastData = nil;
_requestor setVariable ["Arti_adj_splashpos",nil,false];


if(true) exitWith{};
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//by Bon_Inf*
#include "dialog\definitions.sqf"
disableSerialization;

_dlg = findDisplay BON_ARTY_DIALOG;
_listbox = _dlg displayCtrl BON_ARTY_CANNONLIST;

_requestor = player;

_req_cannons = player getVariable "requesting_cannons";
_cannons_to_clear = _req_cannons;
_cannons_cleared = [];
{
_cannons_to_clear = _cannons_to_clear - [_x+1];
_cannons_cleared = _cannons_cleared + [_x+1];

_old_conf = _requestor getVariable format["Arti_%2_Cannon%1",_x+1,playerSide];
if(not isNil "_old_conf") then{
_old_shells = _old_conf select 3;
arty_CurrNrShellsTotal = arty_CurrNrShellsTotal - _old_shells;
};

_requestor setVariable [format["Arti_%2_Cannon%1Summary",_x+1,playerSide],nil,false];
_requestor setVariable [format["Arti_%2_Cannon%1",_x+1,playerSide],nil,true];
} foreach lbSelection _listbox;
_requestor setVariable ["requesting_cannons",_cannons_to_clear,true];

ctrlSetText [BON_ARTY_SUMMARY,format["\n\nCannons %1 resetted.",_cannons_cleared]];

if(arty_CurrNrShellsTotal > (Server getVariable format["Arti_%1_shellsleft",playerSide])) then{
ctrlEnable [BON_ARTY_REQUESTBUTTON,false];
(_dlg displayCtrl BON_ARTY_SHELLSLEFT) ctrlSetTextColor [1,0,0,1];
} else{
ctrlEnable [BON_ARTY_REQUESTBUTTON,true];
(_dlg displayCtrl BON_ARTY_SHELLSLEFT) ctrlSetTextColor [1,1,1,1];
};

if(true) exitwith{};
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//by Bon_Inf*
#include "dialog\definitions.sqf"
disableSerialization;

_correctionunit = 1; // amount of metres set by clicking on the arrows

switch _this do {
case "Left" : {
arty_xcorrection = arty_xcorrection - _correctionunit;
ctrlSetText [BON_ARTY_XCORRECTION, str arty_xcorrection];
};
case "Right" : {
arty_xcorrection = arty_xcorrection + _correctionunit;
ctrlSetText [BON_ARTY_XCORRECTION, str arty_xcorrection];
};
case "Down" : {
arty_ycorrection = arty_ycorrection - _correctionunit;
ctrlSetText [BON_ARTY_YCORRECTION, str arty_ycorrection];
};
case "Up" : {
arty_ycorrection = arty_ycorrection + _correctionunit;
ctrlSetText [BON_ARTY_YCORRECTION, str arty_ycorrection];
};
};


if(true) exitWith{};
88 changes: 88 additions & 0 deletions CO_MCC_SANDBOX_V153.IsolaDiCapraia/bon_artillery/bon_arti_fire.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
//by Bon_Inf*

if(not isServer) exitWith{};

private ['_lasertarget'];

_requestor = _this select 0;
_side = _this select 1;

_cannons_to_fire = _requestor getVariable "requesting_cannons";
_cannons_available = _cannons_to_fire;

{//foreach _cannons_to_fire
_available = Server getVariable format["Arti_%2_Cannon%1_available",_x,_side];

if(_available) then{
_cannonsetup = _requestor getVariable format["Arti_%2_Cannon%1",_x,_side];
Server setVariable [format["Arti_%2_Cannon%1_available",_x,_side],false,true];

[_x,_cannonsetup,_requestor] spawn {
_cannon = _this select 0;
_splashpos = (_this select 1) select 0;
_firedelay = (_this select 1) select 1;
_artitype = (_this select 1) select 2;
_nrshells = (_this select 1) select 3;
_spread = (_this select 1) select 4;

_requestor = _this select 2;
_side = side _requestor;
_requestor setVariable [format["Arti_%2_Cannon%1",_cannon,_side],nil,true];
_requestor setVariable [format["Arti_%2_Cannon%1summary",_cannon,_side],nil,true];

_shellsleft = Server getVariable format["Arti_%1_shellsleft",_side];
Server setVariable [format["Arti_%1_shellsleft",_side],_shellsleft - _nrshells, true];

sleep (15 + (random 5) + _firedelay);

for "_i" from 1 to _nrshells do {

_lasertarget = _requestor call arti_func_getLaser;
if(_spread < 0 && isNull _lasertarget) exitWith{};
if(_spread < 0) then{_splashpos = getPos _lasertarget};

_bomb = _artitype createVehicle [(_splashpos select 0) + _spread - random (2*_spread),(_splashpos select 1) + _spread - random (2*_spread),100];
_bomb spawn {
_bomb = _this;
_soundsource = "HeliHEmpty" createVehicle position _bomb;
WaitUntil{(position _bomb select 2)<30};
_soundsource setPos position _bomb;
_soundsource setVehicleInit format["this say 'bon_Shell_In_v0%1'",[1,2,3,4,5,6,7] select round random 6];
processInitCommands;
sleep 5;
deleteVehicle _soundsource;
};

if(_artitype == "G_40mm_HE") then{ // DPICM
[_bomb,_artitype,getPos _bomb] spawn {
_bmb = _this select 0;
_artype = _this select 1;
_pos = _this select 2;
WaitUntil{isNull _bmb};
for "_j" from 1 to round random 5 do {
_clusterb = _artype createVehicle [(_pos select 0) + 5 - random 10,(_pos select 1) + 5 - random 10,20];
sleep (0.5 + random 1);
};
};
};
sleep (7.5 + random 10);
};

sleep (30 * _nrshells);
Server SetVariable [format["Arti_%2_Cannon%1_available",_cannon,_side],true,true];
};
}
else {_cannons_available = _cannons_available - [_x]};
} foreach _cannons_to_fire;

for "_i" from 1 to HW_Arti_CannonNumber do {
if(not (_i in _cannons_to_fire)) then{
_requestor setVariable [format["Arti_%2_Cannon%1",_i,_side],nil,true];
_requestor setVariable [format["Arti_%2_Cannon%1summary",_i,_side],nil,true];
};
};

if(true) exitWith{
_requestor setVariable ["requesting_cannons",nil,true];
Server setVariable [format["Arti_%1_requestor",_side],ObjNull,true];
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
//by Bon_Inf*

if(not isServer) exitWith{};

private ['_lasertarget'];

_requestor = _this select 0;
_side = _this select 1;

_cannons_to_fire = _requestor getVariable "requesting_cannons";
_cannons_available = _cannons_to_fire;


{//foreach _cannons_to_fire
_available = Server getVariable format["Arti_%2_Cannon%1_available",_x,_side];
if(_available) then{
_cannonsetup = _requestor getVariable format["Arti_%2_Cannon%1",_x,_side];
Server setVariable [format["Arti_%2_Cannon%1_available",_x,_side],false,true];

[_x,_cannonsetup,_requestor] spawn {
_cannon = _this select 0;
_splashpos = (_this select 1) select 0;
_firedelay = (_this select 1) select 1;
_artitype = (_this select 1) select 2;
_nrshells = (_this select 1) select 3;
_spread = (_this select 1) select 4;

_requestor = _this select 2;
_side = side _requestor;
_requestor setVariable [format["Arti_%2_Cannon%1",_cannon,_side],nil,true];
_requestor setVariable [format["Arti_%2_Cannon%1summary",_cannon,_side],nil,true];

_shellsleft = Server getVariable format["Arti_%1_shellsleft",_side];
Server setVariable [format["Arti_%1_shellsleft",_side],_shellsleft - _nrshells, true];

sleep (15 + (random 5) + _firedelay);

for "_i" from 1 to _nrshells do {

_lasertarget = _requestor call arti_func_getLaser;
if(_spread < 0 && isNull _lasertarget) exitWith{};
if(_spread < 0) then{_splashpos = getPos _lasertarget};

/*******************************************************************************************************************/
/*******************************************************************************************************************/
/*******************************************************************************************************************/

// for further work
// code written here will be assigned to each cannon that was requested to fire and is available as such.

// you have the following information:
// "_splashpos" the 3d-position where artillery should go down
// "_artitype" the type of artillery that is also defined in the "HW_arti_types" array in the bon_arti_init.sqf
// "_spread" an integer representing the size of the area in meters that has to be covered by artillery







// once finished replace the bon_arti_fire.sqf with this file


/*******************************************************************************************************************/
/*******************************************************************************************************************/
/*******************************************************************************************************************/
sleep (7.5 + random 10);
};

sleep (30 * _nrshells);
Server SetVariable [format["Arti_%2_Cannon%1_available",_cannon,_side],true,true];
};
}
else {_cannons_available = _cannons_available - [_x]};
} foreach _cannons_to_fire;

for "_i" from 1 to HW_Arti_CannonNumber do {
if(not (_i in _cannons_to_fire)) then{
_requestor setVariable [format["Arti_%2_Cannon%1",_i,_side],nil,true];
_requestor setVariable [format["Arti_%2_Cannon%1summary",_i,_side],nil,true];
};
};


if(true) exitWith{
_requestor setVariable ["requesting_cannons",nil,true];
Server setVariable [format["Arti_%1_requestor",_side],ObjNull,true];
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//by Bon_Inf*
#include "dialog\definitions.sqf"
disableSerialization;

private ['_arti_settings'];

_arti_settings = player getVariable format["Arti_%2_Cannon%1Summary",(lbCurSel BON_ARTY_CANNONLIST)+1,playerSide];
if(not isNil "_arti_settings") then{
ctrlSetText [BON_ARTY_SUMMARY,_arti_settings];
} else {
ctrlSetText [BON_ARTY_SUMMARY,""];
};

true
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//by Bon_Inf*
// INPUT: x-coord, y-coord, direction, distance, height difference
// OUTPUT: the vector of [x-coord,y-coord] + distance in the direction

_xpos = _this select 0;
_ypos = _this select 1;
_dir = _this select 2;
_dist = _this select 3;
_height = _this select 4;


// using Pythagoras' a^2+b^2=c^2 to compensate height dispersion
_actualdistance = sqrt (_dist^2 - _height^2);

// getting what we want:
_newpos = [round (_xpos + _actualdistance*sin(_dir)), round (_ypos + _actualdistance*cos(_dir)),0];


_newpos
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//by Bon_Inf*
/** returns the laser target the _unit is lasering at, or ObjNull if it does not exist **/

private ["_xpos","_ypos","_myLaserTarget","_lasertargets","_dir","_distance","_min","_target","_targetpos","_targetdistance","_aimpos"];
_unit = _this;
_threshold = 100;

_lasertargets = nearestObjects[_unit,["LaserTarget"],2000];
if(count _lasertargets == 0) exitWith{ObjNull};

_xpos = getPos _unit select 0;
_ypos = getPos _unit select 1;

_myLaserTarget = ObjNull;

_dir = getDir _unit;
//_dir = _unit weaponDirection "Laserdesignator";
//_dir = (_dir select 0) atan2 (_dir select 1); // get direction of the lasermarker aiming at

_distance = _threshold * 2;
_min = _threshold * 2;

for "_i" from 0 to (count _lasertargets - 1) do{
_target = _lasertargets select _i;
_targetpos = [getPos _target select 0,getPos _target select 1,0];

_targetdistance = _targetpos distance [getPos _unit select 0, getPos _unit select 1, 0];

_aimpos = [_xpos + _targetdistance*sin(_dir), _ypos + _targetdistance*cos(_dir),0];

if((_targetpos distance _aimpos)<_min) then{
_myLaserTarget=_target;
_min = _targetpos distance _aimpos;
};
};

if(_min > _threshold) then{_myLaserTarget = ObjNull};

_myLaserTarget
Loading