View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0002190 | FSSCP | gameplay | public | 2010-04-22 11:43 | 2010-11-21 06:44 |
| Reporter | Spoon | Assigned To | FUBAR-BDHR | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | resolved | Resolution | fixed | ||
| Product Version | 3.6.12 RC2 | ||||
| Fixed in Version | 3.6.13 | ||||
| Summary | 0002190: Player mounted beams do not cause traitor | ||||
| Description | Beam weapons mounted in the primary banks of the player do not cause the traitor flag to be triggered, you can shoot and kill your team mates forever with beams. | ||||
| Tags | No tags attached. | ||||
|
|
I traced this issue to beams being OBJ_TYPE == BEAM which was not included in any of the ship_hit procedures that eventually call the traitor code. I experimented and came up with a pseudo-patch. This is almost guaranteed to have issues since I'm not familiar with the weapon code. I have a feeling damage per second might factor in somewhere. I'll attach it anyway as if it doesn't work at least it will give someone a good starting spot. |
|
2010-10-19 22:41
|
traitor_beams.patch (3,966 bytes)
Index: ai/aicode.cpp
===================================================================
--- ai/aicode.cpp (revision 6638)
+++ ai/aicode.cpp (working copy)
@@ -14704,7 +14704,7 @@
Assert(objp_hitter->type == OBJ_SHIP);
Assert(objp_hit->type == OBJ_SHIP);
- Assert(objp_weapon->type == OBJ_WEAPON);
+ Assert((objp_weapon->type == OBJ_WEAPON) || (objp_weapon->type == OBJ_BEAM));
ship *shipp_hitter = &Ships[objp_hitter->instance];
ship *shipp_hit = &Ships[objp_hit->instance];
@@ -14740,7 +14740,10 @@
float damage; // Damage done by weapon. Gets scaled down based on size of ship.
- damage = Weapon_info[Weapons[objp_weapon->instance].weapon_info_index].damage;
+ if (objp_weapon->type == OBJ_WEAPON)
+ damage = Weapon_info[Weapons[objp_weapon->instance].weapon_info_index].damage;
+ else
+ damage = Weapon_info[Beams[objp_weapon->instance].weapon_info_index].damage;
// wacky stuff here
ship_info *sip = &Ship_info[Ships[objp_hit->instance].ship_info_index];
@@ -15000,7 +15003,7 @@
if (objp_ship->flags & OF_PLAYER_SHIP) {
//SUSHI: So that hitting a player ship actually resets the last_hit_target_time counter for whoever hit the player.
//This is all copypasted from code below
- if (hit_objp->type == OBJ_WEAPON) {
+ if ((hit_objp->type == OBJ_WEAPON) || (hit_objp->type == OBJ_BEAM)) {
hitter_objnum = hit_objp->parent;
Assert((hitter_objnum >= 0) && (hitter_objnum < MAX_OBJECTS));
objp_hitter = &Objects[hitter_objnum];
@@ -15030,7 +15033,7 @@
}
}
- if (hit_objp->type == OBJ_WEAPON) {
+ if ((hit_objp->type == OBJ_WEAPON) || (hit_objp->type == OBJ_BEAM)) {
// Make sure the object that fired this weapon is still alive. If not, abort.
// Assert(hit_objp->parent >= 0);
if(hit_objp->parent < 0){
Index: ship/shiphit.cpp
===================================================================
--- ship/shiphit.cpp (revision 6638)
+++ ship/shiphit.cpp (working copy)
@@ -2294,7 +2294,7 @@
// If got hit by a weapon, tell the AI so it can react. Only do this line in single player,
// or if I am the master in a multiplayer game
- if ( other_obj->type == OBJ_WEAPON && ( !(Game_mode & GM_MULTIPLAYER) || MULTIPLAYER_MASTER )) {
+ if ( ((other_obj->type == OBJ_WEAPON) || (other_obj->type == OBJ_BEAM)) && ( !(Game_mode & GM_MULTIPLAYER) || MULTIPLAYER_MASTER )) {
// If weapon hits ship on same team and that ship not targeted and parent of weapon not player,
// don't do damage.
// Ie, player can always do damage. AI can only damage team if that ship is targeted.
@@ -2314,10 +2314,14 @@
}
// only want to check the following in single player or if I am the multiplayer game server
- if ( !MULTIPLAYER_CLIENT && !(Game_mode & GM_DEMO_PLAYBACK) && ((other_obj->type == OBJ_SHIP) || (other_obj->type == OBJ_WEAPON)) ){
+ if ( !MULTIPLAYER_CLIENT && !(Game_mode & GM_DEMO_PLAYBACK) && ((other_obj->type == OBJ_SHIP) || (other_obj->type == OBJ_WEAPON) || (other_obj->type == OBJ_BEAM)) ){
ai_ship_hit(ship_obj, other_obj, hitpos, quadrant, hit_normal);
}
+ // don't need to go any farther if the weapon is a beam.
+ if ( other_obj->type == OBJ_BEAM )
+ return;
+
// Cut damage done on the player by 4x in training missions, but do full accredidation
if ( The_mission.game_type & MISSION_TYPE_TRAINING ){
if (ship_obj == Player_obj){
Index: weapon/beam.cpp
===================================================================
--- weapon/beam.cpp (revision 6638)
+++ weapon/beam.cpp (working copy)
@@ -413,7 +413,7 @@
}
// create the associated object
- objnum = obj_create(OBJ_BEAM, -1, new_item - Beams, &vmd_identity_matrix, &vmd_zero_vector, 1.0f, OF_COLLIDES);
+ objnum = obj_create(OBJ_BEAM, OBJ_INDEX(fire_info->shooter), new_item - Beams, &vmd_identity_matrix, &vmd_zero_vector, 1.0f, OF_COLLIDES);
if(objnum < 0){
beam_delete(new_item);
nprintf(("General", "obj_create() failed for beam weapon! bah!\n"));
|
|
|
Fix committed r6760 |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2010-04-22 11:43 | Spoon | New Issue | |
| 2010-10-19 22:24 | FUBAR-BDHR | Note Added: 0012414 | |
| 2010-10-19 22:24 | FUBAR-BDHR | Status | new => confirmed |
| 2010-10-19 22:24 | FUBAR-BDHR | File Added: traitor_beams.patch | |
| 2010-10-19 22:40 | FUBAR-BDHR | File Deleted: traitor_beams.patch | |
| 2010-10-19 22:41 | FUBAR-BDHR | File Added: traitor_beams.patch | |
| 2010-10-22 04:57 | FUBAR-BDHR | Status | confirmed => assigned |
| 2010-10-22 04:57 | FUBAR-BDHR | Assigned To | => FUBAR-BDHR |
| 2010-11-21 06:44 | FUBAR-BDHR | Note Added: 0012477 | |
| 2010-11-21 06:44 | FUBAR-BDHR | Status | assigned => resolved |
| 2010-11-21 06:44 | FUBAR-BDHR | Fixed in Version | => 3.6.13 |
| 2010-11-21 06:44 | FUBAR-BDHR | Resolution | open => fixed |