X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fw_crylink.qc;h=d45edbbed7bc58bc2962eb0cb9af48b186569936;hp=21f3790fa5bef1bd4549debd90d9394fbdab7115;hb=36810e8ddba12c1959bc07e4c80630454c6f85a8;hpb=c74eb28792cb147e9e7427d4080a8f020a754490 diff --git a/qcsrc/server/w_crylink.qc b/qcsrc/server/w_crylink.qc index 21f3790fa..d45edbbed 100644 --- a/qcsrc/server/w_crylink.qc +++ b/qcsrc/server/w_crylink.qc @@ -9,6 +9,9 @@ REGISTER_WEAPON(CRYLINK, w_crylink, IT_CELLS, 6, WEP_FLAG_NORMAL | WEP_TYPE_SPLA .entity queuenext; .entity queueprev; +// weapon load persistence, for weapons that support reloading +.float crylink_load; + void W_Crylink_SetAmmoCounter() { // set clip_load to the weapon we have switched to, if the gun uses reloading @@ -581,6 +584,7 @@ void spawnfunc_weapon_crylink (void) float w_crylink(float req) { + float ammo_amount; if (req == WR_AIM) { if (random() < 0.10) @@ -672,10 +676,9 @@ float w_crylink(float req) if(self.crylink_lastgroup && self.crylink_waitrelease) return TRUE; - if(autocvar_g_balance_crylink_reload_ammo) - return self.crylink_load >= autocvar_g_balance_crylink_primary_ammo; - else - return self.ammo_cells >= autocvar_g_balance_crylink_primary_ammo; + ammo_amount = self.ammo_cells >= autocvar_g_balance_crylink_primary_ammo; + ammo_amount += (autocvar_g_balance_crylink_reload_ammo && self.crylink_load >= autocvar_g_balance_crylink_primary_ammo); + return ammo_amount; } else if (req == WR_CHECKAMMO2) { @@ -683,23 +686,18 @@ float w_crylink(float req) if(self.crylink_lastgroup && self.crylink_waitrelease) return TRUE; - if(autocvar_g_balance_crylink_reload_ammo) - return self.crylink_load >= autocvar_g_balance_crylink_secondary_ammo; - else - return self.ammo_cells >= autocvar_g_balance_crylink_secondary_ammo; + ammo_amount = self.ammo_cells >= autocvar_g_balance_crylink_secondary_ammo; + ammo_amount += (autocvar_g_balance_crylink_reload_ammo && self.crylink_load >= autocvar_g_balance_crylink_secondary_ammo); + return ammo_amount; } - else if (req == WR_RELOAD) + else if (req == WR_RESETPLAYER) { - W_Crylink_Reload(); + // all weapons must be fully loaded when we spawn + self.crylink_load = autocvar_g_balance_crylink_reload_ammo; } - else if (req == WR_SWITCHABLE) + else if (req == WR_RELOAD) { - // checks if this weapon can be switched to, when reloading is enabled - // returns true if there's either enough load in the weapon to use it, - // or we have enough ammo to reload the weapon to a usable point - float ammo_amount; - ammo_amount = min(autocvar_g_balance_crylink_primary_ammo, autocvar_g_balance_crylink_secondary_ammo); - return self.crylink_load >= ammo_amount || self.ammo_cells >= ammo_amount; + W_Crylink_Reload(); } return TRUE; }; @@ -731,16 +729,16 @@ float w_crylink(float req) } else if (req == WR_SUICIDEMESSAGE) { - w_deathtypestring = "%s succeeded at self-destructing themself with the Crylink"; + w_deathtypestring = _("%s succeeded at self-destructing themself with the Crylink"); } else if (req == WR_KILLMESSAGE) { if(w_deathtype & HITTYPE_BOUNCE) - w_deathtypestring = "%s could not hide from %s's Crylink"; // unchecked: SPLASH (SECONDARY can't be) + w_deathtypestring = _("%s could not hide from %s's Crylink"); // unchecked: SPLASH (SECONDARY can't be) else if(w_deathtype & HITTYPE_SPLASH) - w_deathtypestring = "%s was too close to %s's Crylink"; // unchecked: SECONDARY + w_deathtypestring = _("%s was too close to %s's Crylink"); // unchecked: SECONDARY else - w_deathtypestring = "%s took a close look at %s's Crylink"; // unchecked: SECONDARY + w_deathtypestring = _("%s took a close look at %s's Crylink"); // unchecked: SECONDARY } return TRUE; }