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

Cookoff - Adds heating effect to cookoff #8685

Merged
merged 12 commits into from
May 17, 2022
Merged

Conversation

LorenLuke
Copy link
Contributor

When merged this pull request will:

  • Make tanks that cook-off actually heat up on IR.

Makes tanks that cook-off actually heat up on IR.
@jonpas jonpas changed the title Cookoff- Adds heating effect to cookoff Cookoff - Adds heating effect to cookoff Nov 16, 2021
@jonpas jonpas added kind/enhancement Release Notes: **IMPROVED:** target/next-milestone? labels Nov 16, 2021
@PabstMirror
Copy link
Contributor

https://community.bistudio.com/wiki/setVehicleTIPars says local effect
so I'm not sure if this will sync correctly in mp?

@LorenLuke
Copy link
Contributor Author

LorenLuke commented Nov 16, 2021

@PabstMirror

Local Effect

It seems the whole thing is called and then immediately checked for locality, so I don't suspect it'll be an issue.

https://github.com/acemod/ACE3/blob/master/addons/cookoff/XEH_postInit.sqf#L4-L9

@PabstMirror
Copy link
Contributor

Untitled

@LorenLuke
Copy link
Contributor Author

I'm unsure what's going on here then, as the code states that the script shouldn't even start unless the vehicle is local. Does it still do all the smoking and flame effects otherwise?

And, if so, I know it's been said to avoid remoteExec. What about remoteExecCall or BIS_fnc_MP?

@jonpas
Copy link
Member

jonpas commented Nov 16, 2021

No, use CBA Custom Events for any network "execution".

@pterolatypus
Copy link
Contributor

the script shouldn't even start unless the vehicle is local

Do it in fnc_cookOffEffect instead

@PabstMirror PabstMirror added this to the 3.14.2 milestone Nov 18, 2021
@TheCandianVendingMachine
Copy link
Contributor

This sends an event across the network every 1/4 second. in fnc_cookOffEffect.sqf it would be called locally. Shove _intensity somewhere in there and move the code there

Co-authored-by: pterolatypus <pterolatypus@users.noreply.github.com>
((_tiPars select 1) + (_intensity * 0.004))/1.002,
((_tiPars select 2) + (_intensity * 0.01))/1.005
]
]] call CBA_fnc_globalEvent;
Copy link
Contributor

@commy2 commy2 Nov 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This raises a global event from globally executed script now I think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this should be called locally now. This function is run per client

@commy2
Copy link
Contributor

commy2 commented Nov 21, 2021

What's the logic behind the math here? Refering to this part:

            ((_tiPars select 0) + (_intensity * 0.01))/1.005, 
            ((_tiPars select 1) + (_intensity * 0.004))/1.002, 
            ((_tiPars select 2) + (_intensity * 0.01))/1.005

Lots of magic hard coded numbers here.

@LorenLuke
Copy link
Contributor Author

magic numbers

The center value is the tracks/tires, while the other two are the engine and the cannon barrel, so at the outset it stands to reason that the thing having smoke exit from it and the thing with all the ammo burning inside of it would heat up faster than the tires/treads, so that's why the first and last values are equally heated up while the second one heats up more slowly.

The second half of the numbers is so as to 1) not be immediately just set to max, 2) not have a linear increase in the values as the heating would taper off, instead having a curve as it gets closer and closer to max, and 3) the math (by always going slightly more than half the distance with fixed values) allows for it to actually hit a maximum level, rather than just only get asymptotically close.

The numbers don't correlate to any real world data other than 'I think when it's belching fire, it should at least look like it has been warmed up some' followed by 'I'm sure it'll be glowing on sensors in short order', and how I feel would best correlate to how quickly a tank would heat up by cooking off.

addons/cookoff/XEH_postInit.sqf Outdated Show resolved Hide resolved
addons/cookoff/functions/fnc_cookOffEffect.sqf Outdated Show resolved Hide resolved
Comment on lines 189 to 193
_obj setVehicleTIPars [
((_tiPars select 0) + (_intensity * 0.01))/1.005,
((_tiPars select 1) + (_intensity * 0.004))/1.002,
((_tiPars select 2) + (_intensity * 0.01))/1.005
];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vectorAdd will be faster than doing select three times.

Suggested change
_obj setVehicleTIPars [
((_tiPars select 0) + (_intensity * 0.01))/1.005,
((_tiPars select 1) + (_intensity * 0.004))/1.002,
((_tiPars select 2) + (_intensity * 0.01))/1.005
];
_obj setVehicleTIPars (_tiPars vectorAdd [
(_intensity * 0.01) / 1.005,
(_intensity * 0.004) / 1.002,
(_intensity * 0.01) / 1.005
]);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

math is different
(current + add) / 1.05
vs
current + (add/ 1.05)

addons/cookoff/functions/fnc_cookOffEffect.sqf Outdated Show resolved Hide resolved
}, 0, [_obj, _jet, _ring, _time, CBA_missionTime, _light, _fireSelection, _sound]] call cba_fnc_addPerFrameHandler;

private _tiPars = getVehicleTIPars _obj;
_obj setVehicleTIPars [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add comments as to what the magic numbers indicate

PabstMirror and others added 4 commits May 11, 2022 15:39
Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>
Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>
Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>
@PabstMirror PabstMirror merged commit da1c5d3 into acemod:master May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Release Notes: **IMPROVED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants