-
-
Notifications
You must be signed in to change notification settings - Fork 540
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Needs Testmerge] Guestbook, from Mojave Sun (#2770)
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may not be viewable. --> <!-- You can view Contributing.MD for a detailed description of the pull request process. --> ## About The Pull Request This thing sucks to port, I'm going to be real with you. TODO: * [x] Make it sort of work * [x] Fix an error where adding a guest name doesn't work * [ ] ~~Make it so reading IDs only work at close range~~ out of scope * [x] Make it so you automatically know your ship's crewmates ~~and captains know other faction members~~ * [x] Something with ERTs * [ ] ~~Make the guestbook save across rounds~~ asked to not ![imagen](https://github.com/shiptest-ss13/Shiptest/assets/75212565/8943246e-145d-44b2-8284-3539fb09b565) ![imagen](https://github.com/shiptest-ss13/Shiptest/assets/75212565/8966bff4-8688-466e-88fa-2d73f71d2572) ![imagen](https://github.com/shiptest-ss13/Shiptest/assets/75212565/24e680be-e994-4aed-af3e-f4333d9b4a8d) This pull request ports the following: * Mojave-Sun/mojave-sun-13#2415 * Mojave-Sun/mojave-sun-13#2433 These PRs change how examining someone works. You have to walk up to someone and remember their face in order to recognize their voice. Names will still be displayed with people's IDs <!-- Describe The Pull Request. Please be sure every change is documented or this can delay review and even discourage maintainers from merging your PR! --> ## Why It's Good For The Game * The current anonymity system sucks for stealthy shit. You immediately know someone's real name. An improved system allows for more roleplay possibilities. * Kansatsu is more reliable. * You can rob people with a knife and a balaclava at the outpost, and they won't know who you are! <!-- Please add a short description of why you think these changes would benefit the game. If you can't justify it in words, it might not be worth adding. --> ## Changelog :cl: tweak: Identification Cards are now Access Cards. The only real difference is that your name only shows up on a double examine. refactor: Anonymous mechanics. Characters no longer instantly recognize each other, and need to properly memorize each other in order. You can recognize an unmasked person by ctrl-shift-clicking them. /:cl: <!-- Both :cl:'s are required for the changelog to work! You can put your name to the right of the first :cl: if you want to overwrite your GitHub username as author ingame. --> <!-- You can use multiple of the same prefix (they're only used for the icon ingame) and delete the unneeded ones. Despite some of the tags, changelogs should generally represent how a player might be affected by the changes rather than a summary of the PR's contents. --> --------- Signed-off-by: meem <[email protected]> Signed-off-by: Mark Suckerberg <[email protected]> Co-authored-by: Mark Suckerberg <[email protected]> Co-authored-by: goober3 <[email protected]>
- Loading branch information
1 parent
644b8cd
commit be90b8e
Showing
46 changed files
with
737 additions
and
163 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
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
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
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
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
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
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
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
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,148 @@ | ||
/** | ||
* THE GUESTBOOK DATUM // ripped straight from mojave. | ||
* | ||
* Essentially, this datum handles the people that a given human knows, | ||
* to handle getting the correct names on examine and saycode. | ||
*/ | ||
/datum/guestbook | ||
/// Associative list of known guests, real_name = known_name | ||
var/list/known_names | ||
|
||
/datum/guestbook/Destroy(force) | ||
known_names = null | ||
return ..() | ||
|
||
/datum/guestbook/ui_interact(mob/user, datum/tgui/ui) | ||
ui = SStgui.try_update_ui(user, src, ui) | ||
if(!ui) | ||
ui = new(user, src, "Guestbook", "[user.real_name]'s Guestbook") | ||
ui.set_autoupdate(FALSE) | ||
ui.open() | ||
|
||
/datum/guestbook/ui_state(mob/user) | ||
return GLOB.always_state | ||
|
||
/datum/guestbook/ui_data(mob/user) | ||
var/list/data = list() | ||
var/list/names = list() | ||
for(var/real_name in known_names) | ||
var/given_name = LAZYACCESS(known_names, real_name) | ||
names += list(list("real_name" = real_name, "given_name" = given_name)) | ||
data["names"] = names | ||
return data | ||
|
||
/datum/guestbook/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) | ||
. = ..() | ||
if(.) | ||
return . | ||
switch(action) | ||
if("rename_guest") | ||
var/real_name = params["real_name"] | ||
var/new_name = params["new_name"] | ||
new_name = reject_bad_name(new_name, max_length = 42) | ||
if(!new_name) | ||
to_chat(usr, span_warning("That's a pretty terrible name. <i>You can do better</i>.")) | ||
return FALSE | ||
if(!rename_guest(usr, null, real_name, new_name, silent = FALSE)) | ||
return FALSE | ||
return TRUE | ||
if("delete_guest") | ||
var/real_name = params["real_name"] | ||
if(!remove_guest(usr, null, real_name, silent = FALSE)) | ||
return FALSE | ||
return TRUE | ||
|
||
/datum/guestbook/proc/try_add_guest(mob/user, mob/living/carbon/human/guest, silent = FALSE) | ||
if(user == guest) | ||
if(!silent) | ||
to_chat(user, span_warning("That's you! You already know yourself plenty.")) | ||
return FALSE | ||
if(!visibility_checks(user, guest, silent)) | ||
return FALSE | ||
var/given_name = input(user, "What name do you want to give to [guest]?", "Guestbook Name", guest.get_visible_name()) | ||
if(!given_name) | ||
if(!silent) | ||
to_chat(user, span_warning("Nevermind.")) | ||
return FALSE | ||
given_name = reject_bad_name(given_name) | ||
if(!given_name) | ||
if(!silent) | ||
to_chat(user, span_warning("That's a pretty terrible name. You can do better.")) | ||
return FALSE | ||
if(!visibility_checks(user, guest, silent)) | ||
return FALSE | ||
var/face_name = guest.get_face_name("ForgetMeNot") | ||
if(LAZYACCESS(known_names, face_name)) | ||
if(!rename_guest(user, guest, face_name, given_name, silent)) | ||
return FALSE | ||
else | ||
if(!add_guest(user, guest, face_name, given_name, silent)) | ||
return FALSE | ||
return TRUE | ||
|
||
/datum/guestbook/proc/add_guest(mob/user, mob/living/carbon/guest, real_name, given_name, silent = TRUE) | ||
//Already exists, should be handled by rename_guest() | ||
var/existing_name = LAZYACCESS(known_names, real_name) | ||
if(existing_name) | ||
if(!silent) | ||
to_chat(user, span_warning("You already know them as \"[existing_name]\".")) | ||
return FALSE | ||
LAZYADDASSOC(known_names, real_name, given_name) | ||
if(!silent) | ||
to_chat(user, span_notice("You memorize the face of [guest] as \"[given_name]\".")) | ||
return TRUE | ||
|
||
/datum/guestbook/proc/rename_guest(mob/user, mob/living/carbon/guest, real_name, given_name, silent = TRUE) | ||
var/old_name = LAZYACCESS(known_names, real_name) | ||
if(!old_name) | ||
return FALSE | ||
known_names[real_name] = given_name | ||
if(!silent) | ||
to_chat(user, span_notice("You re-memorize the face of \"[old_name]\" as \"[given_name]\".")) | ||
return TRUE | ||
|
||
/datum/guestbook/proc/try_remove_guest(mob/user, mob/living/carbon/human/guest, silent = FALSE) | ||
if(user == guest) | ||
if(!silent) | ||
to_chat(user, span_warning("That's you! You'll never forget yourself.")) | ||
return | ||
if(!visibility_checks(user, guest, silent)) | ||
return FALSE | ||
var/face_name = guest.get_face_name("ForgetMeNot") | ||
if(!remove_guest(user, guest, face_name, silent)) | ||
return FALSE | ||
return TRUE | ||
|
||
/datum/guestbook/proc/remove_guest(mob/user, mob/living/carbon/guest, real_name, silent = TRUE) | ||
//Already exists, should be handled by rename_guest() | ||
var/existing_name = LAZYACCESS(known_names, real_name) | ||
if(!existing_name) | ||
if(!silent) | ||
to_chat(user, span_warning("You don't know them in the first place.")) | ||
return FALSE | ||
LAZYREMOVE(known_names, real_name) | ||
if(!silent) | ||
to_chat(user, span_notice("You forget the face of \"[existing_name]\".")) | ||
return TRUE | ||
|
||
/datum/guestbook/proc/get_known_name(mob/user, mob/living/carbon/guest, real_name) | ||
if(user == guest || isAdminObserver(user)) | ||
return real_name | ||
return LAZYACCESS(known_names, real_name) | ||
|
||
/datum/guestbook/proc/visibility_checks(mob/user, mob/living/carbon/human/guest, silent = FALSE) | ||
if(QDELETED(guest)) | ||
if(!silent) | ||
to_chat(user, span_warning("What?")) | ||
return FALSE | ||
var/visible_name = guest.get_visible_name("") | ||
var/face_name = guest.get_face_name("") | ||
if(!visible_name || !face_name) | ||
if(!silent) | ||
to_chat(user, span_warning("You can't see their face very well!")) | ||
return FALSE | ||
if(get_dist(user, guest) > 4) | ||
if(!silent) | ||
to_chat(user, span_warning("You need to take a closer look at them!")) | ||
return FALSE | ||
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
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
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
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
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
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.