mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Fixed UCP toggles, added copy-paste control for plugins
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
export interface ContextInterface {
|
||||
allowUnitCopying?: boolean;
|
||||
allowUnitPasting?: boolean;
|
||||
useSpawnMenu?: boolean;
|
||||
useUnitControlPanel?: boolean;
|
||||
useUnitInfoPanel?: boolean;
|
||||
@@ -6,16 +8,28 @@ export interface ContextInterface {
|
||||
|
||||
export class Context {
|
||||
|
||||
#allowUnitCopying:boolean;
|
||||
#allowUnitPasting:boolean;
|
||||
#useSpawnMenu:boolean;
|
||||
#useUnitControlPanel:boolean;
|
||||
#useUnitInfoPanel:boolean;
|
||||
|
||||
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() {
|
||||
return this.#allowUnitCopying;
|
||||
}
|
||||
|
||||
getAllowUnitPasting() {
|
||||
return this.#allowUnitPasting;
|
||||
}
|
||||
|
||||
getUseSpawnMenu() {
|
||||
return this.#useSpawnMenu;
|
||||
}
|
||||
|
||||
@@ -1001,6 +1001,9 @@ export class UnitsManager {
|
||||
*
|
||||
*/
|
||||
copy(units: Unit[] | null = null) {
|
||||
if ( !getApp().getContextManager().getCurrentContext().getAllowUnitCopying() )
|
||||
return;
|
||||
|
||||
if (units === null)
|
||||
units = this.getSelectedUnits({ excludeHumans: true });
|
||||
|
||||
@@ -1018,6 +1021,9 @@ export class UnitsManager {
|
||||
* @returns True if units were pasted successfully
|
||||
*/
|
||||
paste() {
|
||||
if ( !getApp().getContextManager().getCurrentContext().getAllowUnitPasting() )
|
||||
return;
|
||||
|
||||
let spawnPoints = 0;
|
||||
|
||||
/* If spawns are restricted, check that the user has the necessary spawn points */
|
||||
|
||||
Reference in New Issue
Block a user