Author Topic: Renamed/Relocated Stock Ships and and Submenus Take II  (Read 1335 times)

Offline 086gf

  • Location: United Socialist States of America!
  • Posts: 1357
  • Cookies: 32
Renamed/Relocated Stock Ships and and Submenus Take II
« on: December 30, 2011, 02:43:43 PM »
When I did this before with KM 1.0 I remember it working properly. Im reorganizing all of the menus again but everything i've tried from before(like creating brand new plugins) is not working 100%. Here's a plugin example of each for a renamed and relocated stock ships.

Code: [Select]
#####  Created by:
#####  Bridge Commander Universal Tool


import App
import Foundation


abbrev = "Shuttle"
iconName = "FedShuttle"
longName = "Type 6"
shipFile = "Shuttle"
species = App.SPECIES_GALAXY
menuGroup = "Fed Ships"
playerMenuGroup = "Fed Ships"
Foundation.ShipDef.Shuttle = Foundation.FedShipDef(abbrev, species, { 'name': longName, 'iconName': iconName, 'shipFile': shipFile })


Foundation.ShipDef.Shuttle.hasTGLName = 1
Foundation.ShipDef.Shuttle.hasTGLDesc = 1
Foundation.ShipDef.Shuttle.SubMenu = "Shuttles"
Foundation.ShipDef.Shuttle.fMaxWarp = 6.5 + 0.0001
Foundation.ShipDef.Shuttle.fCruiseWarp = 4.5 + 0.0001
Foundation.ShipDef.Shuttle.sBridge = "Type11Bridge"


if menuGroup:           Foundation.ShipDef.Shuttle.RegisterQBShipMenu(menuGroup)
if playerMenuGroup:     Foundation.ShipDef.Shuttle.RegisterQBPlayerShipMenu(playerMenuGroup)


if Foundation.shipList._keyList.has_key(longName):
      Foundation.ShipDef.__dict__[longName].friendlyDetails[2] = Foundation.shipList[longName].friendlyDetails[2]
      Foundation.ShipDef.__dict__[longName].enemyDetails[2] = Foundation.shipList[longName].enemyDetails[2]


Foundation.ShipDef.Shuttle.name = "Type 6"

Code: [Select]
#####  Created by:
#####  Bridge Commander Universal Tool


import App
import Foundation


abbrev = "Warbird"
iconName = "Warbird"
longName = "Dderidex DS9"
shipFile = "Warbird"
species = App.SPECIES_GALAXY
menuGroup = "Romulan Ships"
playerMenuGroup = "Romulan Ships"
Foundation.ShipDef.Warbird = Foundation.RomulanShipDef(abbrev, species, { 'name': longName, 'iconName': iconName, 'shipFile': shipFile })


Foundation.ShipDef.Warbird.hasTGLName = 1
Foundation.ShipDef.Warbird.hasTGLDesc = 1
Foundation.ShipDef.Warbird.fMaxWarp = 9 + 0.0001
Foundation.ShipDef.Warbird.fCruiseWarp = 7 + 0.0001


if menuGroup:           Foundation.ShipDef.Warbird.RegisterQBShipMenu(menuGroup)
if playerMenuGroup:     Foundation.ShipDef.Warbird.RegisterQBPlayerShipMenu(playerMenuGroup)


if Foundation.shipList._keyList.has_key(longName):
      Foundation.ShipDef.__dict__[longName].friendlyDetails[2] = Foundation.shipList[longName].friendlyDetails[2]
      Foundation.ShipDef.__dict__[longName].enemyDetails[2] = Foundation.shipList[longName].enemyDetails[2]


Foundation.ShipDef.Warbird.name = "Dderidex DS9"

EDIT: Oh yeah also im trying to modify the Enterprise G and Sovereign names/submenus and the seperate parts. I want to get rid of the extra layer for each ship(which I did in all of the plugins but no difference just an extra entry) so that its just like the Galaxy and Prometheus. The pics below shows how it looks now.
All hail the messiah!

Offline KrrKs

  • Posts: 461
  • Cookies: 25
Re: Renamed/Relocated Stock Ships and and Submenus Take II
« Reply #1 on: December 31, 2011, 08:13:07 AM »
I assume you mean you have duplicates of the Stock entries when you say the menus are not working properly.
The Strange thing is, the Plugins in my install look pretty much the same.
You could try leaving the
Quote
Foundation.ShipDef.Shuttle = Foundation.FedShipDef(abbrev, species, { 'name': longName, 'iconName': iconName, 'shipFile': shipFile })
parts away. That worked for the Sovereign in my Install.
My other Stock ship Plugins have the altered Part, like Submenus, put directly after the import Statements, but i don't know if that would change anything.

