Skip to content

Commit

Permalink
feat(scripting/properties): add Cinemascope, PlayerControls and Playe…
Browse files Browse the repository at this point in the history
…rInterface classes
  • Loading branch information
meszaros-lajos-gyorgy committed Sep 21, 2023
1 parent 639113a commit 8602998
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/scripting/properties/Cinemascope.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { ScriptProperty } from '@scripting/ScriptProperty.js'

/**
* A ScriptProperty for enabling or disabling cinematic borders
*
* @extends ScriptProperty
* @see https://wiki.arx-libertatis.org/Script:cinemascope
*/
export class Cinemascope extends ScriptProperty<boolean> {
isSliding: boolean

constructor(value: boolean, isSliding: boolean = false) {
super(value)
this.isSliding = isSliding
}

toString() {
return `cinemascope ${this.isSliding === true ? '-s' : ''} ${this.value === true ? 'on' : 'off'}`
}

static get on() {
return new Cinemascope(true)
}

static get off() {
return new Cinemascope(false)
}

static get slideIn() {
return new Cinemascope(true, true)
}

static get slideOut() {
return new Cinemascope(false, true)
}
}
22 changes: 22 additions & 0 deletions src/scripting/properties/PlayerControls.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ScriptProperty } from '@scripting/ScriptProperty.js'

/**
* A ScriptProperty for enabling and disabling user input.
* Disabling player controls are necessary during cutscenes.
*
* @extends ScriptProperty
* @see https://wiki.arx-libertatis.org/Script:setplayercontrols
*/
export class PlayerControls extends ScriptProperty<boolean> {
toString() {
return `setplayercontrols ${this.value === true ? 'on' : 'off'}`
}

static get on() {
return new PlayerControls(true)
}

static get off() {
return new PlayerControls(false)
}
}
38 changes: 38 additions & 0 deletions src/scripting/properties/PlayerInterface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { ScriptProperty } from '@scripting/ScriptProperty.js'

/**
* A ScriptProperty for showing and hiding a good chunk of the HUD.
* This command does not fully hide the HUD, only some parts of it.
* Currently the equipment indicators, inventories and minimap remain visible.
*
* @extends ScriptProperty
* @see https://wiki.arx-libertatis.org/Script:playerinterface
*/
export class PlayerInterface extends ScriptProperty<boolean> {
isSliding: boolean

constructor(value: boolean, isSliding: boolean = false) {
super(value)
this.isSliding = isSliding
}

toString() {
return `playerinterface ${this.isSliding === true ? '-s' : ''} ${this.value === true ? 'on' : 'off'}`
}

static get on() {
return new PlayerInterface(true)
}

static get off() {
return new PlayerInterface(false)
}

static get slideIn() {
return new PlayerInterface(true, true)
}

static get slideOut() {
return new PlayerInterface(false, true)
}
}
3 changes: 3 additions & 0 deletions src/scripting/properties/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
export { Cinemascope } from '@scripting/properties/Cinemascope.js'
export { Collision } from '@scripting/properties/Collision.js'
export { ControlZone } from '@scripting/properties/ControlZone.js'
export { Interactivity } from '@scripting/properties/Interactivity.js'
export { Invulnerability } from '@scripting/properties/Invulnerability.js'
export { Label } from '@scripting/properties/Label.js'
export { Material } from '@scripting/properties/Material.js'
export { PlayerControls } from '@scripting/properties/PlayerControls.js'
export { PlayerInterface } from '@scripting/properties/PlayerInterface.js'
export { Scale } from '@scripting/properties/Scale.js'
export { Shadow } from '@scripting/properties/Shadow.js'
export { Speed } from '@scripting/properties/Speed.js'
Expand Down

0 comments on commit 8602998

Please sign in to comment.