Author Topic: Patch[canceled]: flag to disable turrets when ships are dying  (Read 4630 times)

0 Members and 1 Guest are viewing this topic.

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Patch[canceled]: flag to disable turrets when ships are dying
By default, turrets will keep shooting even when the ship is already in the process of dying which I think doesn't really make much sense, so this patch adds an ai_profiles.tbl flag which prevents that from happening.

Code: [Select]
Index: ai/ai_profiles.cpp
===================================================================
--- ai/ai_profiles.cpp (revision 8049)
+++ ai/ai_profiles.cpp (working copy)
@@ -481,6 +481,7 @@
  }
 
  set_flag(profile, "$no warp camera:", AIPF2_NO_WARP_CAMERA, AIP_FLAG2);
+ set_flag(profile, "$disable turrets on ship death:", AIPF2_DISABLE_TURRETS_ON_SHIP_DEATH, AIP_FLAG2);
 
  // if we've been through once already and are at the same place, force a move
  if ( saved_Mp && (saved_Mp == Mp) )
Index: ai/ai_profiles.h
===================================================================
--- ai/ai_profiles.h (revision 8049)
+++ ai/ai_profiles.h (working copy)
@@ -62,6 +62,7 @@
 #define AIPF2_BEAMS_DAMAGE_WEAPONS (1 << 8)
 #define AIPF2_PLAYER_WEAPON_SCALE_FIX (1 << 9)
 #define AIPF2_NO_WARP_CAMERA (1 << 10)
+#define AIPF2_DISABLE_TURRETS_ON_SHIP_DEATH (1 << 11)
 
 // AI Path types
 #define AI_PATH_MODE_NORMAL 0
Index: ship/shiphit.cpp
===================================================================
--- ship/shiphit.cpp (revision 8049)
+++ ship/shiphit.cpp (working copy)
@@ -1347,6 +1347,20 @@
 
  ship_stop_fire_primary(objp); //mostly for stopping fighter beam looping sounds -Bobboau
 
+ if (The_mission.ai_profile->flags2 & AIPF2_DISABLE_TURRETS_ON_SHIP_DEATH) {
+ // Lock all turrets so they won't keep firing while the ship is dying
+
+ ship_subsys *subsys = GET_FIRST(&sp->subsys_list);
+
+ while ( subsys != END_OF_LIST(&sp->subsys_list) ) {
+ if (subsys->system_info->type == SUBSYSTEM_TURRET) {
+ subsys->weapons.flags |= SW_FLAG_TURRET_LOCK;
+ }
+
+ subsys = GET_NEXT(subsys);
+ }
+ }
+
  sp->flags |= SF_DYING;
  objp->phys_info.flags |= (PF_DEAD_DAMP | PF_REDUCED_DAMP);
  delta_time = (int) (sip->death_roll_base_time);

EDIT: Actually, on second thought, I think this would be even more trivial to script instead. So, if someone else wants to have this feature then great, but I guess I won't need it myself after all. :lol:
« Last Edit: November 28, 2011, 11:38:31 am by zookeeper »

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: Patch: flag to disable turrets when ships are dying
I personally like how turrets these days completely lose their accuracy and fire off in empty space when the ship is going down.
'cept for beams, those just remain spot on, even capable of firing their beams when the ship is almost half way done vaporising in some cases.

In other words, could there be an option to just only disable beam turrets from firing when the ship is going down?
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: Patch: flag to disable turrets when ships are dying
I personally like how turrets these days completely lose their accuracy and fire off in empty space when the ship is going down.
'cept for beams, those just remain spot on, even capable of firing their beams when the ship is almost half way done vaporising in some cases.

In other words, could there be an option to just only disable beam turrets from firing when the ship is going down?

Yeah...

Code: [Select]
#Conditional Hooks

$Object type: Ship
$On Death: [

    mn.runSEXP("beam-lock-all !" .. hv.Self.Name .. "!")

]

#End

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: Patch[if someone else wants it]: flag to disable turrets when ships are dying
Yes, this can be done (and has been done before) with sexps.  Just beam-lock or turret-lock any ships you don't want to fire while they're blowing up.  We don't need a flag for this.

 

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: Patch[if someone else wants it]: flag to disable turrets when ships are dying
I kinda agree. When a scripted workaround is this simple, it's probably better to avoid an engine-side addition. At least it didn't take all too long to write. ;)

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: Patch[if someone else wants it]: flag to disable turrets when ships are dying
Yes, this can be done (and has been done before) with sexps.  Just beam-lock or turret-lock any ships you don't want to fire while they're blowing up.  We don't need a flag for this.
But if you want to do this for a whole campaign, you'll have to beam/turret lock eveerrrry damn capital ship in every mission.
Your argument here is: "We don't need an easy available option because we already have a painfully time consuming hard way available to do this."  :blah:
What's the harm in having an extra ai_profile.tbl flag available to modders? I for one would gladly use this for beam locking capital ship turrets. But I sure as hell won't manually do it for 20+ missions.
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: Patch[canceled]: flag to disable turrets when ships are dying
Hang on. I think what would be better would be to introduce a sort of meta-argument like "<all ships>" or something.
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Qent

  • 29
