-
Notifications
You must be signed in to change notification settings - Fork 739
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
Add cargo eden attributes #4780
Conversation
- Add a ace_cargo_space attribute to vehicles to alter how much cargo they can carry - Add an ace_cargo-size attribute to objects to alter how much cargo space they consume
addons/cargo/CfgEden.hpp
Outdated
control = "Edit"; | ||
|
||
// Expression only runs on the server, must handle actions for all machines and future JIPs (Why BI?!) | ||
expression = QUOTE(_this setVariable [ARR_3('%s',_value,true)]; [QQGVAR(EdenObjectInit),_this] call CBA_fnc_globalEventJIP;); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realised there's a missing ARR_2
here that I must have added on my local version after committing. Rest assured, that's not what was making the initObject
call fail to work.
Not perfect, but prevents the attribute from being added to static objects where the postInit XEH won't run for the time being
- Adds two functions `fnc_setSize.sqf` and `fnc_setSpace.sqf` to update the cargo size/space respectively of any given object. - Functions provide means to change these values either locally or globally. - Will delay execution until after settings have initalized so that functions work correctly no matter when they're called. - Functions are now used by eden attributes to correctly apply values to any object without issue. - Currently will not update size/space for JIP players, unsure how best to handle. - Currently will create duplicate action menu entries for objects on which the functions are used more than once. - Adds additional condition to the cargo menu for vehicles (requires `hasCargo`) - Change the `canLoad` object variable to a boolean for simplicity
This module and associated public function are entriely replaced by the new eden settings and associated functions.
Good call, it actually looks like this is being handled already in |
Already handled in `fnc_canLoadItemIn`. This reverts commit 6169af9.
Prevents multiple calls to the cargo API on the same object from adding multiple menu entries to the object.
Adds relevant cargo menus on JIP machines to any objects globally provided with size/space via the public API.
Fixed and tested JIP compatiblity 👍 Working as expected |
Think this is now ready to go if anyone wants to review it. Assigned commy as he's a listed maintainer and pabst because he showed some interest in this. |
- Now no menu is added if the new space/size is not applicable. - No need to add the cargo actions if already done globally in a previous function call. - The init functions use an object variable instead of a GVAR for marking objects as already initalized. Saving some resources in cases where objects are later deleted/cleaned up. - Added some macros to get the space/size of a config, making code more readable in places.
I like it, could be merged. |
Mentioned in private slack, but looking at this now I'm not sure I like the way I've handled the locality in the public functions. I believe my intent was to allow the size/space to be set independently on each machine if desired (for example maybe only a specific player should be able to load the object in question). However it introduces a layer of complexity I'm not sure we want to have. |
I think size vars should to be the same on all machines |
Yeah I think it keeps things simpler to have values synced. I'll modify the public functions in this. |
- Keeps the size/space value set publically synced. Use cases for individual values on each machine are minimal. - If a user wanted to restrict who can load what, we should provide other methods of achieving that which don't complicate the code here.
Conflicts: addons/cargo/functions/fnc_initObject.sqf addons/cargo/script_component.hpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good,
got it working with #4871
Conflicts: addons/cargo/functions/fnc_initVehicle.sqf
Inspired by #4283
ace_cargo_space
attribute to vehicles to alter how much cargo they can carryace_cargo_size
attribute to objects to alter how much cargo space they consumeace_cargo_setSize
public functionace_cargo_setSpace
public functionace_cargo_makeLoadable
public function and associated moduleKnown issues in current WIP implementation:
CBA_fnc_globalEventJIP
, would need to track the ID of which on the object for future function calls to overwrite the event.