Concerning the Mvam Extra layer. AFAIK the MVAM mod creates its own Sumenu entry's for a Ships parts. So any Submenu With Ent-G or Sovereign in these MVAM ships ( and their Child- Ships) should go. -At least that worked for me.

Offline 086gf

  • Location: United Socialist States of America!
  • Posts: 1357
  • Cookies: 32
Re: Renamed/Relocated Stock Ships and and Submenus Take II
« Reply #2 on: December 31, 2011, 12:28:26 PM »
1) Remove "Foundation.ShipDef.Shuttle = Foundation.FedShipDef(abbrev, species, { 'name': longName, 'iconName': iconName, 'shipFile': shipFile })"

2) Relocate "Foundation.ShipDef.Shuttle.SubMenu = "Shuttles"" to underneath import Foundation

3) Remove the submenus completely?

Alright i'll give those a try.

EDIT: Well the third issue is resolved. Removing the shipdef info line on the ships that i've relocated removes the new entry so I had to put it back in for them but it worked with the others fine. Removing the submenu lines for the G and Sov parts fixed that issue too. I just need the Shuttle , Kessok Mine and both Comm Arrays to only show up in there new locations.

Shuttle should be in Fed Ships/Shuttles only.

Code: [Select]
#####  Created by:
#####  Bridge Commander Universal Tool


import App
import Foundation


abbrev = "Shuttle"
iconName = "FedShuttle"
longName = "Type 6"
shipFile = "Shuttle"
species = App.SPECIES_GALAXY
menuGroup = "Fed Ships"
playerMenuGroup = "Fed Ships"
Foundation.ShipDef.Shuttle = Foundation.FedShipDef(abbrev, species, { 'name': longName, 'iconName': iconName, 'shipFile': shipFile })


Foundation.ShipDef.Shuttle.name = "Type 6"
Foundation.ShipDef.Shuttle.SubMenu = "Shuttles"
Foundation.ShipDef.Shuttle.hasTGLName = 1
Foundation.ShipDef.Shuttle.hasTGLDesc = 1
Foundation.ShipDef.Shuttle.fMaxWarp = 6.5 + 0.0001
Foundation.ShipDef.Shuttle.fCruiseWarp = 4.5 + 0.0001
Foundation.ShipDef.Shuttle.sBridge = "Type11Bridge"


if menuGroup:           Foundation.ShipDef.Shuttle.RegisterQBShipMenu(menuGroup)
if playerMenuGroup:     Foundation.ShipDef.Shuttle.RegisterQBPlayerShipMenu(playerMenuGroup)


if Foundation.shipList._keyList.has_key(longName):
      Foundation.ShipDef.__dict__[longName].friendlyDetails[2] = Foundation.shipList[longName].friendlyDetails[2]
      Foundation.ShipDef.__dict__[longName].enemyDetails[2] = Foundation.shipList[longName].enemyDetails[2]

Kessok Mine should be in Kessok Ships only.

Code: [Select]
#####  Created by:
#####  Bridge Commander Universal Tool


import App
import Foundation


abbrev = "KessokMine"
iconName = "KessokMine"
longName = "Kessok Mine"
shipFile = "KessokMine"
species = App.SPECIES_GALAXY
menuGroup = "Kessok Ships"
playerMenuGroup = "Kessok Ships"
Foundation.ShipDef.KessokMine = Foundation.KessokShipDef(abbrev, species, { 'name': longName, 'iconName': iconName, 'shipFile': shipFile })


Foundation.ShipDef.KessokMine.name = "Kessok Mine"
Foundation.ShipDef.KessokMine.hasTGLName = 1
Foundation.ShipDef.KessokMine.hasTGLDesc = 1


if menuGroup:           Foundation.ShipDef.KessokMine.RegisterQBShipMenu(menuGroup)
if playerMenuGroup:     Foundation.ShipDef.KessokMine.RegisterQBPlayerShipMenu(playerMenuGroup)


if Foundation.shipList._keyList.has_key(longName):
      Foundation.ShipDef.__dict__[longName].friendlyDetails[2] = Foundation.shipList[longName].friendlyDetails[2]
      Foundation.ShipDef.__dict__[longName].enemyDetails[2] = Foundation.shipList[longName].enemyDetails[2]

CommArray and CommLight should be in Bases only.

Code: [Select]
#####  Created by:
#####  Bridge Commander Universal Tool


import App
import Foundation


abbrev = "CommArray"
iconName = "CommArray"
longName = "Communications Array"
shipFile = "CommArray"
species = App.SPECIES_GALAXY
menuGroup = "Bases"
Foundation.ShipDef.CommArray = Foundation.StarBaseDef(abbrev, species, { 'name': longName, 'iconName': iconName, 'shipFile': shipFile })


