Skip to content

Commit

Permalink
Converted replace-tile to a method Tile.replace.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kodiologist committed Dec 15, 2023
1 parent 2aa85f5 commit 1aaac51
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions simalq/tile/__init__.hy
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
(.insert (at pos) 0 @)
(object.__setattr__ @ "pos" pos))

(defmeth replace [new-stem]
(setv
(get (at @pos) (.index (at @pos) @))
((get Tile.types new-stem) :pos @pos)))

; The below variables and methods may be overridden by subclasses.

(setv
Expand Down Expand Up @@ -233,12 +238,6 @@
cls)


(defn replace-tile [old new-stem]
(setv
(get (at old.pos) (.index (at old.pos) old))
((get Tile.types new-stem) :pos old.pos)))


(defclass Actor [Tile]
"A kind of tile (typically a monster) that gets to do something each
turn that it's in the reality bubble."
Expand Down
4 changes: 2 additions & 2 deletions simalq/tile/scenery.hy
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
simalq.color :as color
simalq.util [CommandError DamageType next-in-cycle StatusEffect]
simalq.geometry [Pos Direction pos+ at burst dist dir-to]
simalq.tile [Tile EachTurner Damageable deftile replace-tile]
simalq.tile [Tile EachTurner Damageable deftile]
simalq.game-state [G])
(setv T True F False)

Expand Down Expand Up @@ -166,7 +166,7 @@
(raise (CommandError "It's locked, and you're keyless at the moment.")))
(-= G.player.keys 1)
(if @result-when-opened
(replace-tile @ @result-when-opened)
(@replace @result-when-opened)
(@rm-from-map))
True))

Expand Down

0 comments on commit 1aaac51

Please sign in to comment.