Skip to content

Commit

Permalink
Gemeinsame Servermod für Livonia und Virolathi
Browse files Browse the repository at this point in the history
Gemeinsame Servermod für Livonia und Virolathi
  • Loading branch information
formtapez authored May 13, 2021
2 parents d50c05a + 38a1fe2 commit eef871c
Show file tree
Hide file tree
Showing 6 changed files with 171 additions and 153 deletions.
33 changes: 17 additions & 16 deletions addons/main/GELDZEIT/fn_clientInitcbaclassevents.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,22 @@
*/
#include "macros.hpp"

["LandVehicle", "init",
// Haftladungen (aber nicht auf der Livonia-Karte!)
if !("Enoch" isEqualTo worldName) then
{
params ["_vec"];

_vec addAction [
format["<t color=""#f0f24e"">%1</t>", MLOC(HAFTLADUNG)],
{[_this select 0] call FUNC(haftladungen)},
[],
-1,
false,
true,
'',
"_veh = vehicle _this; ((alive _target) and (speed _veh < 3) and (_veh distance _target) < 8 and vehicle player == player)"
];

}, nil, nil, true] call CBA_fnc_addClassEventHandler;

["LandVehicle", "init",
{
params ["_vec"];

_vec addAction [
format["<t color=""#f0f24e"">%1</t>", MLOC(HAFTLADUNG)],
{[_this select 0] call FUNC(haftladungen)},
[],
-1,
false,
true,
'',
"_veh = vehicle _this; ((alive _target) and (speed _veh < 3) and (_veh distance _target) < 8 and vehicle player == player)"
];
}, nil, nil, true] call CBA_fnc_addClassEventHandler;
};
38 changes: 19 additions & 19 deletions addons/main/GELDZEIT/fn_haftladungen.sqf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Description:
* Stellt Haftladungen zur verfügung
* Stellt Haftladungen zur Verfügung
*
* Author: Lord-MDB
*
Expand Down Expand Up @@ -34,38 +34,38 @@ private _pic = "A3\Weapons_F\Data\UI\gear_c4_charge_small_CA.paa";
_veh = (nearestObjects[_unit,["car","truck","tank","wheeled_apc"],8]) select 0;
_bomb = (nearestObject [_unit, 'PipeBombBase']);

//check ob Beide nötigen Dinge vorhanden sind
if (isNull _veh) exitWith {Hint format["%1",MLOC(HAFTLADUNGNOVEH)];};
if (isNull _bomb) exitWith {Hint format["%1",MLOC(HAFTLADUNGNOBOMBE)];};
// Check ob Beide nötigen Dinge vorhanden sind
if (isNull _veh) exitWith {hint format["%1",MLOC(HAFTLADUNGNOVEH)];};
if (isNull _bomb) exitWith {hint format["%1",MLOC(HAFTLADUNGNOBOMBE)];};

if ((_bomb distance _veh) > 8) exitWith {Hint format["%1",MLOC(HAFTLADUNGNOBOMBE)];};
if ((_bomb distance _veh) > 8) exitWith {hint format["%1",MLOC(HAFTLADUNGNOBOMBE)];};

//Roherfassung Objekt
private _start = AGLToASL positionCameraToWorld [0,0,0];
private _end = AGLToASL positionCameraToWorld [0,0,10];
// Roherfassung Objekt
private _start = AGLToASL positionCameraToWorld [0, 0, 0];
private _end = AGLToASL positionCameraToWorld [0, 0, 10];
private _lis = lineIntersectsSurfaces [_start, _end, _unit, objNull, true, -1];
private _intersection = _lis param [0, []] select 0;

