-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
JSONize gates #15945
JSONize gates #15945
Conversation
The renaming was made, because I think the function really belongs to the 'game' class, but since it changes only one tile and doesn't know a thing about 'gates', the name should be more generic.
Great work! |
Thanks. Good idea, makes sense to me. Since multiple levers/poles/ropes already exist to trigger the gates (in existing saved games as well), the |
const int wall_x = pos.x + dx[i]; | ||
const int wall_y = pos.y + dy[i]; | ||
|
||
if( g->m.ter( wall_x, wall_y ) != gate.get_wall() ) { |
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.
Would be better if it used the 3D (tripoint) map::ter
rather than the compatibility 2D one. That way NPCs could be made to use it too.
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.
Agree. Good suggestion.
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.
Done.
Follows #15927. Hard-coded gates no more. We can now modify/expand them freely. The gate code was placed to separate files to de-bloat the rest a tiny bit. Fix: closing gate damages contents of all involved tiles, not only the first damageable. Also, a gate can now be opened by both player's activity and completely by itself (the player witnessing). It would be useful e.g. for quests with restricted areas.
Edit: NPCs could now use gates as well (2D points are replaced with 3D ones according to @Coolthulhu 's suggestion).