(SubgameEntity ent, SubgameEntity other, GameExportsImpl gameExports)
| 998 | public static EntInteractAdapter Pickup_Weapon = new EntInteractAdapter() { |
| 999 | public String getID() { return "Pickup_Weapon"; } |
| 1000 | public boolean interact(SubgameEntity ent, SubgameEntity other, GameExportsImpl gameExports) { |
| 1001 | int index; |
| 1002 | GameItem ammo; |
| 1003 | |
| 1004 | index = ent.item.index; |
| 1005 | |
| 1006 | gclient_t client = other.getClient(); |
| 1007 | if ((((int) (gameExports.gameCvars.dmflags.value) & Defines.DF_WEAPONS_STAY) != 0 || gameExports.gameCvars.coop.value != 0) |
| 1008 | && 0 != client.pers.inventory[index]) { |
| 1009 | if (0 == (ent.spawnflags & (GameDefines.DROPPED_ITEM | GameDefines.DROPPED_PLAYER_ITEM))) |
| 1010 | return false; // leave the weapon for others to pickup |
| 1011 | } |
| 1012 | |
| 1013 | client.pers.inventory[index]++; |
| 1014 | |
| 1015 | if (0 == (ent.spawnflags & GameDefines.DROPPED_ITEM)) { |
| 1016 | // give them some ammo with it |
| 1017 | ammo = GameItems.FindItem(ent.item.ammo, gameExports); |
| 1018 | if (((int) gameExports.gameCvars.dmflags.value & Defines.DF_INFINITE_AMMO) != 0) |
| 1019 | GameItems.Add_Ammo(other, ammo, 1000); |
| 1020 | else |
| 1021 | GameItems.Add_Ammo(other, ammo, ammo.quantity); |
| 1022 | |
| 1023 | if (0 == (ent.spawnflags & GameDefines.DROPPED_PLAYER_ITEM)) { |
| 1024 | if (gameExports.gameCvars.deathmatch.value != 0) { |
| 1025 | if (((int) (gameExports.gameCvars.dmflags.value) & Defines.DF_WEAPONS_STAY) != 0) |
| 1026 | ent.flags |= GameDefines.FL_RESPAWN; |
| 1027 | else |
| 1028 | GameItems.SetRespawn(ent, 30, gameExports); |
| 1029 | } |
| 1030 | if (gameExports.gameCvars.coop.value != 0) |
| 1031 | ent.flags |= GameDefines.FL_RESPAWN; |
| 1032 | } |
| 1033 | } |
| 1034 | |
| 1035 | if (client.pers.weapon != ent.item |
| 1036 | && (client.pers.inventory[index] == 1) |
| 1037 | && (0 == gameExports.gameCvars.deathmatch.value || client.pers.weapon == GameItems |
| 1038 | .FindItem("blaster", gameExports))) |
| 1039 | client.newweapon = ent.item; |
| 1040 | |
| 1041 | return true; |
| 1042 | } |
| 1043 | }; |
| 1044 | |
| 1045 | public static void P_ProjectSource(gclient_t client, float[] point, |
nothing calls this directly
no test coverage detected