Re: Patch[if someone else wants it]: flag to disable turrets when ships are dying
But if you want to do this for a whole campaign, you'll have to beam/turret lock eveerrrry damn capital ship in every mission.

Code: [Select]
#Conditional Hooks

$Object type: Ship
$On Death: [

    mn.runSEXP("beam-lock-all !" .. hv.Self.Name .. "!")

]

#End
Doesn't this do that?

 

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: Patch[if someone else wants it]: flag to disable turrets when ships are dying
Doesn't this do that?

Yes, just shoving that piece of code into whatever-sct.tbm should cause all beams on all ships get locked the moment they begin to blow up.

I agree that doing it via mission events would be very annoying when you'd have to do it in every mission (I don't think you'd need to do it on a ship by ship basis), but a simple script like this shouldn't be a problem unless I'm missing something.

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Re: Patch[canceled]: flag to disable turrets when ships are dying
Hang on. I think what would be better would be to introduce a sort of meta-argument like "<all ships>" or something.
A million times this.
SCP needs at least a couple of meta-arguments for things such as <all friendly>, <all ships>, <all [class]> and such. This would make when-argument much easier to use for large amount of ships.

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: Patch[if someone else wants it]: flag to disable turrets when ships are dying
Doesn't this do that?

Yes, just shoving that piece of code into whatever-sct.tbm should cause all beams on all ships get locked the moment they begin to blow up.

I agree that doing it via mission events would be very annoying when you'd have to do it in every mission (I don't think you'd need to do it on a ship by ship basis), but a simple script like this shouldn't be a problem unless I'm missing something.
I'm scripting inept but that sounds easy enough.

Hang on. I think what would be better would be to introduce a sort of meta-argument like "<all ships>" or something.
A million times this.
SCP needs at least a couple of meta-arguments for things such as <all friendly>, <all ships>, <all [class]> and such. This would make when-argument much easier to use for large amount of ships.
I wouldnt mind seeing this at all
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline SypheDMar

  • 210
  • Student, Volunteer, Savior
    • Minecraft
Re: Patch[canceled]: flag to disable turrets when ships are dying
Hang on. I think what would be better would be to introduce a sort of meta-argument like "<all ships>" or something.
A million times this.
SCP needs at least a couple of meta-arguments for things such as <all friendly>, <all ships>, <all [class]> and such. This would make when-argument much easier to use for large amount of ships.
Indeed.  :yes:

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Patch[canceled]: flag to disable turrets when ships are dying
You guy do realise that would basically involve manually changing every single SEXP that can take a ship as an argument, right?
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: Patch[canceled]: flag to disable turrets when ships are dying
Does it? I thought we could do it in the argument-evaluation stage, take the meta argument and expand it before firing off the actual event...

But then, I haven't looked too deeply into the argument code...
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Patch[canceled]: flag to disable turrets when ships are dying
Hmmmmm. I suppose doing it that way might work. It would mean you could only use <all ships> in the argument list and not as an argument to the SEXP itself. I was assuming you mean making it possible for the SEXPs to take the meta-argument the same way many of them currently take arguments like <any wingman> or <any hostile>.

Doing it to the argument list might not be that hard.


One problem would be deciding if <all ships> means "all ships in the mission file" or "all ships currently in the mission" as many SEXPs have different actions for ships not in the mission.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: Patch[canceled]: flag to disable turrets when ships are dying
Not to mention the fiasco with ships in wings...

 

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
Re: Patch[canceled]: flag to disable turrets when ships are dying
You guy do realise that would basically involve manually changing every single SEXP that can take a ship as an argument, right?

You do realize that I did this over 2 years ago and it's still waiting code review.
No-one ever listens to Zathras. Quite mad, they say. It is good that Zathras does not mind. He's even grown to like it. Oh yes. -Zathras

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Patch[canceled]: flag to disable turrets when ships are dying
No, this is quite different from what you did. What they're talking about is having this.

when-argument
-any-of
--<all ships>
-etc
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]