первая сцена

This commit is contained in:
Alexander Yakovlev 2020-12-21 17:08:22 +07:00
parent 5c5187e012
commit 68e6cbdf4c
Signed by: oreolek
GPG key ID: 1CDC4B7820C93BD3
3 changed files with 146 additions and 43 deletions

View file

@ -1,54 +1,147 @@
-- Здесь мы настраиваем парсер.
mp.msg.SCENE = "{#Me} {#plural/находишься,находитесь} {#if_has/#here,supporter,на,в} {#here/пр,2}.";
function split(s, sep)
if sep == nil then
sep = ","
end
local t={}
for str in string.gmatch(s, "([^"..sep.."]+)") do
table.insert(t, str)
end
return t
end
local function istable(t) return type(t) == 'table' end
-- "Ты/вы" в разных падежах: им, род, дат, вин, твор, пред.
function mp.shortcut.you(case)
if case == nil then
case = 'им'
end
if case == 'им' then
if pl.plural then
return 'вы'
end
return 'ты'
end
if case == 'род' then
if pl.plural then
return 'вас'
end
return 'тебя'
end
if case == 'дат' then
if pl.plural then
return 'вам'
end
return 'тебе'
end
if case == 'вин' then
if pl.plural then
return 'вас'
end
return 'тебя'
end
if case == 'твор' then
if pl.plural then
return 'вами'
end
return 'тобой'
end
if case == 'пред' then
if pl.plural then
return 'вас'
end
return 'тебе'
end
end
function mp.shortcut.plural(options)
if not istable(options) then
options = split(options)
end
if pl.plural then
return options[2]
end
return options[1]
end
-- {#g/singlefem,singlemasc,singleother,plural}
function mp.shortcut.g(options)
if not istable(options) then
options = split(options)
end
if #options == 2 then
return mp.shortcut.plural(options)
end
if pl.plural then
return options[4]
end
if pl.pronouns == 'fem' then
return options[1]
end
if pl.pronouns == 'masc' then
return options[2]
end
if pl.pronouns == 'other' then
return options[3]
end
return options[1]
end
game:dict {
["Димидий/мр,C,но,ед"] = {
"Димидий/им",
"Димидий/вн",
"Димидия/рд",
"Димидию/дт",
"Димидием/тв",
"Димидии/пр",
}
["Димидий/мр,C,но,ед"] = {
"Димидий/им",
"Димидий/вн",
"Димидия/рд",
"Димидию/дт",
"Димидием/тв",
"Димидии/пр",
}
}
function game:before_Any(ev, w)
if ev == "Ask" or ev == "Say" or ev == "Tell" or ev == "AskFor" or ev == "AskTo" then
p [[Попробуйте просто поговорить.]];
return
end
return false
if ev == "Ask" or ev == "Say" or ev == "Tell" or ev == "AskFor" or ev == "AskTo" then
p [[Попробуйте просто поговорить.]];
return
end
return false
end
function mp:pre_input(str)
local a = std.split(str)
if #a <= 1 or #a > 3 then
return str
end
if a[1] == 'в' or a[1] == 'на' or a[1] == 'во' or
a[1] == "к" or a[1] == 'ко' then
return "идти "..str
end
return str
local a = std.split(str)
if #a <= 1 or #a > 3 then
return str
end
if a[1] == 'в' or a[1] == 'на' or a[1] == 'во' or
a[1] == "к" or a[1] == 'ко' then
return "идти "..str
end
return str
end
Distance = Class {
before_Default = function(s, ev)
if ev == "Exam" or ev == "Look" or ev == "Search" then
return false
end
p ("Но ", s:noun(), " очень далеко.");
end;
before_Default = function(s, ev)
if ev == "Exam" or ev == "Look" or ev == "Search" then
return false
end
p ("Но ", s:noun(), " очень далеко.");
end;
}:attr 'scenery'
Furniture = Class {
['before_Push,Pull,Transfer,Take'] = [[Пусть лучше
{#if_hint/#first,plural,стоят,стоит} там, где
{#if_hint/#first,plural,стоят,стоит}.]];
['before_Push,Pull,Transfer,Take'] = [[Пусть лучше
{#if_hint/#first,plural,стоят,стоит} там, где
{#if_hint/#first,plural,стоят,стоит}.]];
}:attr 'static'
Prop = Class {
before_Default = function(s, ev)
p ("Тебе нет дела до ", s:noun 'рд', ".")
end;
before_Default = function(s, ev)
p ("Тебе нет дела до ", s:noun 'рд', ".")
end;
}:attr 'scenery'

View file

@ -3,6 +3,7 @@
--$Author:Александр Яковлев$
require "fmt"
require 'dbg'
if instead.tiny then
function iface:tab()
return ' '
@ -23,12 +24,13 @@ function set_pic(f)
if instead.tiny then
return
end
if theme.get('scr.gfx.bg') ~= f then
--if theme.get('scr.gfx.bg') ~= f then
theme.gfx.bg('bgr/'..f)
end
--end
end
game.dsc = ''
player.description = "Здесь нет зеркал. Но хотя бы ноги выглядят прекрасно.";
set_pic('wall.jpg')
pl.plural = false
pl.pronouns = 'fem'
@ -38,6 +40,11 @@ dofile('rooms/pantry.lua')
dlg {
nam = 'main';
-- DEBUG STARTS
enter = function()
walk('pantry')
end;
-- DEBUG ENDS
title = 'Выберите свои местоимения';
phr = {
{
@ -46,7 +53,6 @@ dlg {
pl.plural = false;
pl.pronouns = 'fem';
std.player.word = 'ты/жр,2л'
mp.msg.SCENE = "{#Me} {#word/находишься,#me,нст} {#if_has/#here,supporter,на,в} {#here/пр,2}.";
walk('pantry')
end
},
@ -56,7 +62,6 @@ dlg {
pl.plural = false;
pl.pronouns = 'masc';
std.player.word = 'ты/мр,2л'
mp.msg.SCENE = "{#Me} {#word/находишься,#me,нст} {#if_has/#here,supporter,на,в} {#here/пр,2}.";
walk('pantry')
end
},
@ -66,7 +71,6 @@ dlg {
pl.plural = false
pl.pronouns = 'other'
std.player.word = 'вы/cр,2л'
mp.msg.SCENE = "{#Me} {#word/находитесь,#me,нст} {#if_has/#here,supporter,на,в} {#here/пр,2}.";
walk('pantry')
end
},
@ -76,7 +80,6 @@ dlg {
pl.plural = true;
pl.pronouns = 'other';
std.player.word = 'вы/cр,мн,2л'
mp.msg.SCENE = "{#Me} {#word/находитесь,#me,нст} {#if_has/#here,supporter,на,в} {#here/пр,2}.";
walk('pantry')
end
},

View file

@ -1,8 +1,15 @@
room {
nam = 'pantry';
enter = function(self, from)
if from^'main' then
pn "Привет"
dsc = function()
if visits() < 2 then
-- if not visited() then
pn "{#You} {#g/летишь,летите} из Йоханнесбурга (Земля) в Петербург (планета Проксима Центавра b). Всего четыре часа полёта в эконом-классе. Как раз, чтобы дочитать увлекательную книгу о приключениях капитана Киркунова.^";
p "Но, не {#g/успела,успел,успело,успели} {#you} закончить и первой главы, как откуда-то спереди донёсся душераздирающий крик. {#You} {#g/увидела,увидел,увидело,увидели}, как впереди по проходу медленно шагает на чёрных щупальцах какая-то иссине-чёрная ";
p(fmt.b("инопланетная"));
p "клякса.";
pn "{#You} {#g/бросилась,бросился,бросилось,бросились} бежать к корме судна и {#word/нырнула,нырнул,нырнуло,нырнули} в первую же комнату, чтобы найти хотя бы кого-то из экипажа.^";
p "^^Вдруг дверь за {#you/твор} закрылась и выставила защитные щиты.";
pn "{#You} {#plural/заперт,заперты}.^^";
end
end;
}