Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Pages: 1 ... 257 258 [259] 260 261 ... 706

Author Topic: Misc modding questions that are too minor to warrant their own thread  (Read 1699884 times)

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 430
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3870 on: May 13, 2018, 07:47:24 PM »

Safest way seems to be to call battle.getSnapshotBothSides() and iterate over each fleet and its members.
Snapshot means the members involved in the battle? but in the api:
Code
	/**
* Snapshot before the battle, containing any fleets that may have been eliminated during.
* @return
*/
List<CampaignFleetAPI> getPlayerSideSnapshot();

/**
* Snapshot before the battle, containing any fleets that may have been eliminated during.
* @return
*/
List<CampaignFleetAPI> getNonPlayerSideSnapshot();
Logged
My mods


Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3871 on: May 14, 2018, 05:06:36 AM »

Not sure what you mean. The snapshot methods get the involved fleets (snapshot version), you can then get the fleet members of those snapshots with fleet.getFleetData().getMembersListCopy()
(or get the losses directly with Misc.getSnapshotMembersLost(fleet), if that's what you need)
Logged

atreg

  • Lieutenant
  • **
  • Posts: 67
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3872 on: May 14, 2018, 02:10:36 PM »

Is there a way to increase the rate at which new officers become available for hire?
Logged

Sarissofoi

  • Captain
  • ****
  • Posts: 405
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3873 on: May 14, 2018, 02:45:56 PM »

Is there a way to increase the rate at which new officers become available for hire?
You can increase maximum amount available officers for hire
   "officerMaxHireable":40,
in data/config/settings
It will increase amount of potential recruits - its especially visible when you use many mods with additional markets.
I think they refresh at the same rate that ship market refresh.

atreg

  • Lieutenant
  • **
  • Posts: 67
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3874 on: May 14, 2018, 06:04:40 PM »

I have done that in the past, especially when using a lot of mods as you said. There'd still be some officers that would stick around for months, and occasionally what felt like over a year. I had to resort to hiring then immediately firing them just to get rid of them.
Logged

Sarissofoi

  • Captain
  • ****
  • Posts: 405
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3875 on: May 15, 2018, 05:32:59 AM »

BTW.
What is a order in loading mods?
Do they load in alphabetic order or something?
Why I asking this.
I tend to mildly modify most mods I use(either ships, or fleet composition). So I am asking if I need to modify mod directly(which I do) or I can create a minimod that load after it and change stats of ships or whatever I modify?

Nalesh

  • Ensign
  • *
  • Posts: 14
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3876 on: May 15, 2018, 11:02:16 AM »

How hard would it be to make a mod that zeroes out all ships maintenance cost(Effectively making it so that you only need supplies for things like CR, surveying, repairing, etc) without having to go through each ship_data.csv and changing it there?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3877 on: May 15, 2018, 12:13:31 PM »

BTW.
What is a order in loading mods?
Do they load in alphabetic order or something?
Why I asking this.
I tend to mildly modify most mods I use(either ships, or fleet composition). So I am asking if I need to modify mod directly(which I do) or I can create a minimod that load after it and change stats of ships or whatever I modify?

IIRC it's alphabetical by the mod's ID, but I could be mis-remembering something. So if you start your mini-mod id with say 10 z's (to be on the safe side), that ought to do the trick.

How hard would it be to make a mod that zeroes out all ships maintenance cost(Effectively making it so that you only need supplies for things like CR, surveying, repairing, etc) without having to go through each ship_data.csv and changing it there?

Depends on how comfortable you are with coding and figuring out how Starsector mods are set up. It probably wouldn't be too hard to write a script that zeroes it out for all the ships in the player's fleet, but getting that all up and running is definitely more knowledge-intensive than changing it in the csv.
Logged

Nalesh

  • Ensign
  • *
  • Posts: 14
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3878 on: May 15, 2018, 12:58:19 PM »

I code like a junker pirate, it's not gonna be pretty, it might explode at any moment, but it technically flies, if only due to the explosion.

Editing the csv files would probably be easier in the short run but it just doesn't seem elegant enough.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3879 on: May 15, 2018, 01:02:30 PM »

junker pirate

elegant

Ahem.

(Sorry, couldn't resist.)
Logged

Sarissofoi

  • Captain
  • ****
  • Posts: 405
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3880 on: May 16, 2018, 09:16:45 AM »

Thanks for info.

On side note I figured why there is some silly exhaust coming from some of my ships weapons in battle - its Accelerated Ammo feeder in use. Now I feel dumb. Still I can do some tricks right now with it.

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 430
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3881 on: May 17, 2018, 07:15:18 AM »

Code
public static class WorkShopData {
        static WorkShopData Instance;
        WeakHashMap<FleetMemberAPI, BowlData> maps;

        public static void Load(SectorAPI sector) {
            if (sector.getPersistentData().containsKey(DATA_ID)) {
                Instance = (WorkShopData) sector.getPersistentData().get(DATA_ID);
            } else {
                Instance = new WorkShopData();
                Instance.maps = new WeakHashMap<>();
                sector.getPersistentData().put(DATA_ID, Instance);
            }
        }
    }
WorkShopData.Load() will be called in OnGameLoad()
Could WeakHashMap work after game load? I want the member will be automaticlly expired to prevent memory leak.
Logged
My mods


xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3882 on: May 17, 2018, 08:55:30 AM »

Quote
Could WeakHashMap work after game load? I want the member will be automaticlly expired to prevent memory leak.
If the operation's terminated at the end of OnGameLoad() and there isn't any data associated with it still in use by other code, the Garbage Collector should clear it automatically.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3883 on: May 17, 2018, 09:20:46 AM »

It might, but why do it this way at all?

In my own stuff I have code like this:

Code: java
public static final String KEY = "$core_genericMissionManager";

public static GenericMissionManager getInstance() {
Object test = Global.getSector().getMemoryWithoutUpdate().get(KEY);
return (GenericMissionManager) test;
}

public GenericMissionManager() {
super();
Global.getSector().getMemoryWithoutUpdate().set(KEY, this);
}

So you never actually need a static reference to the instance.
Logged

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 430
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3884 on: May 17, 2018, 08:38:41 PM »

So you never actually need a static reference to the instance.

Well that's my code habit lol
Logged
My mods


Pages: 1 ... 257 258 [259] 260 261 ... 706