Helper to enable auto-use of Bacta Canister

Thanks again to @MuadDib for this one!
This commit is contained in:
Simon 2022-11-16 21:30:19 +00:00
parent f179693772
commit f014078518
6 changed files with 32 additions and 7 deletions

View file

@ -625,6 +625,7 @@ extern vmCvar_t cg_saberAutoThird;
extern vmCvar_t cg_gunAutoFirst;
extern vmCvar_t cg_debugSaberCombat;
extern vmCvar_t cg_saberBurnMarkCoolDownTime;
extern vmCvar_t cg_autoUseBacta;
extern vmCvar_t cg_zProj;
extern vmCvar_t cg_stereoSeparation;

View file

@ -301,6 +301,7 @@ vmCvar_t cg_saberAutoThird;
vmCvar_t cg_gunAutoFirst;
vmCvar_t cg_debugSaberCombat;
vmCvar_t cg_saberBurnMarkCoolDownTime;
vmCvar_t cg_autoUseBacta;
vmCvar_t cg_thirdPersonAlpha;
vmCvar_t cg_thirdPersonAutoAlpha;
@ -446,6 +447,7 @@ static cvarTable_t cvarTable[] = {
{ &cg_gunAutoFirst, "cg_gunAutoFirst", "1", CVAR_ARCHIVE },
{ &cg_debugSaberCombat, "cg_debugSaberCombat", "0", CVAR_ARCHIVE },
{ &cg_saberBurnMarkCoolDownTime, "cg_saberBurnMarkCoolDownTime", "0", CVAR_ARCHIVE },
{ &cg_autoUseBacta, "cg_autoUseBacta", "0", CVAR_ARCHIVE },
{ &cg_pano, "pano", "0", 0 },
{ &cg_panoNumShots, "panoNumShots", "10", 0 },

View file

@ -5210,6 +5210,12 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, vec3_
targ->health = 1;
}
}
else if ( !alreadyDead && targ->health <=0 && targ->client->ps.inventory[INV_BACTA_CANISTER] && cg_autoUseBacta.integer)
{
targ->health = 25;
targ->client->ps.inventory[INV_BACTA_CANISTER]--;
G_SoundOnEnt( targ, CHAN_VOICE, va( "sound/weapons/force/heal%d.mp3", Q_irand( 1, 4 ) ) );
}
else if ( targ->health < 1 && attacker->client )
{ // The player or NPC just killed an enemy so increment the kills counter
attacker->client->ps.persistant[PERS_ENEMIES_KILLED]++;
@ -5266,6 +5272,12 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, vec3_
targ->health = 1;
}
}
else if ( !alreadyDead && targ->health <=0 && targ->client->ps.inventory[INV_BACTA_CANISTER] && cg_autoUseBacta.integer)
{
targ->health = 25;
targ->client->ps.inventory[INV_BACTA_CANISTER]--;
G_SoundOnEnt( targ, CHAN_VOICE, va( "sound/weapons/force/heal%d.mp3", Q_irand( 1, 4 ) ) );
}
else if ( targ->health < 0 )
{
targ->health = 0;

View file

@ -3,7 +3,7 @@ CONFIG W:\bin\striped.cfg
ID 100
REFERENCE MENUS_VR
DESCRIPTION "VR Menu Localizations"
COUNT 117
COUNT 119
INDEX 0
{
REFERENCE COMMON_CONTROLS_ITEM
@ -589,3 +589,13 @@ INDEX 116
REFERENCE CROUCH_IRL_1ST_PERSON
TEXT_LANGUAGE1 "1st Person"
}
INDEX 117
{
REFERENCE AUTO_USE_BACTA_ITEM
TEXT_LANGUAGE1 "Auto Use Bacta:"
}
INDEX 118
{
REFERENCE AUTO_USE_BACTA_DESC
TEXT_LANGUAGE1 "When enabled, automatically uses bacta canister before dying."
}

View file

@ -1740,8 +1740,8 @@
name none
group invcontrols
type ITEM_TYPE_YESNO
text "Placeholder:"
cvar "place_holder"
text @MENUS_VR_AUTO_USE_BACTA_ITEM
cvar "cg_autoUseBacta"
rect 305 191 300 20
textalign ITEM_ALIGN_RIGHT
textalignx 151
@ -1751,7 +1751,7 @@
forecolor 1 1 1 1
visible 0
// appearance_slot 1
descText "Item placeholder."
descText @MENUS_VR_AUTO_USE_BACTA_DESC
action
{
play sound/interface/button1

View file

@ -1740,8 +1740,8 @@
name none
group invcontrols
type ITEM_TYPE_YESNO
text "Placeholder:"
cvar "place_holder"
text @MENUS_VR_AUTO_USE_BACTA_ITEM
cvar "cg_autoUseBacta"
rect 305 191 300 20
textalign ITEM_ALIGN_RIGHT
textalignx 151
@ -1751,7 +1751,7 @@
forecolor 1 1 1 1
visible 0
// appearance_slot 1
descText "Item placeholder."
descText @MENUS_VR_AUTO_USE_BACTA_DESC
action
{
play sound/interface/button1