Starsector API
Loading...
Searching...
No Matches
CodexIntelAdder.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.codex;
2
3import java.util.LinkedHashSet;
4
5import com.fs.starfarer.api.EveryFrameScript;
6import com.fs.starfarer.api.Global;
7
8public class CodexIntelAdder implements EveryFrameScript {
9
10 public static String KEY = "$core_codexIntelAdder";
11
12 public static CodexIntelAdder get() {
14 if (adder == null) {
15 adder = new CodexIntelAdder();
16 }
17 return adder;
18 }
19
20 protected float delay = 0f;
21 protected LinkedHashSet<String> unlockedEntries = new LinkedHashSet<>();
22
27
28
29 public void addEntry(String entryId) {
30 CodexEntryPlugin entry = CodexDataV2.getEntry(entryId);
31 if (entry == null || entry.isLocked()) return;
32 unlockedEntries.add(entryId);
33 delay = 1f;
34 }
35
36 @Override
37 public void advance(float amount) {
38 delay -= amount;
39 if (delay <= 0) {
40 delay = 0f;
41 if (!unlockedEntries.isEmpty()) {
44 }
45 unlockedEntries = new LinkedHashSet<>();
46 }
47 }
48 }
49
50 @Override
51 public boolean isDone() {
52 return false;
53 }
54
55 @Override
56 public boolean runWhilePaused() {
57 return false;
58 }
59
60}
61
62
63
64
65
66
67
68
static SectorAPI getSector()
Definition Global.java:65
static CodexEntryPlugin getEntry(String id)
void addScript(EveryFrameScript script)
void set(String key, Object value)