//Check Fahrzeug gefunden wurde
if (isNil "_intersection") exitWith {Hint format["%1",MLOC(HAFTLADUNGNOVEH)];};
if (_intersection isEqualTo []) exitWith {Hint format["%1",MLOC(HAFTLADUNGNOVEH)];};
// Check ob Fahrzeug gefunden wurde
if (isNil "_intersection") exitWith {hint format["%1",MLOC(HAFTLADUNGNOVEH)];};
if (_intersection isEqualTo []) exitWith {hint format["%1",MLOC(HAFTLADUNGNOVEH)];};

//Netto Position des Fahrzeugs
// Netto Position des Fahrzeugs
private _vDir = _start vectorFromTo _end;
private _position = _intersection vectorAdd (_vDir vectorMultiply +(0.9 * abs(cos (getDir _veh + 90)))); //90cm abstand
private _position = _intersection vectorAdd (_vDir vectorMultiply + (0.9 * abs(cos(getDir _veh + 90)))); // 90 cm abstand
private _offset = _veh worldToModel ASLToAGL _position;

private _xoffset = (_offset select 0);
private _yoffset = (_offset select 1);
private _xoffset = _offset select 0;
private _yoffset = _offset select 1;
private _zoffset = _offset select 2;

// Anheften der Sprengladung mit Offset
_bomb attachTo [_veh, [_xoffset,_yoffset,_zoffset]];
_bomb attachTo [_veh, [_xoffset, _yoffset, _zoffset]];

//Ausrichten der Sprengladung
// Ausrichten der Sprengladung
private _unitdir = getDir _unit;
_bomb setVectorDirAndUp [[0,(cos (getDir _veh + 90)),0],[(cos (getDir _veh - 90 +_unitdir)),(cos (getDir _veh + 90 + _unitdir)),0]];
_bomb setVectorDirAndUp [[0, (cos(getDir _veh + 90)), 0], [(cos(getDir _veh - 90 + _unitdir)), (cos(getDir _veh + 90 + _unitdir)), 0]];

//Ausgabe an den Spieler
// Ausgabe an den Spieler
_pic = "A3\Weapons_F\Data\UI\gear_c4_charge_small_CA.paa";
hint composeText [parseText format ["<t align='left' size='%4'><img image='%3'></t>" +"<t align='center' size='1.25' shadow='true'>%1</t><t align='right' size='%4'><img image='%3'></t>" +"<br/>" +"<t align='center' size='1.0' shadow='true'>%2</t>","C4",MLOC(HAFTLADUNGATTACH),_pic,3.0]];
15 changes: 6 additions & 9 deletions addons/main/RULES/fn_clientInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
*/
#include "macros.hpp"

// Spieler wird getötet wenn er sich zu nah an eine Feindbasis wagt
#define MIN_DISTANCE_TO_ENEMYBASE 2000

// Wie oft (in Sekunden) wird die Spielerposition geprüft
#define INTERVAL_DISTANCE_CHECK 15

