Give all weapons an .isempty and .type definition to help the botlib AI

a little more
This commit is contained in:
Marco Cawthorne 2022-03-10 18:59:25 -08:00
parent 150d5a2541
commit 4f573b1571
Signed by: eukara
GPG key ID: C196CD8BA993248A
14 changed files with 257 additions and 3 deletions

View file

@ -379,10 +379,26 @@ w_crossbow_hudpic(int selected, vector pos, float a)
#endif
}
int
w_crossbow_isempty(void)
{
player pl = (player)self;
if (pl.crossbow_mag <= 0 && pl.ammo_bolt <= 0)
return 1;
return 0;
}
weapontype_t w_crossbow_type(void)
{
return WPNTYPE_RANGED;
}
weapon_t w_crossbow =
{
.name = "crossbow",
.id = ITEM_CROSSBOW,
.id = ITEM_CROSSBOW,
.slot = 2,
.slot_pos = 2,
.weight = 10,
@ -400,6 +416,8 @@ weapon_t w_crossbow =
.pmodel = w_crossbow_pmodel,
.deathmsg = w_crossbow_deathmsg,
.aimanim = w_crossbow_aimanim,
.isempty = w_crossbow_isempty,
.type = w_crossbow_type,
.hudpic = w_crossbow_hudpic
};

View file

@ -204,6 +204,17 @@ w_crowbar_hudpic(int selected, vector pos, float a)
#endif
}
int
w_crowbar_isempty(void)
{
return 0;
}
weapontype_t w_crowbar_type(void)
{
return WPNTYPE_CLOSE;
}
weapon_t w_crowbar =
{
.name = "crowbar",
@ -225,6 +236,8 @@ weapon_t w_crowbar =
.pmodel = w_crowbar_pmodel,
.deathmsg = w_crowbar_deathmsg,
.aimanim = w_crowbar_aimanim,
.isempty = w_crowbar_isempty,
.type = w_crowbar_type,
.hudpic = w_crowbar_hudpic
};

View file

@ -287,6 +287,23 @@ void w_egon_hudpic(int selected, vector pos, float a)
#endif
}
int
w_egon_isempty(void)
{
player pl = (player)self;
if (pl.ammo_uranium <= 0)
return 1;
return 0;
}
weapontype_t
w_egon_type(void)
{
return WPNTYPE_RANGED;
}
weapon_t w_egon =
{
.name = "egon",
@ -309,6 +326,8 @@ weapon_t w_egon =
.deathmsg = w_egon_deathmsg,
.aimanim = w_egon_aimanim,
.hudpic = w_egon_hudpic,
.isempty = w_egon_isempty,
.type = w_egon_type,
.predraw = w_egon_postdraw
};

View file

@ -363,6 +363,23 @@ void w_gauss_hudpic(int selected, vector pos, float a)
#endif
}
int
w_gauss_isempty(void)
{
player pl = (player)self;
if (pl.ammo_uranium <= 0)
return 1;
return 0;
}
weapontype_t
w_gauss_type(void)
{
return WPNTYPE_RANGED;
}
weapon_t w_gauss =
{
.name = "gauss",
@ -384,6 +401,8 @@ weapon_t w_gauss =
.pmodel = w_gauss_pmodel,
.deathmsg = w_gauss_deathmsg,
.aimanim = w_gauss_aimanim,
.isempty = w_gauss_isempty,
.type = w_gauss_type,
.hudpic = w_gauss_hudpic
};

View file

@ -388,6 +388,23 @@ w_glock_hudpic(int selected, vector pos, float a)
#endif
}
int
w_glock_isempty(void)
{
player pl = (player)self;
if (pl.glock_mag <= 0 && pl.ammo_9mm <= 0)
return 1;
return 0;
}
weapontype_t
w_glock_type(void)
{
return WPNTYPE_RANGED;
}
weapon_t w_glock =
{
.name = "9mmhandgun",
@ -409,6 +426,8 @@ weapon_t w_glock =
.pmodel = w_glock_pmodel,
.deathmsg = w_glock_deathmsg,
.aimanim = w_glock_aimanim,
.isempty = w_glock_isempty,
.type = w_glock_type,
.hudpic = w_glock_hudpic
};

View file

@ -244,6 +244,23 @@ w_handgrenade_hudpic(int selected, vector pos, float a)
#endif
}
int
w_handgrenade_isempty(void)
{
player pl = (player)self;
if (pl.ammo_handgrenade <= 0)
return 1;
return 0;
}
weapontype_t
w_handgrenade_type(void)
{
return WPNTYPE_THROW;
}
weapon_t w_handgrenade =
{
.name = "grenade",
@ -265,6 +282,8 @@ weapon_t w_handgrenade =
.pmodel = w_handgrenade_pmodel,
.deathmsg = w_handgrenade_deathmsg,
.aimanim = w_handgrenade_aimanim,
.isempty = w_handgrenade_isempty,
.type = w_handgrenade_type,
.hudpic = w_handgrenade_hudpic
};

View file

@ -301,10 +301,22 @@ w_hornetgun_hudpic(int selected, vector pos, float a)
#endif
}
int
w_hornetgun_isempty(void)
{
return 0;
}
weapontype_t
w_hornetgun_type(void)
{
return WPNTYPE_RANGED;
}
weapon_t w_hornetgun =
{
.name = "hornet",
.id = ITEM_HORNETGUN,
.id = ITEM_HORNETGUN,
.slot = 3,
.slot_pos = 3,
.weight = 10,
@ -322,6 +334,8 @@ weapon_t w_hornetgun =
.pmodel = w_hornetgun_pmodel,
.deathmsg = w_hornetgun_deathmsg,
.aimanim = w_hornetgun_aimanim,
.isempty = w_hornetgun_isempty,
.type = w_hornetgun_type,
.hudpic = w_hornetgun_hudpic
};

