REsec and BIS_effects fixes from 1.7.7

This commit is contained in:
vbawol
2013-07-08 08:30:40 -05:00
parent 5201c47776
commit cc989b18d8
10 changed files with 635 additions and 297 deletions

View File

@@ -0,0 +1,143 @@
_v=_this select 0;
_int = (fuel _v)*(8+random 2);
_t=time;
if !(isDedicated) then { //dw, particle stuff don't need run on dedicated
_fl = "#particlesource" createVehicleLocal getpos _v;
_fl attachto [_v,[0,0,0],"destructionEffect2"];
_fl setParticleRandom [0.3, [1, 1, 0], [0, 0, 0], 0, 0.3, [0, 0, 0, 0], 0, 0];
_fl setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 10, 32], "", "Billboard", 1, 2, "destructionEffect2",
[0, 0, 5], 0, 10, 7.9, 0.075, [4,7,9,10], [[1, 1, 1, -1], [1, 1, 1, -1],
[1, 1, 1, -1], [1, 1, 1, -0.5], [1, 1, 1, -0]], [1,0.5], 1, 0, "", "", _v];
_fl setDropInterval 1;
_sm = "#particlesource" createVehicleLocal getpos _v;
_sm attachto [_v,[0,0,0],"destructionEffect1"];
_sm setParticleRandom [2, [2, 2, 0], [0, 0, 0], 0, 0.3, [0, 0, 0, 0.1], 0, 0];
_sm setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 7, 48], "", "Billboard", 1, 5, "destructionEffect1",
[0, 0, 5], 0, 10, 7.9, 0.075, [4,8,12,14], [[0.3, 0.3, 0.3, 1],
[0.45, 0.45, 0.45, 1],[0.6, 0.6, 0.6, 0.6], [0.7, 0.7, 0.7, 0.25], [1, 1, 1, 0]], [0.8,0.3,0.25], 1, 0, "", "", _v];
_sm setDropInterval 1;
}; // end of dedicated check
_i=0;
_dr=0.2;
_tv=11;
//Remove weapons/ammo to prevent explosion. Script will create its own explosions (doesnt work?)
removeallweapons _v;
if (local _v) then {_expl="HelicopterExploSmall" createvehicle (getpos _v);};
if !(isDedicated) then { //dw, particle stuff don't need run on dedicated
while {_i <1200 && ((velocity _v select 2)<-20 || (getpos _v select 2)>8) && !(alive _v) && !(isnull _v) && (getpos _v select 2)>1} do
{
_tv=abs(velocity _v select 0)+abs(velocity _v select 1)+abs(velocity _v select 2);
if (_tv>2) then {_dr=1/_tv} else {_dr=1};
_fl setDropInterval _dr;
_sm setDropInterval _dr;
_i=_i+1;
sleep 0.2;
};
}; // end of dedicated check
_pos=getpos _v;
clearVehicleInit _v;
if !(isDedicated) then { //dw, particle stuff don't need run on dedicated
deletevehicle _fl;deletevehicle _sm;
}; // end of dedicated check
if (surfaceiswater(_pos) && (_pos select 2)<9 ) then
{
if !(isDedicated) then { //dw, particle stuff don't need run on dedicated
_wave = "#particlesource" createVehicleLocal getpos _v;
_wave attachto [_v,[0,0,0],"destructionEffect1"];
_wave setParticleRandom [0.3, [1, 1, 0], [0.5, 0.5, 0], 0, 0.3, [0, 0, 0, 0], 0, 0];
_wave setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 12, 13,0], "", "Billboard", 1, 1.6, "destructionEffect1",
[0, 0, 0], 0, 10, 7.9, 0.075, [3,8],
[[0.7,0.8,1,0.6],[0.85,0.9,1,0.0]], [1000], 1, 0, "", "", _v];
_wave setparticlecircle [2,[0,16,0]];
_wave setDropInterval 0.0015;
_splash = "#particlesource" createVehicleLocal getpos _v;
_splash attachto [_v,[0,0,0],"destructionEffect1"];
_splash setParticleRandom [2, [2, 2, 0], [2, 2, 7], 0, 0.5, [0, 0, 0, 0], 0, 0];
_splash setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 13, 6, 0], "", "Billboard", 1, 4, "destructionEffect1",
[0, 0, 0], 0, 30, 7.9, 0.075, [8,15],
[[0.7,0.7,0.7,1],[1,1,1,0]], [1000], 1, 0, "", "", _v];
_splash setparticlecircle [2,[0,3,15]];
_splash setDropInterval 0.002;
sleep 0.2;
deletevehicle _wave;deletevehicle _splash;
}; // end of dedicated check
/*
if (local _v) then
{
_wreck=GetText (configFile >> "CfgVehicles" >> (typeof _v) >> "wreck");
if (_wreck!="") then
{
_pos = getpos _v;
_dir = vectordir _v;
_vecUp = vectorup _v;
_vel = velocity _v;
clearvehicleinit _v;
_crw= crew _v;
clearvehicleinit _v;
deleteVehicle _v;
_v =(_wreck) createvehicle _pos;
{_x moveincargo _v} foreach _crw;
_v setVectorDirAndUp [_dir,_vecUp];
_v setFuel 0;
_v setdamage 0;
_v setvelocity _vel;
//Send to garbage collecter so wreck can be deleted later
[_v] call BIS_GC_trashItFunc;
};
}; */
}
else
{
if (local _v) then
{
//_velx = velocity _v select 0; _velx = _velx / 4;
//_vely = velocity _v select 1; _vely = _vely / 4;
_velz=velocity _v select 2;
if (_velz>1) then {_v setvelocity [velocity _v select 0,velocity _v select 1,0]};
_expl="HelicopterExploBig" createvehicle [_pos select 0,_pos select 1,(_pos select 2) + 1];
sleep 0.05;
/*
_wreck=GetText (configFile >> "CfgVehicles" >> (typeof _v) >> "wreck");
if (_wreck!="") then
{
_pos = getpos _v;
_dir = vectordir _v;
_vecUp = vectorup _v;
_vel = velocity _v;
_crw= crew _v;
clearvehicleinit _v;
deleteVehicle _v;
_v =(_wreck) createvehicle _pos;
{_x moveincargo _v} foreach _crw;
//sleep 0.05;
_v setvelocity _vel;
//_v setPos _pos;
_v setvectordir (_dir);
_v setvectorup _vecUp;
_v setFuel 0;
_v setdamage 0;
}; */
//_v setVehicleInit format ["[this, %1, %2]spawn BIS_Effects_AirDestructionStage2",_int, _t];
//processInitCommands; //ClearvehicleInit done at end of burn script
["AirDestructionStage2", _v, _int, _t] call BIS_Effects_globalEvent;
};
};

