Skip to content
This repository was archived by the owner on May 24, 2022. It is now read-only.

Multi Player Sitting (rework #122)#144

Merged
jonpas merged 16 commits intomasterfrom
multisitting
Nov 23, 2018
Merged

Multi Player Sitting (rework #122)#144
jonpas merged 16 commits intomasterfrom
multisitting

Conversation

@jonpas
Copy link
Member

@jonpas jonpas commented Nov 18, 2018

When merged this pull request will:

  • Add everything in Multi Player Sitting #122 in a better, more integrated way
  • Add Arm Chair and fix inheritance on benches
  • Improve variable naming

@jonpas jonpas added this to the 3.4.0 milestone Nov 18, 2018
@jonpas jonpas mentioned this pull request Nov 18, 2018
WARNING_1("Invalid sitting configuration of %1!",_type);
};

if !((_sitPosition select 0) isEqualType []) then {
Copy link
Member

Choose a reason for hiding this comment

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

why not use the inverse of that and check for isEqualType Number?

Copy link
Member Author

Choose a reason for hiding this comment

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

I could, doesn't make a difference here though.

{isNil {_player getVariable QGVAR(isSitting)}} &&
{!(_seat call ACEFUNC(common,owned))} &&
{isNil {_player getVariable QGVAR(sittingStatus)}} &&
{(_seat getVariable [QGVAR(seatsClaimed), []]) find true == -1} &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{(_seat getVariable [QGVAR(seatsClaimed), []]) find true == -1} &&
{
private _seatsClaimed = _seat getVariable [QGVAR(seatsClaimed), []];
_seatsClaimed isEqualTo []
|| {_seatsClaimed find false > -1}
} &&

I didn't test your code neither mine (will try later this day), but looks like your condition is false when any seat is claimed, so only one person would be able to multi-seat.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I should just be checking that specific index (seat pos) or empty!

@jonpas
Copy link
Member Author

jonpas commented Nov 19, 2018

@Dystopian if you can give it a test that'd be great. I tested in editor with 2 units.

*
* Example:
* [seat, player] call acex_sitting_fnc_sit;
* [seat, player] call acex_sitting_fnc_sit
Copy link
Contributor

Choose a reason for hiding this comment

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

cursorObject instead of seat in all functions examples would be much more useful

Copy link
Member Author

Choose a reason for hiding this comment

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

It's an object, that's all that matters, you can get it in thousands of different ways. :)

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant for copy-paste, just paste to debug console and hit EXEC

Copy link
Contributor

Choose a reason for hiding this comment

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

having code example you can use instantly is always nice

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I am always too lazy with copy/pasting. 😆

@Dystopian
Copy link
Contributor

tested, works perfectly (SP)

Copy link
Contributor

@PabstMirror PabstMirror left a comment

Choose a reason for hiding this comment

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

image

@jonpas
Copy link
Member Author

jonpas commented Nov 21, 2018

@PabstMirror how? MP or SP? Which bench?

@Dystopian
Copy link
Contributor

@jonpas It's easily done with acex_sitting_fnc_sit call on AI in debug console and I suppose it can be done in MP when some players try to seat to the same seat simultaneously.

I think it's enough to just add FUNC(canSit) check to fnc_sit.

*/

params ["_seat", "_player"];
params ["_seat", "_player", ["_seatPos", 0]];
Copy link
Contributor

Choose a reason for hiding this comment

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

_seatPos argument should be documented in header.

@jonpas
Copy link
Member Author

jonpas commented Nov 21, 2018

Oh but for AI I won't add special checks, it's up to whoever calls it to also call canSeat. Or not, people find interesting use cases. :D

@jonpas
Copy link
Member Author

jonpas commented Nov 21, 2018

I suppose it can be done in MP when some players try to seat to the same seat simultaneously.

Almost missed that, that's probably a good reason to add it.

@PabstMirror
Copy link
Contributor

Land_bench_01_f, 2 players (non-dedicated)
the sit action is inside the first sitting player, so it's hard to see, but still possible if close enough

@PabstMirror
Copy link
Contributor

seatPos array was only getting set to true on first run if (_seatsClaimed isEqualTo []) then {
seems to work fine now

@jonpas
Copy link
Member Author

jonpas commented Nov 22, 2018

Wow, I should not work on this stuff at 3am... I now remember thinking I have to add normal handling and not just first run. :D

Thanks @PabstMirror !

@jonpas jonpas merged commit 1634700 into master Nov 23, 2018
@jonpas jonpas deleted the multisitting branch November 23, 2018 14:43
@jetelain jetelain mentioned this pull request Feb 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants