Archived
Adding Mods w/Symlink
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
[General]
|
||||
gameName=spt
|
||||
modid=0
|
||||
version=d2024.12.16.0
|
||||
newestVersion=
|
||||
category="1,"
|
||||
nexusFileStatus=1
|
||||
installationFile=acidphantasm-defaultfiremode.zip
|
||||
repository=Nexus
|
||||
ignoredVersion=
|
||||
comments=
|
||||
notes=
|
||||
nexusDescription=
|
||||
url=
|
||||
hasCustomURL=false
|
||||
lastNexusQuery=
|
||||
lastNexusUpdate=
|
||||
nexusLastModified=2024-12-16T07:04:13Z
|
||||
nexusCategory=0
|
||||
converted=false
|
||||
validated=false
|
||||
color=@Variant(\0\0\0\x43\0\xff\xff\0\0\0\0\0\0\0\0)
|
||||
tracked=0
|
||||
|
||||
[installedFiles]
|
||||
1\modid=0
|
||||
1\fileid=0
|
||||
size=1
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 acidphantasm
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,7 @@
|
||||
# Default Fire Mode
|
||||
|
||||
Simple standalone mod to adjust the default fire modes for weapons.
|
||||
|
||||
Full Auto prioritized
|
||||
Single Fire secondary
|
||||
Burst tertiary
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "Default Fire Mode",
|
||||
"version": "1.2.0",
|
||||
"main": "src/mod.js",
|
||||
"license": "MIT",
|
||||
"author": "acidphantasm",
|
||||
"sptVersion": "~3.10",
|
||||
"loadBefore": [],
|
||||
"loadAfter": [],
|
||||
"incompatibilities": [],
|
||||
"contributors": [],
|
||||
"isBundleMod": false,
|
||||
"scripts": {
|
||||
"setup": "npm i",
|
||||
"build": "node ./build.mjs",
|
||||
"buildinfo": "node ./build.mjs --verbose"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "20.11",
|
||||
"@typescript-eslint/eslint-plugin": "7.2",
|
||||
"@typescript-eslint/parser": "7.2",
|
||||
"archiver": "^6.0",
|
||||
"eslint": "8.57",
|
||||
"fs-extra": "11.2",
|
||||
"ignore": "^5.2",
|
||||
"os": "^0.1",
|
||||
"tsyringe": "4.8.0",
|
||||
"typescript": "5.4",
|
||||
"winston": "3.12"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import type { DependencyContainer } from "tsyringe";
|
||||
|
||||
import type { IPostDBLoadMod } from "@spt/models/external/IPostDBLoadMod";
|
||||
import type { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import type { IDatabaseTables } from "@spt/models/spt/server/IDatabaseTables";
|
||||
import type { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import type { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { BaseClasses } from "@spt/models/enums/BaseClasses";
|
||||
|
||||
class DefaultFireMode implements IPostDBLoadMod
|
||||
{
|
||||
private mod: string
|
||||
private logger: ILogger
|
||||
|
||||
constructor() {
|
||||
this.mod = "DefaultFireMode"; // Set name of mod so we can log it to console later
|
||||
}
|
||||
|
||||
public postDBLoad(container: DependencyContainer): void
|
||||
{
|
||||
const databaseService = container.resolve<DatabaseService>("DatabaseService");
|
||||
this.logger = container.resolve<ILogger>("WinstonLogger");
|
||||
this.logger.debug(`[${this.mod}] postDBLoad starting... `);
|
||||
|
||||
const tables: IDatabaseTables = databaseService.getTables();
|
||||
|
||||
// Get ItemHelper ready to use
|
||||
const itemHelper: ItemHelper = container.resolve<ItemHelper>("ItemHelper");
|
||||
|
||||
// Get all items in the database as an array so we can loop over them later
|
||||
// tables.templates.items is a dictionary, the key being the items template id, the value being the objects data,
|
||||
// we want to convert it into an array so we can loop over all the items easily
|
||||
// Object.values lets us grab the 'value' part as an array and ignore the 'key' part
|
||||
const items = Object.values(tables.templates.items);
|
||||
|
||||
const weapons = items.filter(x => itemHelper.isOfBaseclass(x._id, BaseClasses.WEAPON));
|
||||
|
||||
// Loop over all the weapons
|
||||
for (const weapon of weapons)
|
||||
{
|
||||
// Check the weapon has a fireType selector property
|
||||
if (weapon._props.weapFireType)
|
||||
{
|
||||
// Re-order the weapFireType based on length
|
||||
weapon._props.weapFireType.sort((a, b) => b.length - a.length);
|
||||
}
|
||||
}
|
||||
this.logger.debug(`[${this.mod}] postDBLoad Completed... `);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { mod: new DefaultFireMode() }
|
||||
Reference in New Issue
Block a user