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

Refuel for non-AllVehicle objects #5151

Merged
merged 8 commits into from
May 29, 2017

Conversation

tbeswick96
Copy link
Contributor

@tbeswick96 tbeswick96 commented May 10, 2017

When merged this pull request will:

  • Add helper.p3d from fastroping
  • Create helper object for non-AllVehicles objects, allowing refuel to be configured for more stuff (sling-loadable barrels for example)
  • Un-magic refuel progress timer value

This adds a workaround which makes it possible to have a fuel hose (an arma rope) coming from a non-physx object (limitation of ropeCreate) by using an invisible helper object which the rope is connected to instead - such that it looks like it connects to the actual object.

This has been used for sling-loadable fuel barrels for a number of weeks with no issues. These can be found here: https://github.com/uksf/modpack/blob/master/addons/vehicles/CfgVehicles.hpp#L102

@jonpas jonpas added the kind/enhancement Release Notes: **IMPROVED:** label May 10, 2017
@jonpas jonpas added this to the 3.10.0 milestone May 10, 2017
@PabstMirror
Copy link
Contributor

I think this should let us fix #3310

@tbeswick96
Copy link
Contributor Author

Not sure if damage from collisions would be an issue. Didn't BIS disable collisions of attachTo'd objects recently?

@tbeswick96
Copy link
Contributor Author

arma3_x64 2017-05-10 23-01-04

class GVAR(helper): Helicopter_Base_F {
author = "Beswick.T";
scope = 1;
model = QPATHTOF(data\helper.p3d);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this an actual model or just an empty dummy? One can use model = "-"; instead for no model.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's an empty dummy. Tried and it doesn't work with "-", just gives an error.

Copy link
Contributor

Choose a reason for hiding this comment

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

What about:

model = "\A3\Weapons_f\empty";

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will give that a shot 1 min

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That seems to work juuuust fine

@tbeswick96
Copy link
Contributor Author

tbeswick96 commented May 11, 2017

Have done a little more playing around, and although it fixes the issue for things like the Huron fuel container, it doesn't fix it for buildings like the fuel bladder. It seems when the helper is attached to the fuel bladder, it loses simulation. Detach it and it's fine. Unsure how to get around that...is there a way to make an object static in a position without disabling simulation?

Edit: I've found a solution where the helper object simply is not attachTo'd the target object. The rope simulation works fine now, and using hideObjectGlobal ensures collisions don't occur. I am having some issues with the position of the rope now though. It's not taking into account object rotation.

@tbeswick96
Copy link
Contributor Author

tbeswick96 commented May 11, 2017

Think I've solved it!
arma3_x64 2017-05-11 02-04-38

If the simulation type is thingX, which handles attachTo just fine with rope simulation, it will use that, otherwise it will set the helper position, direction, and vectorUp to the same as the target's, resulting in proper positioning. This should be fine, as it's not everyday a house or fuel pump gets up and walks away.

Hope this satisfies :)

@bux
Copy link
Member

bux commented May 11, 2017

Could you explain a little more in your OP what this does and what's being improved?
I'd like to know more.

And it would be helpful when writing the change logs.

private _ropeTarget = _target;
if (!(_target isKindOf "AllVehicles")) then {
private _helper = QGVAR(helper) createVehicle [0,0,0];
hideObjectGlobal _helper;
Copy link
Member

Choose a reason for hiding this comment

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

Keep in mind this has to run on the server, there is an event in common that can handle the locality:

[QEGVAR(common,hideObjectGlobal), [_helper, true]] call CBA_fnc_serverEvent;

@kymckay
Copy link
Member

kymckay commented May 11, 2017

To give @bux some context: This adds a workaround which makes it possible to have a fuel hose (an arma rope) coming from a non-physx object (limitation of ropeCreate) by using an invisible helper object which the rope is connected to instead - such that it looks like it connects to the actual object.

@PabstMirror PabstMirror changed the base branch from master to 170UBC May 11, 2017 20:47
@PabstMirror PabstMirror changed the base branch from 170UBC to master May 11, 2017 20:48
@PabstMirror
Copy link
Contributor

Pushed some config changes to disable actions on the helper
I tested this in 2 player mp and it seemed to be working fine

IIRC it's a little dangerous to setVariable on map objects because they are technically "streaming".
And might be deleted and come back with no variables.
But I don't think it would cause any serious issues, and the functionality gains are worth it.

@@ -37,7 +37,7 @@ class Extended_InitPost_EventHandlers {
class Helicopter {
class ADDON {
init = QUOTE(_this call DFUNC(addRepairActions));
exclude[] = {QEGVAR(fastroping,helper), "ACE_friesBase"};
exclude[] = {QEGVAR(fastroping,helper), "ACE_friesBase", QEGVAR(refuel,helper)};
Copy link
Member

Choose a reason for hiding this comment

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

I believe this fastroping helper does not need to be here anymore.

@tbeswick96
Copy link
Contributor Author

@PabstMirror just so I can understand better, when you say streaming is that to do with view distance? So the vars are there when in view but if you go far away and back the vars might not be there?

@jonpas
Copy link
Member

jonpas commented May 11, 2017

@tbeswick96 Correct.

I think the gains are well worth it, maybe we could have a map of building positions to data that would allow that to be persistent. But I'd say that's for another PR anyways.

@PabstMirror
Copy link
Contributor

http://killzonekid.com/arma-scripting-tutorials-variables-part-3/

Houses for example like other map objects (and I mean map objects that have been added during map creation, not mission objects) are streamed. Think about it, the maps in ArmA are huge so even if you can load the whole map you will be using too much computer power. This is unnecessary, so map objects are streamed to you as you go. This means that if you attach a variable to an object on your map and try to make it global, on other computers the same object might not exist yet. And when the object appears later on other computers, it might not have variable you attached to it, so remember this.

@tbeswick96
Copy link
Contributor Author

tbeswick96 commented May 11, 2017

Can just change the setVar to be on the nozzle instead if that is preferred? Not sure about the other setVars on the target

@PabstMirror PabstMirror merged commit 3b7a304 into acemod:master May 29, 2017
@tbeswick96 tbeswick96 deleted the refuelimprovements branch May 29, 2017 19:22
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.

6 participants