View File

@@ -0,0 +1,85 @@
_int = _this select 1;
_t=_this select 2;
_pos=getpos _v;
// Particle effects
if !(isDedicated) then { //dw, particle stuff don't need run on dedicated
_smoke = "#particlesource" createVehicleLocal _pos;
_smoke attachto [_v,[0,0,0],"destructionEffect1"];
_smoke setParticleParams [["\ca\Data\ParticleEffects\Universal\Universal",16,7,48],
"", "Billboard", 1, 15, [0, 0, 0], [0, 0, 0], 1, 1.275, 1, 0, [8,14],
[[0.1,0.1,0.1,1],[0.1,0.1,0.1,0]], [0.5], 0.1, 0.1, "", "", _v];
//_smoke setParticleCircle [2,[0,0,0]];
_smoke setParticleRandom [4, [2, 2, 2], [0, 0, 0], 0, 0, [0, 0, 0, 0], 0, 0];
_smoke setDropInterval 0.02;
_fire = "#particlesource" createVehicleLocal _pos;
_fire attachto [_v,[0,0,0],"destructionEffect2"];
/*_fire setParticleParams [["\ca\Data\ParticleEffects\Universal\Universal",16,2,32], "", "Billboard", 1, 1, [0, 1, 0], [0, 0, 0], 1, 1.275, 1, 0, [10,15],
[[1,1,1,-1],[1,1,1,0]], [0.5], 0.01, 0.01, "", "", _v,360]; */
_fire setParticleParams [["\ca\Data\ParticleEffects\Universal\Universal",16,2,80],
"", "Billboard", 1, 2, [0, 1, 0], [0, 0, 0], 1, 1.275, 1, 0, [7,13],
[[1,1,1,-1],[1,1,1,0]], [0.5], 0.01, 0.01, "", "", _v,360];
_fire setParticleRandom [0.5, [0.5, 0.5, 0.5], [0, 0, 0], 0, 0, [0, 0, 0, 0], 0, 0];
_fire setDropInterval 0.01;
/*
_shards = "#particlesource" createVehicleLocal _pos;
//_shards attachto [_v,[0,0,0],"destructionEffect1"];
_shards setParticleParams [["\CA\Data\ParticleEffects\Shard\shard",1,0,1], "", "SpaceObject", 1, 60, [0, 0, 0], [0, 0, 0], 0, 1.275, 1, 0, [1,1],
[[1,1,1,1]], [0.5], 0, 0, "", "", _v];
_shards setParticleRandom [30, [1, 1, 0], [0, 0, 0], 0, 0, [0, 0, 0, 0], 0, 0];
_shards setParticleCircle [2,[0.001,0.001,-0.001]];
_shards setDropInterval 0.05;
*/
_dirt = "#particlesource" createVehicleLocal _pos;
_dirt attachto [_v,[0,0,0],"destructionEffect1"];
_dirt setParticleParams [["\ca\Data\ParticleEffects\Universal\Universal",16,12,9,0], "", "Billboard", 1, 5, [0, 0, 0], [0, 0, 5], 0, 5, 1, 0, [10,20],
[[0.1,0.1,0.1,1],[0.1,0.1,0.1,0.7],[0.1,0.1,0.1,0]], [1000], 0, 0, "", "", _v,360];
_dirt setParticleRandom [0, [1, 1, 1], [1, 1, 2.5], 0, 0, [0, 0, 0, 0.5], 0, 0];
_dirt setDropInterval 0.05;
//creating ground craters
_i=0;
while {(speed _v) > 0.1} do
{
_pos=getpos _v;
_xv=velocity _v select 0;
_yv=velocity _v select 1;
_dir = abs(_xv atan2 _yv);
_Crater= "CraterLong" createvehiclelocal [_pos select 0, _pos select 1, 0];
_Crater setdir (_dir + (180 * _i));
_Crater setpos [_pos select 0, _pos select 1, 0];
_Crater setPos [_pos select 0, _pos select 1, ((0 - _i)/13)]; //all setpos commands so it is placed correctly on sloped terrain
_speed = (speed _v);
_velz=velocity _v select 2;
if (_velz>1) then {_v setvelocity [_xv/1.3,_yv/1.3,0]}
else {_v setvelocity [_xv/1.2,_yv/1.2,velocity _v select 2]};
_tv=abs(_xv)+abs(_yv)+abs(_zv);
if (_tv>2) then {_dr=1/_tv} else {_dr=1};
_smoke setDropInterval _dr*1.5;
_fire setDropInterval _dr*1.5;
_dirt setDropInterval _dr;
_shards setDropInterval _dr;
sleep (0.25 - (_speed / 1000));
_i = _i + 1;
};
deleteVehicle _smoke;
deleteVehicle _fire;
deleteVehicle _shards;
deleteVehicle _dirt;
}; // end of dedicated check
_v setvelocity [0,0,-0.1];
if (local _v) then
{
//_v setVehicleInit format ["[this, %1, %2,false,true]spawn BIS_Effects_Burn",_int, _t];
//processInitCommands; //ClearvehicleInit done at end of burn script
["Burn", _v, _int, _t] call BIS_Effects_globalEvent;
[_v,_int,false] spawn BIS_Effects_Secondaries;
};
sleep 0.5;
_v setvelocity [0,0,-0.01];

View File

@@ -0,0 +1,34 @@
private ["_v","_int","_t"];
_v=_this select 0;
if (_v iskindof "helicopter" || _v iskindof "plane")
then
{
//_v setVehicleInit "[this] spawn BIS_Effects_AirDestruction";
//processInitCommands; //ClearvehicleInit done at end of burn script
["AirDestruction", _v] call BIS_Effects_globalEvent;
};
if (_v iskindof "tank")
then
{
_int = (fuel _v)*(2+random 2);
_t=time;
//_v setVehicleInit format ["[this, %1, %2]spawn BIS_Effects_Burn",_int, _t]; - disabled to prepaire for move into engine
//processInitCommands; //ClearvehicleInit done at end of burn script
[_v,_int] spawn BIS_Effects_Secondaries;
};
if (_v iskindof "car" || _v iskindof "ship")
then
{
_int = (fuel _v)*(2 + random 1);
_t=time;
//_v setVehicleInit format ["[this, %1, %2]spawn BIS_Effects_Burn; ",_int, _t]; - disabled to prepaire for move into engine
//processInitCommands; //ClearvehicleInit done at end of burn script
[_v,_int] spawn BIS_Effects_Secondaries;
//Possible initial explosion
if ((random _int)>2.2) then
{
_b="SmallSecondary" createvehicle (getpos _v);
};
};

View File

