Author Topic: Rotating Dead Subobjects  (Read 4136 times)

0 Members and 1 Guest are viewing this topic.

Offline Axem

  • 211
Rotating Dead Subobjects
Hey, so it's been noticed since... forever... that when a rotating subobject dies, it stops rotating!

In most cases I can understand why. But can we have something, like a submodel flag, that would let a dead subobject continue to rotate (without using dumb_rotate since you can't control it with sexps). So big fancy solar arrays could keep spinning, or the rotating compartments of a Karuna or Narayana would still spin even if they were trashed. It'd be cool stuff!

 

Offline redsniper

  • 211
  • Aim for the Top!
Re: Rotating Dead Subobjects
Second.

We also need to model damage caused by vibrations from eccentric rotating subsystems, kthx.

Ok, not really, but it would be cool to see busted up solar panels and radar things still spinning. Bonus points if we could have them coast down to a stop. Actually you can probably do that with sexps...
"Think about nice things not unhappy things.
The future makes happy, if you make it yourself.
No war; think about happy things."   -WouterSmitssm

Hard Light Productions:
"...this conversation is pointlessly confrontational."

 

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: Rotating Dead Subobjects
Well I'd think you can already do that by parenting the panels to an invisible non-destroyable rotating subsystem, but I guess it'd be nice to not need to do that.

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: Rotating Dead Subobjects
This came up while I was working on the HTL Shivan Comm Node. Doing it your way zookeeper means that in order to stop the rotation, which several campaigns do, they would need to change which subsystems they reference.

The blades need to continue rotating when destroyed so they don't collide with each other.
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Re: Rotating Dead Subobjects
Can't a destroyed blade explode into debris and not leave a -destroyed submodel?

 

Offline Rga_Noris

  • 29
  • What?
Re: Rotating Dead Subobjects
Can't a destroyed blade explode into debris and not leave a -destroyed submodel?

Yeah.
I think I'll call REAL Mahjong 'Chinese Dominoes', just to make people think I'm an ignorant asshat.

 

Offline Axem

  • 211
Re: Rotating Dead Subobjects
Hey Axem, that's a great idea. I took some time out of my busy schedule to code this feature in.

Code: [Select]
Index: ai/aicode.cpp
===================================================================
--- ai/aicode.cpp (revision 9249)
+++ ai/aicode.cpp (working copy)
@@ -10883,8 +10883,8 @@
  for ( pss = GET_FIRST(&shipp->subsys_list); pss !=END_OF_LIST(&shipp->subsys_list); pss = GET_NEXT(pss) ) {
  psub = pss->system_info;
 
- // Don't process destroyed objects (but allow subobjects with hitpoints disabled -nuke)
- if (pss->max_hits > 0 && pss->current_hits <= 0.0f )
+ // Don't process destroyed objects (but allow subobjects with hitpoints disabled -nuke) (but also process subobjects that are allowed to rotate)
+ if (pss->max_hits > 0 && pss->current_hits <= 0.0f && !(psub->flags2 & MSS_FLAG2_DESTROYED_ROTATION))
  continue;
 
  switch (psub->type) {
Index: model/model.h
===================================================================
--- model/model.h (revision 9249)
+++ model/model.h (working copy)
@@ -137,6 +137,7 @@
 #define MSS_FLAG2_TURRET_ONLY_TARGET_IF_CAN_FIRE (1 << 1) // Turrets only target things they're allowed to shoot at (e.g. if check-hull fails, won't keep targeting)
 #define MSS_FLAG2_NO_DISAPPEAR (1 << 2) // Submodel won't disappear when subsystem destroyed
 #define MSS_FLAG2_COLLIDE_SUBMODEL (1 << 3) // subsystem takes damage only from hits which impact the associated submodel
+#define MSS_FLAG2_DESTROYED_ROTATION (1 << 4)   // allows subobjects to continue to rotate even if they have been destroyed
 
 #define NUM_SUBSYSTEM_FLAGS 33
 
Index: ship/ship.cpp
===================================================================
--- ship/ship.cpp (revision 9249)
+++ ship/ship.cpp (working copy)
@@ -251,7 +251,8 @@
  { "play fire sound for player", MSS_FLAG2_PLAYER_TURRET_SOUND, 1},
  { "only target if can fire",    MSS_FLAG2_TURRET_ONLY_TARGET_IF_CAN_FIRE, 1},
  { "no disappear", MSS_FLAG2_NO_DISAPPEAR, 1},
- { "collide submodel", MSS_FLAG2_COLLIDE_SUBMODEL, 1}
+ { "collide submodel", MSS_FLAG2_COLLIDE_SUBMODEL, 1},
+ { "allow destroyed rotation", MSS_FLAG2_DESTROYED_ROTATION, 1}
 };
 
 const int Num_subsystem_flags = sizeof(Subsystem_flags)/sizeof(flag_def_list);

Simply add the "allow destroyed rotation" flag to the subsystem properties in the ships.tbl and presto!

And a movie for those who like moving pictures and explosions instead of code.

http://www.youtube.com/watch?v=ogK_nUgcyFo
« Last Edit: October 08, 2012, 08:51:35 pm by Axem »

 

Offline Rodo

  • Custom tittle
  • 212
  • stargazer
    • Minecraft
    • Steam
Re: Rotating Dead Subobjects
Is it possible to determine the speed of a rotating object via sexps?

Never mind, I just checked.

Cool stuff, this adds a possible nice effect of a gradually shutting down subsys, kudos Axem :yes:
« Last Edit: October 08, 2012, 08:25:40 pm by Rodo »
el hombre vicio...

 

Offline Axem

  • 211
Re: Rotating Dead Subobjects
You can control the speed (see the GTA Internets in JAD3), but I don't think any sexp can return the rotational speed... not yet anyway.

 

Offline redsniper

  • 211
  • Aim for the Top!
Re: Rotating Dead Subobjects
Oh cool. So could you like, shoot up the solar panels on a Faustus and then have them coast down to a stop?
"Think about nice things not unhappy things.
The future makes happy, if you make it yourself.
No war; think about happy things."   -WouterSmitssm

Hard Light Productions:
"...this conversation is pointlessly confrontational."

 

Offline Rodo

  • Custom tittle
  • 212
  • stargazer
    • Minecraft
    • Steam
Re: Rotating Dead Subobjects
Not tried it but I guess it's possible now with this.
el hombre vicio...

 

Offline Swifty

  • 210
  • I reject your fantasy & substitute my own
Re: Rotating Dead Subobjects
This seems to look a'ight.

 

Offline Swifty

  • 210
  • I reject your fantasy & substitute my own
Re: Rotating Dead Subobjects
In order to stop the terrorist Axem from assaulting me with pictures of kittens, I've committed this feature in fs2open/trunk revision 9273.

 
  

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: Rotating Dead Subobjects
In order to stop the terrorist Axem from assaulting me with pictures of kittens, I've committed this feature in fs2open/trunk revision 9273.
Oooh! Negotiating with terrorists huh?

So that's how I'll get my stuff coded and commited!

It... BEGINS!
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