Level Difficulty + UI Polish
Added a new level property: Difficulty * An enum ranging from -1, 0, 1 (Peaceful, Normal, Hard) * Default difficulty is Normal; pre-existing levels are Normal by default per the zero value. Doodad scripts can read the difficulty via the new global variable `Level.Difficulty` and some doodads have been updated: * Azulians: on Peaceful they ignore all player characters, and on Hard they are in "hunt mode": infinite aggro radius and they're aggressive to all characters. * Bird: on Peaceful they will not dive and attack any player character. Other spit and polish: * New Level/Level Properties UI reworked into a magicform. * New "PromptPre(question, answer, func)" function for prompting the user with the developer shell, but pre-filling in an answer for them to either post or edit. * magicform has a PromptUser field option for simple Text/Int fields which present as buttons, so magicform can prompt and update the variable itself. * Don't show the _autosave.doodad in the Doodad Dropper window.
This commit is contained in:
parent
d0ae46402b
commit
2fab31d97b
|
@ -71,7 +71,8 @@ function main() {
|
||||||
myPt = Self.Position();
|
myPt = Self.Position();
|
||||||
|
|
||||||
// If the player is within aggro range, move towards.
|
// If the player is within aggro range, move towards.
|
||||||
if (Math.abs(playerPt.X - myPt.X) < aggroX && Math.abs(playerPt.Y - myPt.Y) < aggroY) {
|
if ((Math.abs(playerPt.X - myPt.X) < aggroX && Math.abs(playerPt.Y - myPt.Y) < aggroY)
|
||||||
|
|| (Level.Difficulty > 0)) {
|
||||||
direction = playerPt.X < myPt.X ? "left" : "right";
|
direction = playerPt.X < myPt.X ? "left" : "right";
|
||||||
followPlayer = true;
|
followPlayer = true;
|
||||||
|
|
||||||
|
@ -134,11 +135,16 @@ function playerControls() {
|
||||||
// will be hostile towards the player). Boring players will not be chased after and
|
// will be hostile towards the player). Boring players will not be chased after and
|
||||||
// the Azulian will not harm them if they make contact.
|
// the Azulian will not harm them if they make contact.
|
||||||
function isPlayerFood(actor) {
|
function isPlayerFood(actor) {
|
||||||
// Not a player or is invulnerable.
|
// Not a player or is invulnerable, or Peaceful difficulty.
|
||||||
if (!actor.IsPlayer() || actor.Invulnerable()) {
|
if (!actor.IsPlayer() || actor.Invulnerable() || Level.Difficulty < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// On hard mode they are hostile to any player.
|
||||||
|
if (Level.Difficulty > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Azulians are friendly to Thieves and other Azulians.
|
// Azulians are friendly to Thieves and other Azulians.
|
||||||
if (actor.Doodad().Filename === "thief.doodad" || actor.Doodad().Title.indexOf("Azulian") > -1) {
|
if (actor.Doodad().Filename === "thief.doodad" || actor.Doodad().Title.indexOf("Azulian") > -1) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -109,6 +109,11 @@ function main() {
|
||||||
// It's not hostile towards characters that can fly (having
|
// It's not hostile towards characters that can fly (having
|
||||||
// no gravity).
|
// no gravity).
|
||||||
function AI_ScanForPlayer() {
|
function AI_ScanForPlayer() {
|
||||||
|
// If Peaceful difficulty, do not attack.
|
||||||
|
if (Level.Difficulty < 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
let stepY = 12, // number of pixels to skip
|
let stepY = 12, // number of pixels to skip
|
||||||
stepX = stepY,
|
stepX = stepY,
|
||||||
limit = stepX * 20, // furthest we'll scan
|
limit = stepX * 20, // furthest we'll scan
|
||||||
|
|
Loading…
Reference in New Issue
Block a user