diff --git a/code/fred2/sexp_tree.cpp b/code/fred2/sexp_tree.cpp old mode 100755 new mode 100644 diff --git a/code/hud/hudartillery.cpp b/code/hud/hudartillery.cpp old mode 100755 new mode 100644 diff --git a/code/hud/hudartillery.h b/code/hud/hudartillery.h old mode 100755 new mode 100644 diff --git a/code/math/vecmat.cpp b/code/math/vecmat.cpp old mode 100755 new mode 100644 diff --git a/code/math/vecmat.h b/code/math/vecmat.h old mode 100755 new mode 100644 diff --git a/code/parse/scripting.cpp b/code/parse/scripting.cpp index c45580997e..f0968809c6 100644 --- a/code/parse/scripting.cpp +++ b/code/parse/scripting.cpp @@ -82,7 +82,8 @@ flag_def_list Script_actions[] = {"On Ship Arrive", CHA_ONSHIPARRIVE, 0}, {"On Beam Collision", CHA_COLLIDEBEAM, 0}, {"On Message Received", CHA_MSGRECEIVED, 0}, - {"On HUD Message Received", CHA_HUDMSGRECEIVED, 0} + {"On HUD Message Received", CHA_HUDMSGRECEIVED, 0}, + {"On Beam Fire", CHA_BEAMFIRE, 0 } }; int Num_script_actions = sizeof(Script_actions)/sizeof(flag_def_list); @@ -318,7 +319,7 @@ bool ConditionedHook::ConditionsValid(int action, object *objp, int more_data) if (action == CHA_COLLIDEWEAPON) { if (stricmp(Weapon_info[more_data].name, scp->data.name) != 0) return false; - } else if (!(action == CHA_ONWPSELECTED || action == CHA_ONWPDESELECTED || action == CHA_ONWPEQUIPPED || action == CHA_ONWPFIRED || action == CHA_ONTURRETFIRED )) { + } else if (!(action == CHA_ONWPSELECTED || action == CHA_ONWPDESELECTED || action == CHA_ONWPEQUIPPED || action == CHA_ONWPFIRED || action == CHA_ONTURRETFIRED || action == CHA_BEAMFIRE)) { if(objp == NULL || (objp->type != OBJ_WEAPON && objp->type != OBJ_BEAM)) return false; else if (( objp->type == OBJ_WEAPON) && (stricmp(Weapon_info[Weapons[objp->instance].weapon_info_index].name, scp->data.name) != 0 )) @@ -427,6 +428,11 @@ bool ConditionedHook::ConditionsValid(int action, object *objp, int more_data) return false; break; } + case CHA_BEAMFIRE: { + if (!(stricmp(Weapon_info[more_data].name, scp->data.name) == 0)) + return false; + break; + } } } // case CHC_WEAPONCLASS diff --git a/code/parse/scripting.h b/code/parse/scripting.h index d005cef47f..6181049de0 100644 --- a/code/parse/scripting.h +++ b/code/parse/scripting.h @@ -76,6 +76,7 @@ struct image_desc #define CHA_ONACTIONSTOPPED 33 #define CHA_MSGRECEIVED 34 #define CHA_HUDMSGRECEIVED 35 +#define CHA_BEAMFIRE 38 // management stuff void scripting_state_init(); diff --git a/code/parse/sexp.cpp b/code/parse/sexp.cpp old mode 100755 new mode 100644 diff --git a/code/parse/sexp.h b/code/parse/sexp.h old mode 100755 new mode 100644 diff --git a/code/ship/shiphit.cpp b/code/ship/shiphit.cpp old mode 100755 new mode 100644 diff --git a/code/weapon/beam.cpp b/code/weapon/beam.cpp old mode 100755 new mode 100644 index 5cd2e06887..a53a920511 --- a/code/weapon/beam.cpp +++ b/code/weapon/beam.cpp @@ -1888,6 +1888,10 @@ int beam_start_firing(beam *b) // niffwan - if launch_snd < 0, don't play any sound } + Script_system.SetHookObjects(3, "Beam", &Objects[b->objnum], "User", b->objp, "Target", b->target); + Script_system.RunCondition(CHA_BEAMFIRE, 0, NULL, b->objp, b->weapon_info_index); + Script_system.RemHookVars(3, "Beam", "User", "Target"); + // success return 1; } diff --git a/code/weapon/beam.h b/code/weapon/beam.h old mode 100755 new mode 100644 diff --git a/code/weapon/weapons.cpp b/code/weapon/weapons.cpp old mode 100755 new mode 100644