Skip to content

Commit 0fc1205

Browse files
committed
Merge branch 'dev' of github.com:pythonfoo/fantasy_forge
2 parents 4c2e685 + 726376e commit 0fc1205

3 files changed

Lines changed: 32 additions & 18 deletions

File tree

‎data/worlds/chaosdorf/areas/cave.toml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ description = "a comfy room with sofas and a tv"
55
name = "tv"
66
description = "Hackers has to run for the thousandth time now"
77
obvious = true
8+
moveable = false
9+
carryable = false
810

911
[[contents]]
1012
kind = "key"

‎src/fantasy_forge/player.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def look_around(self):
7171
)
7272
self.seen_entities[entity.name] = entity
7373

74-
def look_at(self, name: str):
74+
def inspect(self, name: str):
7575
"""Calls the on_look method of an object."""
7676
entity = self.seen_entities.get(name)
7777
if entity is None:

‎src/fantasy_forge/shell.py‎

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -79,29 +79,23 @@ def do_exit(self, arg: str) -> bool:
7979
"""Quits the shell."""
8080
return self.do_EOF(arg)
8181

82-
def do_look(self, arg: str):
83-
"""look around
84-
look at <entity>
82+
def do_inspect(self, arg: str):
83+
"""inspect entity
84+
inspect <entity>
8585
"""
86-
if arg.strip() == "around":
87-
self.player.look_around()
88-
logger.debug("%s looks around" % self.player.name)
89-
elif arg.strip().startswith("at"):
90-
entity_name = arg.strip().removeprefix("at").strip()
91-
self.player.look_at(entity_name)
92-
logger.debug("%s looks at %s" % (self.player.name, entity_name))
93-
else:
94-
self.default(arg)
86+
entity_name = arg.strip()
87+
self.player.inspect(entity_name)
88+
logger.debug("%s looks at %s" % (self.player.name, entity_name))
9589

96-
def complete_look(
90+
def complete_inspect(
9791
self,
9892
text: str,
9993
line: str,
10094
begidx: int,
10195
endidx: int,
10296
):
103-
if line.startswith("look at "):
104-
entity_name = line.removeprefix("look at ").strip()
97+
if line.startswith("inspect "):
98+
entity_name = line.removeprefix("inspect ").strip()
10599
completions = [
106100
text + name.removeprefix(entity_name).strip() + " "
107101
for name in self.player.seen_entities.keys()
@@ -110,10 +104,28 @@ def complete_look(
110104
if " " in completions:
111105
completions.remove(" ")
112106
return completions
107+
108+
def do_look(self, arg: str):
109+
"""look around
110+
look around <entity>
111+
"""
112+
if arg.strip() == "around":
113+
self.player.look_around()
114+
logger.debug("%s looks around" % self.player.name)
115+
else:
116+
self.default(arg)
117+
118+
def complete_look(
119+
self,
120+
text: str,
121+
line: str,
122+
begidx: int,
123+
endidx: int,
124+
):
125+
if line.startswith("look "):
126+
return ["around"]
113127
if line.startswith("look around "):
114128
return []
115-
if line.startswith("look "):
116-
return [verb for verb in ["at ", "around "] if verb.startswith(text)]
117129
return []
118130

119131
def do_pick(self, arg: str):

0 commit comments

Comments
 (0)