@@ -0,0 +1,34 @@
/*
Created exclusively for ArmA2:OA - DayZMod.
Please request permission to use/alter/distribute from project leader (R4Z0R49) AND the author (facoptere@gmail.com)
*/
// These RE commands will be cancelled once init.sqf is exec'ed on client or server
#ifndef REMOVED_LIB
#define REMOVED_LIB [ "addAction", "addEventhandler", "addMagazine", "addMagazineCargo", "addWeapon", \
"addWeaponCargo", "addWPCur", "animate", "callVar", "clearMagazineCargo", "clearWeaponCargo", "createDiaryRecord", \
"createMarkerLocal", "createSimpleTask", "createTaskSet", "debugLog", "deleteWP", "enablesimulation", "endMission", \
"execfsm", "fadeMusic", "fadeSound", "failMission", "globalChat", "globalRadio", "groupChat", "groupRadio", \
"hideObject", "hint", "hintC", "kbAddTopic", "kbreact", "kbRemoveTopic", "kbtell", "land", "move", "moveIn", \
"playAction", "playActionnow", "playmovenow", "playMusic", "playsound", "removeAction", \
"removeAllWeapons", "setCaptive", "setCurrentTask", "setCurrentTaskArrays", "setDate", "setDir", "setGroupID", \
"setMarkerPosLocal", "setObjectTexture", "setSimpleTaskDescription", "setTaskState", "setWPdesc", "setWPtype", \
"showCommandingMenu", "sideChat", "sideRadio", "skiptime", "spawn", "switchAction", "switchCamera", "taskHint", \
"titleCut", "Hangender"]
#endif
// Allowed commands
#ifndef TRACED_LIB
#define TRACED_LIB [ "execVM", "JIPexec", "JIPrequest", "say", "playmove", "switchmove", "titleText" ]
// uncomment following line to log all incoming allowed RE
#define RESEC_VERBOSE
#endif
// Special logic for execVM, only these whitelisted scripts will be spawned
#ifndef WHITELISTED_EXECVM
#define WHITELISTED_EXECVM [ ""ca\Modules\Functions\init.sqf"" ]
// uncomment and put in the array above if you want your server be able to kick players (not used in DayZ for now)
//""ca\Modules\MP\data\scriptCommands\endMission.sqf""
#endif
#define Stringify(macro) #macro

View File

@@ -0,0 +1,59 @@
/*
Created exclusively for ArmA2:OA - DayZMod.
Please request permission to use/alter/distribute from project leader (R4Z0R49) AND the author (facoptere@gmail.com)
*/
#include "REsec.hpp"
waitUntil{!isNil "BIS_MPF_InitDone"};
private["_ofn","_nfn"];
{
_ofn=format["r%1code",_x];
_nfn=format["r%1code%2",_x,round(random(100000))];
if(_x=="execVM")then{
call compile format["%1=%2;%2={if((count _this>=3)AND{(!((_this select 2)IN%3))})then{diag_log(""WARNING RE %2 with illegal args:""+str(_this));}else{_this call %1}};",_nfn,_ofn,Stringify(WHITELISTED_EXECVM)];
}else{
#ifdef RESEC_VERBOSE
call compile format ["%1=%2;%2={diag_log(""RE %2 args:""+str(_this));_this call %1};",_nfn,_ofn];
#endif
};
}foreach TRACED_LIB;
{
_ofn=format["r%1code",_x];
call compile format["%1={diag_log(""WARNING illegal RE %1 with args:""+str(_this));};",_ofn];
}foreach REMOVED_LIB;
#ifndef SKIP_REMOTEEXECUTIONSERVER
[]spawn{
while{(true)}do{
private["_nfn"];
waitUntil{BIS_PathMPscriptCommandsCustom=="\ca\Modules\MP\data\scriptCommandsCustom\"};
_nfn="BIS_MPF_remoteExecutionServer"+str(round(random(100000)));
call compile(_nfn+"=BIS_MPF_remoteExecutionServer;BIS_MPF_remoteExecutionServer={private[""_fa"",""_co""];
_fa=_this select 1;
if(count _fa>=3)then{
_co=_fa select 2;
if(typeName _co==""STRING"")then{
_co=toLower _co;
if(_co IN[""loc"",""locper"",""perloc"",""per""])then{
if(count _fa>=4)then{
_co=_fa select 3;
};
};
};
if(typeName _co==""STRING"")then{
{
if(!((_x>=65&&_x<=90)OR(_x>=97&&_x<=122))) exitWith {diag_log(""WARNING possible code injection args:""+str(_this)); _this=[];};
}forEach toArray _co;
};
};
_this call "+_nfn+"};"
);
"remExField" addPublicVariableEventHandler{_this call BIS_MPF_remoteExecutionServer};
"remExFP" addPublicVariableEventHandler{_this call BIS_MPF_remoteExecutionServer};
BIS_PathMPscriptCommandsCustom="";
diag_log(__FILE__+":Monitoring Remote Exe...");
sleep 1;
};
};
#endif