Skip to content

Commit

Permalink
feature: Mod done
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkborderman committed Jun 8, 2023
0 parents commit 43be443
Show file tree
Hide file tree
Showing 32 changed files with 740 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* linguist-detectable
18 changes: 18 additions & 0 deletions .github/workflows/github-repo-info.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Update Github repository information

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Update Github repo info
uses: Darkborderman/github-actions/github-repo-info@master
env:
YML_PATH: metadata.yml
GH_TOKEN: ${{ secrets.PAT_TOKEN }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.gradle/
build/

# artifacts
jars/
bin/
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"java.project.sourcePaths": ["src"],
"java.project.referencedLibraries": [
"lib/*.jar"
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Darkborderman

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Starsector-CreateStableLocations

Configure and create more stable locations in Starsector.
44 changes: 44 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
repositories {
mavenCentral()
}

apply plugin: 'java'

// project level config
sourceSets.main.java.srcDir 'src'
sourceCompatibility = 1.7
targetCompatibility = 1.7
archivesBaseName = 'addstablelocations'

build {
doLast {
copy {
from jar
into 'jars'
}
}
}

task release(type: Zip) {
description 'Create releaseable zip file.'
def cmdOutput = 'jq -rj .version mod_info.json'.execute().text
from '.'
include 'src/'
include 'data/'
include 'graphics/'
include 'sounds/'
include 'jars/'
include 'mod_info.json'
archiveName archivesBaseName + '-' + cmdOutput + '.zip'
destinationDir(file('bin/'))
}

clean {
description 'Cleanup files'
delete fileTree('jars/') { include '*.jar' }
delete fileTree('bin/') { include '*.zip' }
}

dependencies {
implementation fileTree(dir: './lib/', include: '*.jar')
}
16 changes: 16 additions & 0 deletions data/config/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"CreateStableLocations": {
"AllowStar": true,
"AllowBlackHole": true,
"MaxStableLocationCount": 3,
"RequireStoryPoint": false,
"RequireStoryPointAmount": 1,
"RequiredResources": {
"alpha_core": 1,
"heavy_machinery": 200
},
"ConsumedResources": {
"fuel": 500
}
}
}
Binary file added lib/commons-compiler-jdk.jar
Binary file not shown.
Binary file added lib/commons-compiler.jar
Binary file not shown.
Binary file added lib/fs.common_obf.jar
Binary file not shown.
Binary file added lib/fs.sound_obf.jar
Binary file not shown.
Binary file added lib/janino.jar
Binary file not shown.
Binary file added lib/jinput.jar
Binary file not shown.
Binary file added lib/jogg-0.0.7.jar
Binary file not shown.
Binary file added lib/jorbis-0.0.15.jar
Binary file not shown.
Binary file added lib/json.jar
Binary file not shown.
Binary file added lib/log4j-1.2.9.jar
Binary file not shown.
Binary file added lib/lwjgl.jar
Binary file not shown.
Binary file added lib/lwjgl_util.jar
Binary file not shown.
Binary file added lib/starfarer.api.jar
Binary file not shown.
Binary file added lib/starfarer_obf.jar
Binary file not shown.
Binary file added lib/xstream-1.4.10.jar
Binary file not shown.
12 changes: 12 additions & 0 deletions metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
github:
description: Configure and create more stable locations in Starsector.
enable_discussions: false
enable_issues: false
enable_projects: false
enable_wiki: false
homepage: https://github.com/DarkbordermanModding/Starsector-AddStableLocations
template: false
topics:
- mod
- starsector
- starsector-mod
10 changes: 10 additions & 0 deletions mod_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"id": "darkborderman.addstablelocations",
"name": "Add Stable Locations",
"author": "Darkborderman",
"version": "0.0.0",
"description": "Make most character's skills configurable in Starsector.",
"gameVersion": "0.96a-RC10",
"jars": ["jars/addstablelocations.jar"],
"modPlugin": "mod.addstablelocations.AddStableLocationModPlugin"
}
37 changes: 37 additions & 0 deletions src/mod/addstablelocations/AddStableLocationCampaignPlugin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package mod.addstablelocations;

import com.fs.starfarer.api.PluginPick;
import com.fs.starfarer.api.campaign.BaseCampaignPlugin;
import com.fs.starfarer.api.campaign.InteractionDialogPlugin;
import com.fs.starfarer.api.campaign.PlanetAPI;
import com.fs.starfarer.api.campaign.SectorEntityToken;
import com.fs.starfarer.api.campaign.StarSystemAPI;

import mod.addstablelocations.utilities.JSONUtils;


public class AddStableLocationCampaignPlugin extends BaseCampaignPlugin{

// make it safe to remove from game
public boolean isTransient(){return true;}

@Override
public PluginPick<InteractionDialogPlugin> pickInteractionDialogPlugin(SectorEntityToken interactionTarget) {
if (interactionTarget instanceof PlanetAPI) {
PlanetAPI planet = (PlanetAPI)interactionTarget;
StarSystemAPI system = planet.getStarSystem();
if (system != null && planet == system.getStar()){
if(!planet.getSpec().isBlackHole()){
if (JSONUtils.loadBoolean(JSONUtils.getModConfig(), "AllowStar") == true){
return new PluginPick<InteractionDialogPlugin>(new StarDialogPluginImpl(), PickPriority.CORE_GENERAL);
}
}else{
if (JSONUtils.loadBoolean(JSONUtils.getModConfig(), "AllowBlackHole") == true){
return new PluginPick<InteractionDialogPlugin>(new BlackHoleDialogPluginImpl(), PickPriority.CORE_GENERAL);
}
}
}
}
return null;
}
}
12 changes: 12 additions & 0 deletions src/mod/addstablelocations/AddStableLocationModPlugin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package mod.addstablelocations;

import com.fs.starfarer.api.BaseModPlugin;
import com.fs.starfarer.api.Global;


public class AddStableLocationModPlugin extends BaseModPlugin {

public void onGameLoad(boolean newGame) {
Global.getSector().registerPlugin(new AddStableLocationCampaignPlugin());
}
}
Loading

0 comments on commit 43be443

Please sign in to comment.