Expand Down Expand Up @@ -181,7 +178,7 @@
case east:
{
[{
if (((player distance2D getMarkerPos "AAF_T_Zone1") < MIN_DISTANCE_TO_ENEMYBASE) or ((player distance2D getMarkerPos "AAF_T_Zone2") < MIN_DISTANCE_TO_ENEMYBASE)) then
if ((position player inArea "AAF_T_Zone1") or (position player inArea "AAF_T_Zone2")) then
{
player setDamage 1;
[MLOC(BASE_DISTANCE)] remoteExecCall ["hint", -2];
Expand All @@ -192,7 +189,7 @@
case independent:
{
[{
if (((player distance2D getMarkerPos "CSAT_T_Zone1") < MIN_DISTANCE_TO_ENEMYBASE) or ((player distance2D getMarkerPos "CSAT_T_Zone2") < MIN_DISTANCE_TO_ENEMYBASE)) then
if ((position player inArea "CSAT_T_Zone1") or (position player inArea "CSAT_T_Zone2")) then
{
player setDamage 1;
[MLOC(BASE_DISTANCE)] remoteExecCall ["hint", -2];
Expand All @@ -209,7 +206,7 @@
case east:
{
[{
if (((player distance2D getMarkerPos "NATO_T_Zone1") < MIN_DISTANCE_TO_ENEMYBASE) or ((player distance2D getMarkerPos "NATO_T_Zone2") < MIN_DISTANCE_TO_ENEMYBASE)) then
if ((position player inArea "NATO_T_Zone1") or (position player inArea "NATO_T_Zone2")) then
{
player setDamage 1;
[MLOC(BASE_DISTANCE)] remoteExecCall ["hint", -2];
Expand All @@ -220,7 +217,7 @@
case west:
{
[{
if (((player distance2D getMarkerPos "CSAT_T_Zone1") < MIN_DISTANCE_TO_ENEMYBASE) or ((player distance2D getMarkerPos "CSAT_T_Zone2") < MIN_DISTANCE_TO_ENEMYBASE)) then
if ((position player inArea "CSAT_T_Zone1") or (position player inArea "CSAT_T_Zone2")) then
{
player setDamage 1;
[MLOC(BASE_DISTANCE)] remoteExecCall ["hint", -2];
Expand All @@ -237,7 +234,7 @@
case independent:
{
[{
if (((player distance2D getMarkerPos "NATO_T_Zone1") < MIN_DISTANCE_TO_ENEMYBASE) or ((player distance2D getMarkerPos "NATO_T_Zone2") < MIN_DISTANCE_TO_ENEMYBASE)) then
if ((position player inArea "NATO_T_Zone1") or (position player inArea "NATO_T_Zone2")) then
{
player setDamage 1;
[MLOC(BASE_DISTANCE)] remoteExecCall ["hint", -2];
Expand All @@ -248,7 +245,7 @@
case west:
{
[{
if (((player distance2D getMarkerPos "AAF_T_Zone1") < MIN_DISTANCE_TO_ENEMYBASE) or ((player distance2D getMarkerPos "AAF_T_Zone2") < MIN_DISTANCE_TO_ENEMYBASE)) then
if ((position player inArea "AAF_T_Zone1") or (position player inArea "AAF_T_Zone2")) then
{
player setDamage 1;
[MLOC(BASE_DISTANCE)] remoteExecCall ["hint", -2];
Expand Down
16 changes: 14 additions & 2 deletions addons/main/SECTORCONTROL/fn_clientinitplayereh.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,25 @@ if (GVAR(trainingon)) then

}] call BIS_fnc_addStackedEventHandler;

// Teleport funktion
player addAction [("<t color=""#f0bfbfbf"">" + ("Teleport") + "</t>"), {[] call FUNC(teleport)}, [], 0, false, true, '', "alive _target"];
player addAction ["<t color='#FF0000'>Virtual Arsenal</t>", {["Open", true] spawn BIS_fnc_arsenal;}, [], 5, false, true];

// Virtuelles Arsenal (aber nicht auf der Livonia-Karte!)
if !("Enoch" isEqualTo worldName) then
{
player addAction ["<t color='#FF0000'>Virtual Arsenal</t>", {["Open", true] spawn BIS_fnc_arsenal;}, [], 5, false, true];
};

["Respawn",
{
// Teleport funktion
player addAction [("<t color=""#f0bfbfbf"">" + ("Teleport") + "</t>"), {[] call FUNC(teleport)}, [], 0, false, true, '', "alive _target"];
player addAction ["<t color='#FF0000'>Virtual Arsenal</t>", {["Open", true] spawn BIS_fnc_arsenal;}, [], 5, false, true];

// Virtuelles Arsenal (aber nicht auf der Livonia-Karte!)
if !("Enoch" isEqualTo worldName) then
{
player addAction ["<t color='#FF0000'>Virtual Arsenal</t>", {["Open", true] spawn BIS_fnc_arsenal;}, [], 5, false, true];
};
}] call CFUNC(addEventhandler);
};

Expand Down
Loading

0 comments on commit eef871c

Please sign in to comment.