Starsector API
Loading...
Searching...
No Matches
SpecBarEventCreator.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.intel.bar.events;
2
3import com.fs.starfarer.api.Global;
4import com.fs.starfarer.api.impl.campaign.ids.Tags;
5import com.fs.starfarer.api.impl.campaign.intel.bar.PortsideBarEvent;
6import com.fs.starfarer.api.impl.campaign.missions.hub.HubMissionBarEventWrapper;
7import com.fs.starfarer.api.loading.BarEventSpec;
8
10
11 protected transient BarEventSpec spec = null;
12 protected String specId = null;
13 protected boolean wasAutoAdded = false;
14
15 public SpecBarEventCreator(String specId) {
16 this.specId = specId;
18 }
19
20 protected Object readResolve() {
22 return this;
23 }
24
25
26 public boolean wasAutoAdded() {
27 return wasAutoAdded;
28 }
29
30 public void setWasAutoAdded(boolean wasAutoAdded) {
31 this.wasAutoAdded = wasAutoAdded;
32 }
33
34 public BarEventSpec getSpec() {
35 return spec;
36 }
37
38 public String getBarEventId() {
39 return specId;
40 }
41
43 if (spec.isMission()) {
44 return new HubMissionBarEventWrapper(specId);
45 }
46 return spec.createEvent();
47 }
48
50 return spec.getMinDur() + (spec.getMaxDur() - spec.getMinDur()) * (float) Math.random();
51 }
52
54 return spec.getFreq();
55 }
56
58 return spec.getMinTimeout() + (spec.getMaxTimeout() - spec.getMinTimeout()) * (float) Math.random();
59 }
60
62 return spec.getMinAcceptedTimeout() + (spec.getMaxAcceptedTimeout() - spec.getMinAcceptedTimeout()) * (float) Math.random();
63 }
64
65 public boolean isPriority() {
66 return spec.hasTag(Tags.MISSION_PRIORITY);
67 }
68
69}
static SettingsAPI getSettings()
Definition Global.java:51
BarEventSpec getBarEventSpec(String id)