-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
"Ferry passengers" missions and general revamp
- Loading branch information
Showing
21 changed files
with
409 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
mechanics/economy/commodities/specials/vip_passengers.tres
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
extends SaveableResource | ||
class_name PassengerQuarters | ||
|
||
## Represents passenger quarters on a ship. | ||
|
||
## The total number of passenger spaces available. | ||
@export var total_spaces: int: | ||
set(value): | ||
assert(value >= 0, "Total spaces must be non-negative") | ||
if total_spaces == value: | ||
return | ||
|
||
total_spaces = value | ||
self.emit_changed() | ||
|
||
## The number of passenger spaces currently occupied. | ||
@export var occupied_spaces: int: | ||
set(value): | ||
assert(value >= 0 and value <= total_spaces, "Occupied spaces must be between 0 and total spaces") | ||
if occupied_spaces == value: | ||
return | ||
|
||
occupied_spaces = value | ||
self.emit_changed() | ||
|
||
## Attempts to add exactly [param count] passengers, or returns false if there's not enough space. | ||
func add_passengers(count: int) -> bool: | ||
if self.occupied_spaces + count > self.total_spaces: | ||
return false | ||
|
||
self.occupied_spaces += count | ||
return true | ||
|
||
## Attempts to remove exactly [param count] passengers, or returns false if there aren't that many passengers. | ||
func remove_passengers(count: int) -> bool: | ||
if count < self.occupied_spaces: | ||
return false | ||
|
||
self.occupied_spaces -= count | ||
return true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.