summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgumi <git@gumi.ca>2020-04-25 17:41:37 -0400
committergumi <git@gumi.ca>2020-04-25 17:49:40 -0400
commitabde741d2821029efae61772dabae27d903166fc (patch)
treee309b10107992c9af1e6dd4c4bba7425461e8c5c
parenta182c50ae02548557fb10d0bfc69f8bac6c81a3c (diff)
downloadserverdata-abde741d2821029efae61772dabae27d903166fc.tar.gz
serverdata-abde741d2821029efae61772dabae27d903166fc.tar.bz2
serverdata-abde741d2821029efae61772dabae27d903166fc.tar.xz
serverdata-abde741d2821029efae61772dabae27d903166fc.zip
add a changesex pseudo-atcommand
-rw-r--r--npc/commands/gender.txt35
-rw-r--r--npc/functions/gender.txt13
-rw-r--r--npc/scripts.conf2
3 files changed, 50 insertions, 0 deletions
diff --git a/npc/commands/gender.txt b/npc/commands/gender.txt
new file mode 100644
index 00000000..b852beb0
--- /dev/null
+++ b/npc/commands/gender.txt
@@ -0,0 +1,35 @@
+// @gender atcommand
+// changes or returns the gender
+
+- script @gender 32767,{
+ end;
+
+OnCall:
+ if (.@atcmd_parameters$[0] == "") {
+ dispbottom("Your current gender is " + genderToString());
+ end;
+ }
+
+ .@desired = stringToGender(.@atcmd_parameters$[0]);
+
+ if (.@desired == Gender) {
+ dispbottom("Your gender is already " + genderToString());
+ } else {
+ Gender = .@desired;
+ dispbottom("Gender changed to " + genderToString());
+ }
+ end;
+
+OnInit:
+ bindatcmd("gender", "@gender::OnCall", 99, 99, false);
+ add_group_command("gender", 40, true, false);
+ add_group_command("gender", 50, true, true);
+ add_group_command("gender", 60, true, true);
+ add_group_command("gender", 80, true, true);
+
+ bindatcmd("changesex", "@gender::OnCall", 99, 99, false);
+ add_group_command("changesex", 40, true, false);
+ add_group_command("changesex", 50, true, true);
+ add_group_command("changesex", 60, true, true);
+ add_group_command("changesex", 80, true, true);
+}
diff --git a/npc/functions/gender.txt b/npc/functions/gender.txt
new file mode 100644
index 00000000..7685ffa9
--- /dev/null
+++ b/npc/functions/gender.txt
@@ -0,0 +1,13 @@
+function script stringToGender {
+ .@short$ = strtolower(charat(getarg(0, ""), 0));
+
+ return .@short$ == "f" ? GENDER_FEMALE :
+ .@short$ == "m" ? GENDER_MALE : GENDER_NONBINARY;
+}
+
+function script genderToString {
+ .@gender = getarg(0, Gender);
+
+ return .@gender == GENDER_FEMALE ? l("female") :
+ .@gender == GENDER_MALE ? l("male") : l("non-binary");
+}
diff --git a/npc/scripts.conf b/npc/scripts.conf
index f003912e..330f6c62 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -12,6 +12,7 @@
"npc/functions/RNGesus.txt",
"npc/functions/math.txt",
"npc/functions/warp.txt",
+"npc/functions/gender.txt",
// Misc functions
"npc/functions/main.txt",
@@ -127,6 +128,7 @@
"npc/commands/super-menu.txt",
"npc/commands/resync.txt",
"npc/commands/python.txt",
+"npc/commands/gender.txt",
// config script
"npc/config/hairstyle_config.txt",