ACE3 icon indicating copy to clipboard operation
ACE3 copied to clipboard

General - Convert vehicle to objectParent

Open Mike-MF opened this issue 1 year ago • 3 comments

When merged this pull request will:

  • Converts vehicle _unit == unit into isNull objectParent _unit, it's better and already used in some areas.

Mike-MF avatar Feb 20 '24 13:02 Mike-MF

What do you mean with it's better? It decreases readability which is why we didn't do this in the past. Performance gains are negligible.

BaerMitUmlaut avatar Feb 20 '24 13:02 BaerMitUmlaut

There's also _unit in _unit which is of similar performance and still quite readable IMO.

veteran29 avatar Feb 20 '24 17:02 veteran29

imo they're all not that readable. I remember vehicle _unit == _unit being confusing as I was just getting into arma.

imo _unit in _unit is the least clear. vehicle _unit == _unit at least has the vehicle command to make its purpose a bit clearer. I am fairly indifferent between vehicle and objectParent, but if I had to pick I'd go with objectParent, more explicit in its return and for someone less familiar, they'll be more likely to google it and get an actual idea of what's going on. vehicle _unit returning _unit on foot instead of objNull is not clear

Use objectParent instead of vehicle to get a soldier's vehicle. Apart from being faster it is also more reliable, as when used on dead crew, vehicle command may surprisingly return the unit itself.

I don't think that's too relevant to the code being changed here, I don't think we'll ever be in a situation where we're calling it on dead crew

BrettMayson avatar Feb 20 '24 21:02 BrettMayson

I prefer objectParent for reasons above.

LinkIsGrim avatar Mar 03 '24 05:03 LinkIsGrim

I prefer objectParent for reasons above.

Same.

johnb432 avatar Mar 17 '24 11:03 johnb432