vtm/quelldatein/aufbau/aktoren/annehmer.ts

144 lines
2.7 KiB
TypeScript
Raw Normal View History

2017-11-09 14:06:35 +01:00
/*
* Verrückte Turing-Maschinen A turing complete game
* Copyright (C) 2016 Christian Fraß <vidofnir@folksprak.org>
*
* This program is free software: you can redistribute it and/or modify
2018-03-26 00:41:10 +02:00
* it under the terms of the GNU General Public License as published by
2017-11-09 14:06:35 +01:00
* 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
2018-03-26 00:41:10 +02:00
* GNU General Public License for more details.
2017-11-09 14:06:35 +01:00
*
2018-03-26 00:41:10 +02:00
* You should have received a copy of the GNU General Public License
2017-11-09 14:06:35 +01:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
2017-11-08 15:05:06 +01:00
module mod_vtm_aufbau
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
2018-03-26 00:41:10 +02:00
export type typ_annehmer =
2017-11-08 15:05:06 +01:00
{
}
;
/**
* @author kcf <vidofnir@folksprak.org>
*/
2018-03-26 00:41:10 +02:00
function annehmer_erstellen
(
)
2018-03-26 00:41:10 +02:00
: typ_annehmer
{
return {
};
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
2018-03-26 00:41:10 +02:00
export function annehmer_erstellen_aktor
(
)
: typ_aktor
{
return {"art": "annehmer", "angaben": annehmer_erstellen()};
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
function annehmer_beispiel
(
)
: typ_annehmer
{
return annehmer_erstellen();
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
function annehmer_drehen
(
annehmer : typ_annehmer,
inkrement ?: int
)
: void
{
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
2018-03-26 00:41:10 +02:00
function annehmer_verwenden
(
annehmer : typ_annehmer,
figur : typ_figur
)
: void
{
figur_annehmen(figur);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
2018-03-26 00:41:10 +02:00
function annehmer_exportieren
(
annehmer : typ_annehmer
)
: any
{
return {
};
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
2018-03-26 00:41:10 +02:00
function annehmer_importieren
(
roh : any
)
: typ_annehmer
{
return (
2018-03-26 00:41:10 +02:00
annehmer_erstellen
(
)
);
2017-11-08 15:05:06 +01:00
}
2018-03-26 00:41:10 +02:00
/**
* @author kcf <vidofnir@folksprak.org>
*/
let wrap = (angaben => ({"art": "annehmer", "angaben": angaben}));
let unwrap = (aktor => aktor.angaben);
implementierung_aktor["annehmer"] =
{
"beispiel": () => wrap(annehmer_beispiel()),
"drehen": (aktor, inkrement) => annehmer_drehen(unwrap(aktor), inkrement),
"verwenden": (aktor, figur) => annehmer_verwenden(unwrap(aktor), figur),
"exportieren": (aktor) => ({"art": "annehmer_", "angaben": annehmer_exportieren(aktor.angaben)}),
"importieren": (roh) => wrap(annehmer_importieren(roh)),
}
;
2017-11-08 15:05:06 +01:00
}