Add the computer character

Still a bit buggy, but responds to a few commands
This commit is contained in:
Dan Jones 2022-01-11 10:22:02 -06:00
commit 670fb183e1
4 changed files with 58 additions and 15 deletions

42
Characters.inf Normal file
View file

@ -0,0 +1,42 @@
! @todo fix talking to computer when lights are off
! @todo fix computer not being in bunk
Object computer "Computer"
with name 'computer' 'ship',
description "The computer of the ship uses non-sentient artificial intelligence^
It can perform many tasks and answer questions.",
found_in [; rtrue; ],
orders [loc ;
loc = parent(player);
SetTo:
if (noun == lights && second == 'full') {
give loc light;
print_ret "Lights at full.";
}
if (noun == lights && (second == 'zero' || second == 'off')) {
give loc ~light;
print_ret "Lights are off.";
}
print_ret "I do not know how to set ", (the) noun, " to ", (address) second;
Open:
switch(noun) {
bunk:
give noun open;
print_ret (The) noun, " is open.";
}
Close:
switch(noun) {
bunk:
give noun ~open;
print_ret (The) noun, " is closed.";
}
Tell:
! @todo fill this out for various things to talk about
print_ret "You want me to tell you about ", (string) second;
NotUnderstood: print_ret "I do not understand.";
],
has animate scenery;
Object lights "Lights"
with name 'lights',
found_in [; rtrue; ],
has static scenery;

View file

@ -1,11 +1,11 @@
Class Room has light; Class Room has light;
Class Set ! Class Set
with before [; ! with before [;
Examine: return false; ! Examine: return false;
default: print_ret "You can't do that with ", (the) self, "."; ! default: print_ret "You can't do that with ", (the) self, ".";
], ! ],
has scenery; ! has scenery;
Class Decoration Class Decoration
with before [; with before [;
@ -14,10 +14,10 @@ Class Decoration
], ],
has static; has static;
Class Furniture ! Class Furniture
class Decoration, ! class Decoration,
with before [; ! with before [;
Take,Pull,Push,PushDir: ! Take,Pull,Push,PushDir:
print_ret (the) self, " is too heavy for that."; ! print_ret (the) self, " is too heavy for that.";
], ! ],
has supporter; ! has supporter;

View file

@ -10,4 +10,4 @@ Room bunk "Your bunk" lower_decks
with name 'bunk' 'bunks', with name 'bunk' 'bunks',
description "Your bunk is like every other bunk on the lower decks.^ description "Your bunk is like every other bunk on the lower decks.^
It's barely big enough to fit you. But it's home.", It's barely big enough to fit you. But it's home.",
has enterable container openable; has enterable container static ~open ~light;

View file

@ -9,10 +9,11 @@ Include "VerbLib";
Include "Globals.inf"; Include "Globals.inf";
Include "Classes.inf"; Include "Classes.inf";
Include "Rooms.inf"; Include "Rooms.inf";
Include "Characters.inf";
Include "Items.inf"; Include "Items.inf";
[ Initialise ; [ Initialise ;
location = bunk; location = lower_decks; ! @todo switch to bunk
player.description = "You are wearing an operations uniform, player.description = "You are wearing an operations uniform,
with a single pip."; with a single pip.";
]; ];