Noah Petherbridge
837960c477
* The crumbly floor doodad was made 50% larger. * New doodad: Small Key and Small Key Door. These work like the colored doors and locks except each Small Key is consumed when it unlocks a door. The door's appearance is of iron bars. * The inventory HUD displays a small quantity label in the lower-right corner of items that have a quantity, such as the Small Key. This is done as a Canvas.CornerLabel string attribute on uix.Canvas. * The "give all keys" cheat adds 99 Small Keys to your inventory.
95 lines
2.7 KiB
Go
95 lines
2.7 KiB
Go
package doodle
|
|
|
|
// cheatCommand is a subroutine of the Command.Run() method of the Doodle
|
|
// developer shell (commands.go). It looks for special cheat codes entered
|
|
// into the command shell and executes them.
|
|
//
|
|
// Returns true if a cheat was intercepted, false if the command is not a cheat.
|
|
func (c Command) cheatCommand(d *Doodle) bool {
|
|
// Some cheats only work in Play Mode.
|
|
playScene, isPlay := d.Scene.(*PlayScene)
|
|
|
|
// Cheat codes
|
|
switch c.Raw {
|
|
case "unleash the beast":
|
|
if fpsDoNotCap {
|
|
d.Flash("Reset frame rate throttle to factory default FPS")
|
|
} else {
|
|
d.Flash("Unleashing as many frames as we can render!")
|
|
}
|
|
fpsDoNotCap = !fpsDoNotCap
|
|
|
|
case "don't edit and drive":
|
|
if isPlay {
|
|
playScene.drawing.Editable = true
|
|
d.Flash("Level canvas is now editable. Don't edit and drive!")
|
|
} else {
|
|
d.Flash("Use this cheat in Play Mode to make the level canvas editable.")
|
|
}
|
|
|
|
case "scroll scroll scroll your boat":
|
|
if isPlay {
|
|
playScene.drawing.Scrollable = true
|
|
d.Flash("Level canvas is now scrollable with the arrow keys.")
|
|
} else {
|
|
d.Flash("Use this cheat in Play Mode to make the level scrollable.")
|
|
}
|
|
|
|
case "import antigravity":
|
|
if isPlay {
|
|
playScene.antigravity = !playScene.antigravity
|
|
playScene.Player.SetGravity(!playScene.antigravity)
|
|
|
|
if playScene.antigravity {
|
|
d.Flash("Gravity disabled for player character.")
|
|
} else {
|
|
d.Flash("Gravity restored for player character.")
|
|
}
|
|
} else {
|
|
d.Flash("Use this cheat in Play Mode to disable gravity for the player character.")
|
|
}
|
|
|
|
case "ghost mode":
|
|
if isPlay {
|
|
playScene.noclip = !playScene.noclip
|
|
playScene.Player.SetNoclip(playScene.noclip)
|
|
|
|
playScene.antigravity = playScene.noclip
|
|
playScene.Player.SetGravity(!playScene.antigravity)
|
|
|
|
if playScene.noclip {
|
|
d.Flash("Clipping disabled for player character.")
|
|
} else {
|
|
d.Flash("Clipping and gravity restored for player character.")
|
|
}
|
|
} else {
|
|
d.Flash("Use this cheat in Play Mode to disable clipping for the player character.")
|
|
}
|
|
|
|
case "give all keys":
|
|
if isPlay {
|
|
playScene.Player.AddItem("key-red.doodad", 0)
|
|
playScene.Player.AddItem("key-blue.doodad", 0)
|
|
playScene.Player.AddItem("key-green.doodad", 0)
|
|
playScene.Player.AddItem("key-yellow.doodad", 0)
|
|
playScene.Player.AddItem("small-key.doodad", 99)
|
|
d.Flash("Given all keys to the player character.")
|
|
} else {
|
|
d.Flash("Use this cheat in Play Mode to get all colored keys.")
|
|
}
|
|
|
|
case "drop all items":
|
|
if isPlay {
|
|
playScene.Player.ClearInventory()
|
|
d.Flash("Cleared inventory of player character.")
|
|
} else {
|
|
d.Flash("Use this cheat in Play Mode to clear your inventory.")
|
|
}
|
|
|
|
default:
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|