vtm/quelldatein/aufbau/aktoren/erzeuger.ts

123 lines
2.4 KiB
TypeScript

/*
* 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
* 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_aufbau
{
/**
* @author kcf <vidofnir@folksprak.org>
*/
export type typ_aktor_erzeuger =
{
richtung : typ_richtung;
}
;
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_erzeuger_erstellen
(
richtung : typ_richtung = 0
)
: typ_aktor_erzeuger
{
return {
"richtung": richtung,
};
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_erzeuger_richtung_lesen
(
aktor_erzeuger : typ_aktor_erzeuger
)
: typ_richtung
{
return aktor_erzeuger.richtung;
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_erzeuger_drehen
(
aktor_erzeuger : typ_aktor_erzeuger,
inkrement : int = +1
)
: void
{
aktor_erzeuger.richtung = richtung_addieren(aktor_erzeuger.richtung, inkrement);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_erzeuger_verwenden
(
aktor_erzeuger : typ_aktor_erzeuger,
figur : typ_figur
)
: void
{
figur_bewegen(figur, aktor_erzeuger.richtung);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_erzeuger_exportieren
(
aktor_erzeuger : typ_aktor_erzeuger
)
: any
{
return {
"richtung": richtung_exportieren(aktor_erzeuger.richtung),
};
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_erzeuger_importieren
(
roh : any
)
: typ_aktor_erzeuger
{
return (
aktor_erzeuger_erstellen
(
richtung_importieren(roh["richtung"])
)
);
}
}