]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add default values to most Items guide entries TimePath/guide 181/head
authorotta8634 <k9wolf@pm.me>
Sat, 17 May 2025 07:14:41 +0000 (15:14 +0800)
committerotta8634 <k9wolf@pm.me>
Sat, 17 May 2025 07:14:41 +0000 (15:14 +0800)
Knowing how much health/armor you get from a MA/MH and whatnot seems useful for a newbie.
Same for ammo from ammo pickups.

qcsrc/common/items/item/ammo.qc
qcsrc/common/items/item/armor.qc
qcsrc/common/items/item/health.qc
qcsrc/common/items/item/jetpack.qc

index 24f76b60e6517880eaf233abe897f97dddb548a3..a6d6662fe251941c378414c9e08e898cb1bfb326 100644 (file)
@@ -11,6 +11,10 @@ METHOD(Ammo, describe, string(Ammo this))
     FOREACH(Weapons, it.ammo_type == ammo, {
         s = strcat(s, "\n  ", COLORED_NAME(it));
     });
+       const string nname = this.netname == "bullets" ? "nails" : this.netname;
+       s = sprintf(_("%s\n\nBy default, the pickup gives you %s ammo, to a maximum of %s."),
+               s, cvar_defstring(strcat("g_pickup_", nname)), cvar_defstring(sprintf("g_pickup_%s_max", nname)));
+       // TODO: rename all *nails* cvars to bullets
     return s;
 }
 #endif
index 737939ee1262db7ba3f96cc788b42441805a325d..150d410828691a32305ab285e59afc698c018f3e 100644 (file)
@@ -3,28 +3,31 @@
 #ifdef MENUQC
 #include <common/gamemodes/gamemode/duel/duel.qh>
 
+#define DEFAULT_PICKUP_ARMOR(s) \
+       sprintf(_("By default, the pickup gives you %s armor."), cvar_defstring(strcat("g_pickup_armor", s)))
+
 METHOD(ArmorSmall, describe, string(ArmorSmall this))
 {
     TC(ArmorSmall, this);
     return sprintf(_("The %s provides you a small amount of armor when picked up, "
-        "protecting you from damage by absorbing incoming hits until it is depleted."),
-    COLORED_NAME(this));
+        "protecting you from damage by absorbing incoming hits until it is depleted.\n\n%s"),
+    COLORED_NAME(this), DEFAULT_PICKUP_ARMOR("small"));
 }
 
 METHOD(ArmorMedium, describe, string(ArmorMedium this))
 {
     TC(ArmorMedium, this);
     return sprintf(_("The %s provides you a medium amount of armor when picked up, "
-        "protecting you from damage by absorbing incoming hits until it is depleted."),
-    COLORED_NAME(this));
+        "protecting you from damage by absorbing incoming hits until it is depleted.\n\n%s"),
+    COLORED_NAME(this), DEFAULT_PICKUP_ARMOR("medium"));
 }
 
 METHOD(ArmorBig, describe, string(ArmorBig this))
 {
     TC(ArmorBig, this);
     return sprintf(_("The %s provides you a large amount of armor when picked up, "
-        "protecting you from damage by absorbing incoming hits until it is depleted."),
-    COLORED_NAME(this));
+        "protecting you from damage by absorbing incoming hits until it is depleted.\n\n%s"),
+    COLORED_NAME(this), DEFAULT_PICKUP_ARMOR("big"));
 }
 
 METHOD(ArmorMega, describe, string(ArmorMega this))
@@ -32,7 +35,9 @@ METHOD(ArmorMega, describe, string(ArmorMega this))
     TC(ArmorMega, this);
     return sprintf(_("The %s provides you a huge amount of armor when picked up, "
         "protecting you from damage by absorbing incoming hits until it is depleted.\n\n"
-        "It tends to be one of the most highly contested items on a map, particularly in game modes like %s."),
-    COLORED_NAME(this), COLORED_NAME(MAPINFO_TYPE_DUEL));
+        "It tends to be one of the most highly contested items on a map, particularly in game modes like %s.\n\n%s"),
+    COLORED_NAME(this), COLORED_NAME(MAPINFO_TYPE_DUEL), DEFAULT_PICKUP_ARMOR("mega"));
 }
+
+#undef DEFAULT_PICKUP_ARMOR
 #endif
index 8f48e81ef39565092240e1cade7efaa1f2e5ed71..e2408077db2485bebf48d788100738e016c352e1 100644 (file)
@@ -3,28 +3,31 @@
 #ifdef MENUQC
 #include <common/gamemodes/gamemode/duel/duel.qh>
 
+#define DEFAULT_PICKUP_HEALTH(s) \
+       sprintf(_("By default, the pickup gives you %s health."), cvar_defstring(strcat("g_pickup_health", s)))
+
 METHOD(HealthSmall, describe, string(HealthSmall this))
 {
     TC(HealthSmall, this);
     return sprintf(_("The %s restores a small amount of health when picked up, "
-        "helping you recover from damage taken during combat."),
-    COLORED_NAME(this));
+        "helping you recover from damage taken during combat.\n\n%s"),
+    COLORED_NAME(this), DEFAULT_PICKUP_HEALTH("small"));
 }
 
 METHOD(HealthMedium, describe, string(HealthMedium this))
 {
     TC(HealthMedium, this);
     return sprintf(_("The %s restores a medium amount of health when picked up, "
-        "helping you recover from damage taken during combat."),
-    COLORED_NAME(this));
+        "helping you recover from damage taken during combat.\n\n%s"),
+    COLORED_NAME(this), DEFAULT_PICKUP_HEALTH("medium"));
 }
 
 METHOD(HealthBig, describe, string(HealthBig this))
 {
     TC(HealthBig, this);
     return sprintf(_("The %s restores a large amount of health when picked up, "
-        "helping you recover from damage taken during combat."),
-    COLORED_NAME(this));
+        "helping you recover from damage taken during combat.\n\n%s"),
+    COLORED_NAME(this), DEFAULT_PICKUP_HEALTH("big"));
 }
 
 METHOD(HealthMega, describe, string(HealthMega this))
@@ -32,7 +35,9 @@ METHOD(HealthMega, describe, string(HealthMega this))
     TC(HealthMega, this);
     return sprintf(_("The %s restores a huge amount of health when picked up, "
         "helping you recover from damage taken during combat.\n\n"
-        "It tends to be one of the most highly contested items on a map, particularly in game modes like %s."),
-    COLORED_NAME(this), COLORED_NAME(MAPINFO_TYPE_DUEL));
+        "It tends to be one of the most highly contested items on a map, particularly in game modes like %s.\n\n%s"),
+    COLORED_NAME(this), COLORED_NAME(MAPINFO_TYPE_DUEL), DEFAULT_PICKUP_HEALTH("mega"));
 }
+
+#undef DEFAULT_PICKUP_HEALTH
 #endif
index 9370e7c03cd47af2869e181d6657a586ce3416d9..fc9cea992a64065fb475ae61256a848e25394398 100644 (file)
@@ -29,8 +29,11 @@ METHOD(Jetpack, describe, string(Jetpack this))
 METHOD(JetpackFuel, describe, string(JetpackFuel this))
 {
        TC(JetpackFuel, this);
-       return sprintf(_("The %s ammo type is used by the %s."),
+       string s = sprintf(_("The %s ammo type is used by the %s."),
        COLORED_NAME(this), COLORED_NAME(ITEM_Jetpack));
+       s = sprintf(_("%s\n\nBy default, the pickup gives you %s ammo, to a maximum of %s."),
+               s, cvar_defstring("g_pickup_fuel"), cvar_defstring("g_pickup_fuel_max"));
+       return s;
 }
 
 METHOD(JetpackRegen, describe, string(JetpackRegen this))