Foundation.ShipDef.CommArray.name = "Communications Array"
Foundation.ShipDef.CommArray.hasTGLName = 1
Foundation.ShipDef.CommArray.hasTGLDesc = 1


if menuGroup:           Foundation.ShipDef.CommArray.RegisterQBShipMenu(menuGroup)


if Foundation.shipList._keyList.has_key(longName):
      Foundation.ShipDef.__dict__[longName].friendlyDetails[2] = Foundation.shipList[longName].friendlyDetails[2]
      Foundation.ShipDef.__dict__[longName].enemyDetails[2] = Foundation.shipList[longName].enemyDetails[2]

Code: [Select]
#####  Created by:
#####  Bridge Commander Universal Tool


import App
import Foundation


abbrev = "CommLight"
iconName = "CommLight"
longName = "Communications Array Light"
shipFile = "CommLight"
species = App.SPECIES_GALAXY
menuGroup = "Bases"
Foundation.ShipDef.CommLight = Foundation.StarBaseDef(abbrev, species, { 'name': longName, 'iconName': iconName, 'shipFile': shipFile })


Foundation.ShipDef.CommLight.name = "Communications Array Light"
Foundation.ShipDef.CommLight.hasTGLName = 1
Foundation.ShipDef.CommLight.hasTGLDesc = 1


if menuGroup:           Foundation.ShipDef.CommLight.RegisterQBShipMenu(menuGroup)


if Foundation.shipList._keyList.has_key(longName):
      Foundation.ShipDef.__dict__[longName].friendlyDetails[2] = Foundation.shipList[longName].friendlyDetails[2]
      Foundation.ShipDef.__dict__[longName].enemyDetails[2] = Foundation.shipList[longName].enemyDetails[2]
All hail the messiah!

Offline KrrKs

  • Posts: 461
  • Cookies: 25
Re: Renamed/Relocated Stock Ships and and Submenus Take II
« Reply #3 on: January 01, 2012, 09:18:56 AM »
I thought that, with an already existing Foundation Entry removing the RaceShipdef part would overwrite that entry, instead of creating a new one with the same name.
After taking a look again I also have the Shuttle still under "Other Ships", so maybe the Menus Positions of Stock Ships are hard Coded.
But it is strange that SubMenus do work for them...

Offline 086gf

  • Location: United Socialist States of America!
  • Posts: 1357
  • Cookies: 32
Re: Renamed/Relocated Stock Ships and and Submenus Take II
« Reply #4 on: January 02, 2012, 09:57:00 PM »
Its been done before so its not hardcoded I just need to remember how.
All hail the messiah!

Offline Defiant

  • Posts: 398
  • Cookies: 1105
    • BC: Kobayashi Maru
Re: Renamed/Relocated Stock Ships and and Submenus Take II
« Reply #5 on: January 03, 2012, 12:45:37 PM »
Nothing has changed here, just some other ships.

Offline 086gf

  • Location: United Socialist States of America!
  • Posts: 1357
  • Cookies: 32
Re: Renamed/Relocated Stock Ships and and Submenus Take II
« Reply #6 on: January 05, 2012, 01:06:31 PM »
No the first two are actually updated.

So, anyone have any ideas?
All hail the messiah!

Offline Mario

  • Senior Software Developer
  • Administrator
  • Posts: 2197
  • Cookies: 1706
  • Life is life
Re: Renamed/Relocated Stock Ships and and Submenus Take II
« Reply #7 on: January 05, 2012, 06:08:35 PM »
Code: [Select]
### Custom/ships/file.py

import Foundation

# override the instance name (check staticdefs for more info)
ship = Foundation.ShipDef.KessokHeavy
ship.name = "Oh whatever"
ship.hasTGLName = 0
ship.hasTGLDesc = 1

# player menu
ship.playerMenuGroup = "Yay new player menu"

# ship menu
ship.menuGroup = "Yay new menu"
Acta, non verba.
aka USS Sovereign

Offline 086gf

  • Location: United Socialist States of America!
  • Posts: 1357
  • Cookies: 32
Re: Renamed/Relocated Stock Ships and and Submenus Take II
« Reply #8 on: January 09, 2012, 02:30:45 PM »
Thanks, i'll try that and post back if it works or not.
All hail the messiah!

Offline 086gf

  • Location: United Socialist States of America!
  • Posts: 1357
  • Cookies: 32
Re: Renamed/Relocated Stock Ships and and Submenus Take II
« Reply #9 on: January 13, 2012, 10:35:13 PM »
Thank you that worked!
All hail the messiah!