vtm/source/model/actuators/_actuator.ts
Christian Fraß 931b6f61d3 update
2018-03-29 22:00:42 +02:00

115 lines
3.1 KiB
TypeScript

/*
* Verrückte Turing-Maschinen — A turing complete game
* Copyright (C) 2016-2018 kcf <vidofnir@folksprak.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
module mod_vtm
{
export module mod_model
{
export module mod_actuator
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
export type type_actuator = lib_call.type_complex<any>;
/**
* @author kcf <vidofnir@folksprak.org>
*/
export type signature_actuator =
{
example : ()=>type_actuator;
rotate : (actuator : type_actuator, increment : int)=>void;
use : (actuator : type_actuator, token : mod_token.type_token)=>void;
export : (actuator : type_actuator)=>any;
import : (raw : any)=>type_actuator;
}
;
/**
* @author kcf <vidofnir@folksprak.org>
*/
export var trait_actuator : lib_trait.type_trait<signature_actuator> = lib_trait.create<signature_actuator>();
/**
* @author kcf <vidofnir@folksprak.org>
*/
/*
export function create(kind : string, kern : any) : type_actuator
{
return lib_call.wrap(kind, kern);
}
*/
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function example(kind : string) : type_actuator
{
return lib_trait.deploy(trait_actuator, kind)["example"]();
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function rotate(actuator : type_actuator, increment ?: int) : void
{
return lib_trait.deploy(trait_actuator, actuator.kind)["rotate"](actuator, increment);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function use(actuator : type_actuator, token : mod_token.type_token) : void
{
return lib_trait.deploy(trait_actuator, actuator.kind)["use"](actuator, token);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function export_(actuator : type_actuator) : any
{
return lib_trait.deploy(trait_actuator, actuator.kind)["export"](actuator);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function import_(raw : any) : type_actuator
{
return lib_trait.deploy(trait_actuator, raw.kind)["import"](raw);
}
}
}
}