-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
210 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
@AresModAchillesExpansion/addons/functions_f_achilles/functions/features/fn_effectFire.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
Author: Borivoj Hlava, CreepPork_LV | ||
Description: | ||
Creates a fire effect. | ||
Parameters: | ||
_this select: 0 - NUMBER - Value of the Color Red | ||
_this select: 1 - NUMBER - Value of the Color Green | ||
_this select: 2 - NUMBER - Value of the Color Blue | ||
_this select: 3 - NUMBER - Timeout | ||
_this select: 4 - NUMBER - Damage | ||
_this select: 5 - NUMBER - Effect Size | ||
_this select: 6 - NUMBER - Particle Density | ||
_this select: 7 - NUMBER - Particle Life Time | ||
_this select: 8 - NUMBER - Particle Size | ||
_this select: 9 - NUMBER - Particle Speed | ||
_this select: 10 - NUMBER - Particle Orientation | ||
_this select: 11 - OBJECT - Effect Emitter | ||
_this select: 12 - OBJECT - (Dummy) Logic | ||
_this select: 13 - OBJECT - Unit who placed down the Fire Effect module | ||
Returns: | ||
Nothing | ||
*/ | ||
|
||
params | ||
[ | ||
"_colorRed", | ||
"_colorGreen", | ||
"_colorBlue", | ||
"_timeout", | ||
"_damage", | ||
"_effectSize", | ||
"_particleDensity", | ||
"_particleLifeTime", | ||
"_particleSize", | ||
"_particleSpeed", | ||
"_orientation", | ||
"_emitter", | ||
"_logic", | ||
"_curator" | ||
]; | ||
|
||
hint "Something's happening!"; | ||
systemChat str (getPos _logic); | ||
systemChat str (_logic); | ||
diag_log (format ["Logic Pos: %1 - Logic ref: %2 - Emittor: %3", getPos _logic, _logic, _emitter]); | ||
|
||
private _pos = getPos _logic; | ||
|
||
//--- particle effect creation | ||
_emitter setParticleParams [["\A3\data_f\ParticleEffects\Universal\Universal",16,10,32],"","billboard",1,_particleLifeTime,[0,0,0],[0,0,0.4*_particleSpeed],0,0.0565,0.05,0.03,[0.9*_particleSize,0], | ||
[[1*_colorRed,1*_colorGreen,1*_colorBlue,-0],[1*_colorRed,1*_colorGreen,1*_colorBlue,-1],[1*_colorRed,1*_colorGreen,1*_colorBlue,-1],[1*_colorRed,1*_colorGreen,1*_colorBlue,-1],[1*_colorRed,1*_colorGreen,1*_colorBlue,-1],[1*_colorRed,1*_colorGreen,1*_colorBlue,0]], | ||
[1], 0.01, 0.02, "", "", "",_orientation,false,-1,[[3,3,3,0]]]; | ||
_emitter setParticleRandom [_particleLifeTime/4, [0.15*_effectSize,0.15*_effectSize,0], [0.2,0.2,0], 0.4, 0, [0,0,0,0], 0, 0, 0.2]; | ||
if (_damage > 0) then {_emitter setParticleFire [0.6*_damage, 0.25*_damage, 0.1];}; | ||
_emitter setDropInterval (1/_particleDensity); | ||
|
||
//--- light | ||
private _lightSize = (_particleSize + _effectSize)/2; | ||
|
||
private _light = createVehicle ["#lightpoint", (getPos _emitter), [], 0, "NONE"]; | ||
_light setPos [_pos select 0,_pos select 1,(_pos select 2) + 0.5]; | ||
_light setLightBrightness 1.0; | ||
_light setLightColor [1,0.65,0.4]; | ||
_light setLightAmbient [0.15,0.05,0]; | ||
_light setLightIntensity (50 + 400*_lightSize); | ||
_light setLightAttenuation [0,0,0,1]; | ||
_light setLightDayLight false; | ||
_light attachTo [_logic]; | ||
|
||
_logic setVariable ["effectLight",[_light],true]; | ||
|
||
//--- timeout | ||
if (_timeout != 0) then { | ||
[_logic,_timeout, _curator] spawn { | ||
scriptName "fn_moduleEffectsFire_timeoutLoop"; | ||
params ["_logic", "_timeout", "_curator"]; | ||
|
||
sleep _timeout; | ||
deleteVehicle ((_logic getVariable "effectEmitter") select 0); | ||
deleteVehicle ((_logic getVariable "effectLight") select 0); | ||
if (player == _curator) then {deleteVehicle (_logic getVariable ["Achilles_var_createDummyLogic_module", objNull])}; | ||
}; | ||
} | ||
else | ||
{ | ||
[_logic, ((_logic getVariable "effectEmitter") select 0), ((_logic getVariable "effectLight") select 0)] spawn | ||
{ | ||
scriptName "fn_moduleEffectsFire_awaitDeletionLoop"; | ||
params ["_logic", "_emitter", "_light"]; | ||
|
||
// Wait until the logic is deleted and clean up the effects | ||
waitUntil {isNull _logic}; | ||
deleteVehicle _emitter; | ||
deleteVehicle _light; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
...ModAchillesExpansion/addons/modules_f_achilles/Effects/functions/fn_moduleEffectsFire.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
File: fn_moduleEffectsFire.sqf | ||
Author: Borivoj Hlava, modified by CreepPork_LV | ||
Description: | ||
Module function. Creates fire on position of module. | ||
Parameter(s): | ||
_this select 0 (Object) - Module logic. | ||
Returned value: | ||
None. | ||
*/ | ||
|
||
params ["_logic"]; | ||
|
||
// Create our dialog to show all the data | ||
private _dialogResult = [ | ||
localize "STR_EFFECTS_CUSTOM_FIRE", | ||
[ | ||
[localize "STR_A3_CfgVehicles_ModuleEffectsFire_F_Arguments_ColorRed_0", "", "0.5"], | ||
[localize "STR_A3_CfgVehicles_ModuleEffectsFire_F_Arguments_ColorGreen_0", "", "0.5"], | ||
[localize "STR_A3_CfgVehicles_ModuleEffectsFire_F_Arguments_ColorBlue_0", "", "0.5"], | ||
[localize "STR_A3_CfgVehicles_ModuleEffectsFire_F_Arguments_Timeout_0", "", "0"], | ||
[localize "STR_A3_CfgVehicles_ModuleEffectsFire_F_Arguments_FireDamage_0", "", "1"], | ||
[localize "STR_A3_CfgVehicles_ModuleEffectsFire_F_Arguments_EffectSize_0", "", "1"], | ||
[localize "STR_A3_CfgVehicles_ModuleEffectsFire_F_Arguments_ParticleDensity_0", "", "25"], | ||
[localize "STR_A3_CfgVehicles_ModuleEffectsFire_F_Arguments_ParticleLifeTime_0", "", "0.6"], | ||
[localize "STR_A3_CfgVehicles_ModuleEffectsFire_F_Arguments_ParticleSize_0", "", "1"], | ||
[localize "STR_A3_CfgVehicles_ModuleEffectsFire_F_Arguments_ParticleSpeed_0", "", "1"], | ||
[localize "STR_A3_CfgVehicles_ModuleEffectsFire_F_Arguments_ParticleOrientation_0", "", "0"] | ||
] | ||
] call Ares_fnc_ShowChooseDialog; | ||
|
||
// If user pressed cancel | ||
if (_dialogResult isEqualTo []) exitWith {deleteVehicle _logic}; | ||
|
||
// Send the function to everyone | ||
if (isNil "Achilles_var_moduleEffectFireInit") then | ||
{ | ||
Achilles_var_moduleEffectFireInit = true; | ||
publicVariable "Achilles_fnc_effectFire"; | ||
}; | ||
|
||
// Create dummy logic because some users may not have Achilles. | ||
private _dummyLogic = _logic call Achilles_fnc_createDummyLogic; | ||
|
||
private _source = "#particlesource" createVehicle (getPos _logic); | ||
_dummyLogic setVariable ["effectEmitter",[_source],true]; | ||
|
||
private _emitter = (_dummyLogic getVariable "effectEmitter") select 0; | ||
_emitter setPos (getPos _logic); | ||
|
||
// Get the data | ||
_dialogResult params | ||
[ | ||
"_colorRed", | ||
"_colorGreen", | ||
"_colorBlue", | ||
"_timeout", | ||
"_damage", | ||
"_effectSize", | ||
"_particleDensity", | ||
"_particleLifeTime", | ||
"_particleSize", | ||
"_particleSpeed", | ||
"_orientation" | ||
]; | ||
|
||
// Convert the strings to numbers | ||
_colorRed = parseNumber _colorRed; | ||
_colorGreen = parseNumber _colorGreen; | ||
_colorBlue = parseNumber _colorBlue; | ||
_timeout = parseNumber _timeout; | ||
_damage = parseNumber _damage; | ||
_effectSize = parseNumber _effectSize; | ||
_particleDensity = parseNumber _particleDensity; | ||
_particleLifeTime = parseNumber _particleLifeTime; | ||
_particleSize = parseNumber _particleSize; | ||
_particleSpeed = parseNumber _particleSpeed; | ||
_orientation = parseNumber _orientation; | ||
|
||
if (_colorRed > 1) then {_colorRed = 1}; | ||
if (_colorRed < 0) then {_colorRed = 0}; | ||
if (_colorGreen > 1) then {_colorGreen = 1}; | ||
if (_colorGreen < 0) then {_colorGreen = 0}; | ||
if (_colorBlue > 1) then {_colorBlue = 1}; | ||
if (_colorBlue < 0) then {_colorBlue = 0}; | ||
|
||
// Attach the emitter so it moves when the curator's module is adjusted. | ||
_emitter attachTo [_dummyLogic]; | ||
|
||
// Run the code for everyone on the server | ||
[_colorRed, _colorGreen, _colorBlue, _timeout, _damage, _effectSize, _particleDensity, _particleLifeTime, _particleSize, _particleSpeed, _orientation, _emitter, _dummyLogic, player] remoteExecCall ["Achilles_fnc_effectFire", 0, _dummyLogic] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...dAchillesExpansion/addons/ui_f/functions/dialogs/fn_RscDisplayAtttributes_SpawnEffect.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters