mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Fixed unabled to copy humans
This commit is contained in:
@@ -7,19 +7,18 @@ export interface ContextInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class Context {
|
export class Context {
|
||||||
|
#allowUnitCopying: boolean;
|
||||||
|
#allowUnitPasting: boolean;
|
||||||
|
#useSpawnMenu: boolean;
|
||||||
|
#useUnitControlPanel: boolean;
|
||||||
|
#useUnitInfoPanel: boolean;
|
||||||
|
|
||||||
#allowUnitCopying:boolean;
|
constructor(config: ContextInterface) {
|
||||||
#allowUnitPasting:boolean;
|
this.#allowUnitCopying = (config.allowUnitCopying !== false);
|
||||||
#useSpawnMenu:boolean;
|
this.#allowUnitPasting = (config.allowUnitPasting !== false);
|
||||||
#useUnitControlPanel:boolean;
|
this.#useSpawnMenu = (config.useSpawnMenu !== false);
|
||||||
#useUnitInfoPanel:boolean;
|
this.#useUnitControlPanel = (config.useUnitControlPanel !== false);
|
||||||
|
this.#useUnitInfoPanel = (config.useUnitInfoPanel !== false);
|
||||||
constructor( config:ContextInterface ) {
|
|
||||||
this.#allowUnitCopying = ( config.allowUnitCopying !== false );
|
|
||||||
this.#allowUnitPasting = ( config.allowUnitPasting !== false );
|
|
||||||
this.#useSpawnMenu = ( config.useSpawnMenu !== false );
|
|
||||||
this.#useUnitControlPanel = ( config.useUnitControlPanel !== false );
|
|
||||||
this.#useUnitInfoPanel = ( config.useUnitInfoPanel !== false );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getAllowUnitCopying() {
|
getAllowUnitCopying() {
|
||||||
|
|||||||
@@ -2,42 +2,39 @@ import { Manager } from "../other/manager";
|
|||||||
import { Context, ContextInterface } from "./context";
|
import { Context, ContextInterface } from "./context";
|
||||||
|
|
||||||
export class ContextManager extends Manager {
|
export class ContextManager extends Manager {
|
||||||
|
#currentContext!: string;
|
||||||
#currentContext!:string;
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
add( name:string, contextConfig:ContextInterface ) {
|
add(name: string, contextConfig: ContextInterface) {
|
||||||
super.add( name, new Context( contextConfig ) );
|
super.add(name, new Context(contextConfig));
|
||||||
|
|
||||||
if ( Object.values( this.getAll() ).length === 1 ) {
|
if (Object.values(this.getAll()).length === 1) {
|
||||||
this.#currentContext = name;
|
this.#currentContext = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentContextIs( contextName:string ) {
|
currentContextIs(contextName: string) {
|
||||||
return contextName === this.#currentContext;
|
return contextName === this.#currentContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
getCurrentContext() {
|
getCurrentContext() {
|
||||||
const contexts = this.getAll();
|
const contexts = this.getAll();
|
||||||
|
|
||||||
return ( contexts.hasOwnProperty( this.#currentContext ) ) ? contexts[this.#currentContext] : false;
|
return (contexts.hasOwnProperty(this.#currentContext)) ? contexts[this.#currentContext] : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
setContext( contextName:string ) {
|
setContext(contextName: string) {
|
||||||
|
if (!this.get(contextName)) {
|
||||||
if ( !this.get( contextName ) ) {
|
console.error(`setContext(): context name "${contextName}" does not exist.`);
|
||||||
console.error( `setContext(): context name "${contextName}" does not exist.` );
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.#currentContext = contextName;
|
this.#currentContext = contextName;
|
||||||
|
|
||||||
console.log( `Setting context to "${this.#currentContext}".` );
|
console.log(`Setting context to "${this.#currentContext}".`);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1196,7 +1196,7 @@ export class UnitsManager {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (units === null)
|
if (units === null)
|
||||||
units = this.getSelectedUnits({ excludeHumans: true });
|
units = this.getSelectedUnits();
|
||||||
|
|
||||||
if (units.length === 0)
|
if (units.length === 0)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from slpp import slpp as lua
|
|||||||
|
|
||||||
SEARCH_FOLDER = "D:\\Eagle Dynamics\\DCS World OpenBeta"
|
SEARCH_FOLDER = "D:\\Eagle Dynamics\\DCS World OpenBeta"
|
||||||
|
|
||||||
sys.path.append("D:\\Documents\\dcs")
|
sys.path.append("..\\..\\..\\dcs-master\\dcs-master")
|
||||||
|
|
||||||
from dcs.vehicles import *
|
from dcs.vehicles import *
|
||||||
from dcs.ships import *
|
from dcs.ships import *
|
||||||
@@ -29,7 +29,7 @@ if len(sys.argv) > 1:
|
|||||||
units_map = ship_map
|
units_map = ship_map
|
||||||
|
|
||||||
# Loads the database
|
# Loads the database
|
||||||
with open(filename) as f:
|
with open(filename, encoding="utf-8") as f:
|
||||||
database = json.load(f)
|
database = json.load(f)
|
||||||
|
|
||||||
for unit in units_map.values():
|
for unit in units_map.values():
|
||||||
@@ -41,7 +41,7 @@ if len(sys.argv) > 1:
|
|||||||
"label": unit.name,
|
"label": unit.name,
|
||||||
"shortLabel": unit.name,
|
"shortLabel": unit.name,
|
||||||
"type": unit.__qualname__.split(".")[0],
|
"type": unit.__qualname__.split(".")[0],
|
||||||
"enabled": True,
|
"enabled": False,
|
||||||
"liveries": {}
|
"liveries": {}
|
||||||
}
|
}
|
||||||
print("Added missing unit " + unit.id)
|
print("Added missing unit " + unit.id)
|
||||||
|
|||||||
Reference in New Issue
Block a user