View file

@ -384,6 +384,23 @@ w_mp5_hudpic(int selected, vector pos, float a)
#endif
}
int
w_mp5_isempty(void)
{
player pl = (player)self;
if (pl.mp5_mag <= 0 && pl.ammo_9mm <= 0 && pl.ammo_m203_grenade <= 0)
return 1;
return 0;
}
weapontype_t
w_mp5_type(void)
{
return WPNTYPE_RANGED;
}
weapon_t w_mp5 =
{
.name = "9mmAR",
@ -405,6 +422,8 @@ weapon_t w_mp5 =
.pmodel = w_mp5_pmodel,
.deathmsg = w_mp5_deathmsg,
.aimanim = w_mp5_aimanim,
.isempty = w_mp5_isempty,
.type = w_mp5_type,
.hudpic = w_mp5_hudpic
};

View file

@ -340,6 +340,23 @@ w_python_hudpic(int selected, vector pos, float a)
#endif
}
int
w_python_isempty(void)
{
player pl = (player)self;
if (pl.python_mag <= 0 && pl.ammo_357 <= 0)
return 1;
return 0;
}
weapontype_t
w_python_type(void)
{
return WPNTYPE_RANGED;
}
weapon_t w_python =
{
.name = "357",
@ -361,6 +378,8 @@ weapon_t w_python =
.pmodel = w_python_pmodel,
.deathmsg = w_python_deathmsg,
.aimanim = w_python_aimanim,
.isempty = w_python_isempty,
.type = w_python_type,
.hudpic = w_python_hudpic
};

View file

@ -338,10 +338,27 @@ void w_rpg_hud(void)
#endif
}
int
w_rpg_isempty(void)
{
player pl = (player)self;
if (pl.rpg_mag <= 0 && pl.ammo_rocket <= 0)
return 1;
return 0;
}
weapontype_t
w_rpg_type(void)
{
return WPNTYPE_RANGED;
}
weapon_t w_rpg =
{
.name = "rpg_rocket",
.id = ITEM_RPG,
.id = ITEM_RPG,
.slot = 3,
.slot_pos = 0,
.weight = 20,
@ -359,6 +376,8 @@ weapon_t w_rpg =
.pmodel = w_rpg_pmodel,
.deathmsg = w_rpg_deathmsg,
.aimanim = w_rpg_aimanim,
.isempty = w_rpg_isempty,
.type = w_rpg_type,
.hudpic = w_rpg_hudpic
};

View file

@ -309,6 +309,23 @@ w_satchel_hudpic(int selected, vector pos, float a)
#endif
}
int
w_satchel_isempty(void)
{
player pl = (player)self;
if (pl.satchel_chg <= 0)
return 1;
return 0;
}
weapontype_t
w_satchel_type(void)
{
return WPNTYPE_THROW;
}
weapon_t w_satchel =
{
.name = "satchel",
@ -330,6 +347,8 @@ weapon_t w_satchel =
.pmodel = w_satchel_pmodel,
.deathmsg = w_satchel_deathmsg,
.aimanim = w_satchel_aimanim,
.isempty = w_satchel_isempty,
.type = w_satchel_type,
.hudpic = w_satchel_hudpic
};

View file

@ -397,6 +397,23 @@ w_shotgun_hudpic(int selected, vector pos, float a)
#endif
}
int
w_shotgun_isempty(void)
{
player pl = (player)self;
if (pl.shotgun_mag <= 0 && pl.ammo_buckshot <= 0)
return 1;
return 0;
}
weapontype_t
w_shotgun_type(void)
{
return WPNTYPE_RANGED;
}
weapon_t w_shotgun =
{
.name = "shotgun",
@ -418,6 +435,8 @@ weapon_t w_shotgun =
.pmodel = w_shotgun_pmodel,
.deathmsg = w_shotgun_deathmsg,
.aimanim = w_shotgun_aimanim,
.isempty = w_shotgun_isempty,
.type = w_shotgun_type,
.hudpic = w_shotgun_hudpic
};

View file

@ -319,6 +319,23 @@ void w_snark_hudpic(int selected, vector pos, float a)
#endif
}
int
w_snark_isempty(void)
{
player pl = (player)self;
if (pl.ammo_snark <= 0)
return 1;
return 0;
}
weapontype_t
w_snark_type(void)
{
return WPNTYPE_RANGED;
}
weapon_t w_snark =
{
.name = "snark",
@ -340,6 +357,8 @@ weapon_t w_snark =
.pmodel = w_snark_pmodel,
.deathmsg = w_snark_deathmsg,
.aimanim = w_snark_aimanim,
.isempty = w_snark_isempty,
.type = w_snark_type,
.hudpic = w_snark_hudpic
};

View file

@ -375,6 +375,23 @@ w_tripmine_hudpic(int selected, vector pos, float a)
#endif
}
int
w_tripmine_isempty(void)
{
player pl = (player)self;
if (pl.ammo_tripmine <= 0)
return 1;
return 0;
}
weapontype_t
w_tripmine_type(void)
{
return WPNTYPE_CLOSE;
}
weapon_t w_tripmine =
{
.name = "tripmine",
@ -396,6 +413,8 @@ weapon_t w_tripmine =
.pmodel = w_tripmine_pmodel,
.deathmsg = w_tripmine_deathmsg,
.aimanim = w_tripmine_aimanim,
.isempty = w_tripmine_isempty,
.type = w_tripmine_type,
.hudpic = w_tripmine_hudpic
};