-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Sane-ify in-vehicle movement size checks #74004
Conversation
OK I have no good suggestions to solve the bashing. It's not that they're bashing terrain, they just aren't bashing except 1 in 50 times. Lines 1703 to 1711 in 5b4b49b
Profiling suggests it is not gamebreaking to just check creature::can_move_to_vehicle_tile again, so that was the solution I went with. |
If the volume of a tile is smaller than yours, break it up instead of moving to it |
This looks like a huge improvement. The flying thing seems reasonable to cut, too. I wanted to make it so that removing your roof would expose you to wasp attacks, but I think they can just fly to z+1 and sting you from above if you're in a convertible. |
Seems this may be causing lingering cramped effect if this was changed by 2129. |
Seems it occurs when walking into tiles with (broken?) large guns. |
Do vehicle roofs protect against wasp stings from Z+1? |
There's still something wrong. I'm getting the cramped effect from entering any interior tile of any car. Character is normal sized and naked, inventory is empty, no items on the seat. At least the effect isn't permanent now, but it shouldn't be happening to begin with. Edit: Check out a Luxury RV. The front section of the camper causes the cramped effect, but part of the back doesn't. Might be useful. The tiles that don't cause the effect have a frame, roof, aisle lights, and a floor trunk. There are tiles in the front of the camper that are the same except for having an aisle instead of a floor trunk, and do cause the cramped effect. |
Can confirm this. |
return false; | ||
} | ||
|
||
if( critter_volume < free_cargo * 1.33 ) { |
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.
Am I reading this right? If the creature's volume is less than a third over the free cargo space and isn't a monster, snake, blob or fish-type then it's cramped? Shouldn't the check be for if the creature's volume greater than a third over free cargo space?
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.
Reading it right, interpreting it wrong. If the critter is greater than the free cargo size, it can't move into this tile in the first place - we return false earlier in the function. https://github.com/CleverRaven/Cataclysm-DDA/pull/74004/files#diff-5a026da090b6664f91c5f3bc4a9d0844cff966ef6fa5785d258b3aa47b370a2cR253
But yeah this logic is confusing, and part of the reason why I wanted to get rid of the huge block of volume comparisons shown.
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.
Ah, yeah, point. I was so focused on chasing down what was setting cramped to true I failed to remember what the whole function was about.
That said, I'm reasonably sure this particular check is the culprit when it comes to #74068 since commenting out cramped = true;
and recompiling prevents the behavior reported there from occurring.
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.
Yes, the equation should be free_cargo * 0.75 < critter_volume
instead,
thus we set cramped when free_cargo * 0.75 < critter_volume && critter_volume <= free_cargo
I'm already working on it tonight, this whole thing is still a mess.
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 tested critter_volume * 0.75 < free_cargo && critter_volume <= free_cargo
and it's still setting cramped to true.
Summary
None
Purpose of change
(in multiple places)
NPC magically acquires cramped space effect because of vehicle 3 tiles away

Wall of trunks with cargo is invincible to the zombie hordes (waited one hour)

Describe the solution
De-duplicate code
Concentrate all checks in one creature function instead of repeating it all over the place
Use tripoint_abs_ms instead of raw tripoints
Don't apply cramped space effects when evaluating places to move to (that's why the function is const...)
FUNCTIONAL CHANGES:
Removed the flying bypass for open top vehicle tiles, since it did not check the actual z-level above or anything. I'm not interested in writing a bunch of checks for this and it's just plain incorrect.
Make monsters bash the vehicle if they can't move through it,
they're trying to bash the terrain right nowby checking creature::can_move_to_vehicle_tile again... I don't like this but it doesn't seem to explode anything in testingBecause the calculation changed to sane-ify volume, some vehicle parts which previously were free to traverse might now give the cramped space effect.
Describe alternatives you've considered
Lots of reverting.
Testing
Additional context
There should be no functional changes aside from that which is noted