vtm/quelldatein/aufbau/aktoren/befoerderer.ts

97 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 export function aktor_befoerderer_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 export function aktor_befoerderer_License for more details.
*
* You should have received a copy of the GNU General export function aktor_befoerderer_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_befoerderer =
{
richtung : typ_richtung;
}
;
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_befoerderer_erstellen(richtung : typ_richtung = 0) : typ_aktor_befoerderer
{
return {
"richtung": richtung,
};
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_befoerderer_richtung_lesen(aktor_befoerderer : typ_aktor_befoerderer) : typ_richtung
{
return aktor_befoerderer.richtung;
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_befoerderer_drehen(aktor_befoerderer : typ_aktor_befoerderer, inkrement : int = +1) : void
{
aktor_befoerderer.richtung = richtung_addieren(aktor_befoerderer.richtung, inkrement);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_befoerderer_verwenden(aktor_befoerderer : typ_aktor_befoerderer, figur : typ_figur) : void
{
figur_bewegen(figur, aktor_befoerderer.richtung);
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_befoerderer_exportieren(aktor_befoerderer : typ_aktor_befoerderer) : any
{
return {
"richtung": richtung_exportieren(aktor_befoerderer.richtung),
};
}
/**
* @author kcf <vidofnir@folksprak.org>
*/
export function aktor_befoerderer_importieren(roh : any) : typ_aktor_befoerderer
{
return (
aktor_befoerderer_erstellen
(
richtung_importieren(roh["richtung"])
)
);
}
}