Skip to content

Commit 755e77b

Browse files
authored
Corpses (#208)
# Changes * Config options added to enable Corpses and a custom decay time for corpses, with a message to room of decaying * When mobs/players die, they drop corpses behind * Customized description when looking at corpses * `bury` command to force clean-up corpses * unit tests
1 parent 8bb9ec4 commit 755e77b

30 files changed

+653
-42
lines changed

_datafiles/config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ ShopRestockRate: 6 hours
186186
# varied.
187187
# Note: see _datafiles/combat-messages/*
188188
ConsistentAttackMessages: true
189+
# - CorpsesEnabled -
190+
# If set to true, corpses are left behind by players or mobs that are killed.
191+
CorpsesEnabled: true
192+
# - CorpseDecayTime -
193+
# How long until corpses crumble to dust (Go away).
194+
CorpseDecayTime: 1 hour
189195
# - MaxAltCharacters -
190196
# How many characters beyond their original character can they create? Players
191197
# can swap between characters and work on them independently if this is set

_datafiles/world/default/ansi-aliases.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ color8:
77
username: 93 # Bright yellow
88
username-aggro: red
99
username-downed: 90 # Bright black
10-
mobname: 14
10+
mobname: 14
1111
mobname-aggro: 91 # Bright red
1212
mobname-downed: red
1313
petname: 3
@@ -156,6 +156,8 @@ color8:
156156
script-text: 10
157157
broadcast-prefix: 8
158158
broadcast-body: 13
159+
mob-corpse: 8
160+
user-corpse: 8
159161
color256:
160162
table-title: 2
161163
userid: black
@@ -306,4 +308,5 @@ color256:
306308
script-text: 155
307309
broadcast-prefix: 135
308310
broadcast-body: 164
309-
311+
mob-corpse: 67
312+
user-corpse: 143

_datafiles/world/default/keywords.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ help:
2727
- character
2828
- pets
2929
- train
30+
- bury
3031
communication:
3132
- emote
3233
- say
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
<ansi fg="black-bold">.:</ansi> <ansi fg="8">{{ .Name }} corpse</ansi>
3+
┌─ <ansi fg="black-bold">.:</ansi><ansi fg="20">Description</ansi> ────────────────────────────────────────────────────────────┐
4+
<ansi fg="red-bold">☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠</ansi>
5+
<ansi fg="8">{{ splitstring .GetDescription 72 " "}}</ansi>
6+
<ansi fg="red-bold">☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠</ansi>
7+
<ansi fg="8">This is a corpse. They are dead.</ansi>
8+
└────────────────────────────────────────────────────────────────────────────┘
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

2-
<ansi fg="black-bold">.:</ansi> <ansi fg="username">{{ .Character.Name }}</ansi> (<ansi fg="{{ .Character.AlignmentName }}">{{ .Character.AlignmentName }}</ansi>)
3-
{{- $tnl := .Character.XPTNL -}}
4-
{{- $pct := (pct .Character.Experience $tnl ) -}}
5-
{{- $exp := printf "%d/%d (%d%%)" .Character.Experience $tnl $pct }}
2+
<ansi fg="black-bold">.:</ansi> <ansi fg="username">{{ .Name }}</ansi> (<ansi fg="{{ .AlignmentName }}">{{ .AlignmentName }}</ansi>)
3+
{{- $tnl := .XPTNL -}}
4+
{{- $pct := (pct .Experience $tnl ) -}}
5+
{{- $exp := printf "%d/%d (%d%%)" .Experience $tnl $pct }}
66
┌─ <ansi fg="black-bold">.:</ansi><ansi fg="20">Description</ansi> ────────────────────────────────────────────────────────────┐
7-
{{ splitstring .Character.GetDescription 72 " "}}
8-
{{ .Character.GetHealthAppearance }}
7+
{{ splitstring .GetDescription 72 " "}}
8+
{{ .GetHealthAppearance }}
99
└────────────────────────────────────────────────────────────────────────────┘
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

2-
<ansi fg="black-bold">.:</ansi> <ansi fg="username">{{ .Character.Name }}</ansi> the {{ profession .Character }}
3-
{{- $tnl := .Character.XPTNL -}}
4-
{{- $pct := (pct .Character.Experience $tnl ) -}}
5-
{{- $exp := printf "%d/%d (%d%%)" .Character.Experience $tnl $pct }}
2+
<ansi fg="black-bold">.:</ansi> <ansi fg="username">{{ .Name }}</ansi> the {{ profession . }}
3+
{{- $tnl := .XPTNL -}}
4+
{{- $pct := (pct .Experience $tnl ) -}}
5+
{{- $exp := printf "%d/%d (%d%%)" .Experience $tnl $pct }}
66
┌─ <ansi fg="black-bold">.:</ansi><ansi fg="20">Info</ansi> ──────────────────────┐ ┌─ <ansi fg="black-bold">.:</ansi><ansi fg="20">Attributes</ansi> ───────────────────────────┐
7-
│ <ansi fg="yellow">Health: </ansi>{{ printf "%-10d" .Character.Health }} <ansi fg="yellow">Max: </ansi>{{ printf "%-6d" .Character.HealthMax.Value }}│ │ <ansi fg="yellow">Strength: </ansi>{{ printf "%-4d<ansi fg=\"statmod\">(%-3d)</ansi>" .Character.Stats.Strength.Value (.Character.StatMod "strength") }} <ansi fg="yellow">Vitality: </ansi>{{ printf "%-4d<ansi fg=\"statmod\">(%-3d)</ansi>" .Character.Stats.Vitality.Value (.Character.StatMod "vitality") }} │
8-
<ansi fg="yellow">Mana: </ansi>{{ printf "%-10d" .Character.Mana }} <ansi fg="yellow">Max: </ansi>{{ printf "%-6d" .Character.ManaMax.Value }} <ansi fg="yellow">Speed: </ansi>{{ printf "%-4d<ansi fg=\"statmod\">(%-3d)</ansi>" .Character.Stats.Speed.Value (.Character.StatMod "speed") }} <ansi fg="yellow">Mysticism: </ansi>{{ printf "%-4d<ansi fg=\"statmod\">(%-3d)</ansi>" .Character.Stats.Mysticism.Value (.Character.StatMod "mysticism") }}
9-
<ansi fg="yellow">Armor: </ansi>{{ printf "%-22s" ( printf "%d" (.Character.GetDefense)) }} <ansi fg="yellow">Smarts: </ansi>{{ printf "%-4d<ansi fg=\"statmod\">(%-3d)</ansi>" .Character.Stats.Smarts.Value (.Character.StatMod "smarts") }} <ansi fg="yellow">Percept: </ansi>{{ printf "%-4d<ansi fg=\"statmod\">(%-3d)</ansi>" .Character.Stats.Perception.Value (.Character.StatMod "perception") }}
10-
<ansi fg="yellow">Level: </ansi>{{ printf "%-22d" .Character.Level }}
11-
│ <ansi fg="yellow">Gold: </ansi>{{ printf "%-22s" (numberFormat .Character.Gold) }}│ │ │
7+
│ <ansi fg="yellow">Health: </ansi>{{ printf "%-10d" .Health }} <ansi fg="yellow">Max: </ansi>{{ printf "%-6d" .HealthMax.Value }}│ │ <ansi fg="yellow">Strength: </ansi>{{ printf "%-4d<ansi fg=\"statmod\">(%-3d)</ansi>" .Stats.Strength.Value (.StatMod "strength") }} <ansi fg="yellow">Vitality: </ansi>{{ printf "%-4d<ansi fg=\"statmod\">(%-3d)</ansi>" .Stats.Vitality.Value (.StatMod "vitality") }} │
8+
<ansi fg="yellow">Mana: </ansi>{{ printf "%-10d" .Mana }} <ansi fg="yellow">Max: </ansi>{{ printf "%-6d" .ManaMax.Value }} <ansi fg="yellow">Speed: </ansi>{{ printf "%-4d<ansi fg=\"statmod\">(%-3d)</ansi>" .Stats.Speed.Value (.StatMod "speed") }} <ansi fg="yellow">Mysticism: </ansi>{{ printf "%-4d<ansi fg=\"statmod\">(%-3d)</ansi>" .Stats.Mysticism.Value (.StatMod "mysticism") }}
9+
<ansi fg="yellow">Armor: </ansi>{{ printf "%-22s" ( printf "%d" (.GetDefense)) }} <ansi fg="yellow">Smarts: </ansi>{{ printf "%-4d<ansi fg=\"statmod\">(%-3d)</ansi>" .Stats.Smarts.Value (.StatMod "smarts") }} <ansi fg="yellow">Percept: </ansi>{{ printf "%-4d<ansi fg=\"statmod\">(%-3d)</ansi>" .Stats.Perception.Value (.StatMod "perception") }}
10+
<ansi fg="yellow">Level: </ansi>{{ printf "%-22d" .Level }}
11+
│ <ansi fg="yellow">Gold: </ansi>{{ printf "%-22s" (numberFormat .Gold) }}│ │ │
1212
└───────────────────────────────┘ └──────────────────────────────────────────┘
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<ansi fg="black-bold">.:</ansi> <ansi fg="magenta">Help for </ansi><ansi fg="command">bury</ansi>
2+
3+
The <ansi fg="command">bury</ansi> command cleans up corpses from the room.
4+
5+
<ansi fg="yellow">Usage: </ansi>
6+
7+
<ansi fg="command">bury rat corpse</ansi>
8+
9+

_datafiles/world/empty/ansi-aliases.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ color8:
77
username: 93 # Bright yellow
88
username-aggro: red
99
username-downed: 90 # Bright black
10-
mobname: 14
10+
mobname: 14
1111
mobname-aggro: 91 # Bright red
1212
mobname-downed: red
1313
petname: 3
@@ -156,6 +156,8 @@ color8:
156156
script-text: 10
157157
broadcast-prefix: 8
158158
broadcast-body: 13
159+
mob-corpse: 8
160+
user-corpse: 8
159161
color256:
160162
table-title: 2
161163
userid: black
@@ -306,4 +308,5 @@ color256:
306308
script-text: 155
307309
broadcast-prefix: 135
308310
broadcast-body: 164
309-
311+
mob-corpse: 67
312+
user-corpse: 143

_datafiles/world/empty/keywords.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ help:
2727
- character
2828
- pets
2929
- train
30+
- bury
3031
communication:
3132
- emote
3233
- say
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
<ansi fg="black-bold">.:</ansi> <ansi fg="8">{{ .Name }} corpse</ansi>
3+
┌─ <ansi fg="black-bold">.:</ansi><ansi fg="20">Description</ansi> ────────────────────────────────────────────────────────────┐
4+
<ansi fg="red-bold">☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠</ansi>
5+
<ansi fg="8">{{ splitstring .GetDescription 72 " "}}</ansi>
6+
<ansi fg="red-bold">☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠</ansi>
7+
<ansi fg="8">This is a corpse. They are dead.</ansi>
8+
└────────────────────────────────────────────────────────────────────────────┘

0 commit comments

Comments
 (0)