Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tales of MajEyal
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tome
Tales of MajEyal
Commits
58769ead
There was a problem fetching the pipeline summary.
Commit
58769ead
authored
6 years ago
by
DarkGod
Browse files
Options
Downloads
Patches
Plain Diff
debug menu to spawn events
parent
6fb5236b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
game/modules/tome/dialogs/debug/DebugMain.lua
+1
-0
1 addition, 0 deletions
game/modules/tome/dialogs/debug/DebugMain.lua
game/modules/tome/dialogs/debug/SpawnEvent.lua
+102
-0
102 additions, 0 deletions
game/modules/tome/dialogs/debug/SpawnEvent.lua
with
103 additions
and
0 deletions
game/modules/tome/dialogs/debug/DebugMain.lua
+
1
−
0
View file @
58769ead
...
...
@@ -368,6 +368,7 @@ function _M:generateList()
list
[
#
list
+
1
]
=
{
name
=
"Give Sher'tul fortress energy"
,
action
=
"shertul-energy"
}
list
[
#
list
+
1
]
=
{
name
=
"Give all ingredients"
,
action
=
"all-ingredients"
}
list
[
#
list
+
1
]
=
{
name
=
"Weakdamage"
,
action
=
"weakdamage"
}
list
[
#
list
+
1
]
=
{
name
=
"Spawn Event"
,
dialog
=
"SpawnEvent"
}
list
[
#
list
+
1
]
=
{
name
=
"Endgamify"
,
action
=
"endgamify"
}
self
:
triggerHook
{
"DebugMain:generate"
,
menu
=
list
}
...
...
This diff is collapsed.
Click to expand it.
game/modules/tome/dialogs/debug/SpawnEvent.lua
0 → 100644
+
102
−
0
View file @
58769ead
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009 - 2018 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
require
"engine.class"
require
"engine.ui.Dialog"
local
List
=
require
"engine.ui.List"
local
GetQuantity
=
require
"engine.dialogs.GetQuantity"
module
(
...
,
package
.
seeall
,
class
.
inherit
(
engine
.
ui
.
Dialog
))
function
_M
:
init
()
self
:
generateList
()
engine
.
ui
.
Dialog
.
init
(
self
,
"DEBUG -- Spawn Event"
,
1
,
1
)
local
list
=
List
.
new
{
width
=
400
,
height
=
500
,
scrollbar
=
true
,
list
=
self
.
list
,
fct
=
function
(
item
)
self
:
use
(
item
)
end
}
self
:
loadUI
{
{
left
=
0
,
top
=
0
,
ui
=
list
},
}
self
:
setupUI
(
true
,
true
)
self
.
key
:
addCommands
{
__TEXTINPUT
=
function
(
c
)
for
i
=
list
.
sel
+
1
,
#
self
.
list
do
local
v
=
self
.
list
[
i
]
if
v
.
name
:
sub
(
1
,
1
):
lower
()
==
c
:
lower
()
then
list
:
select
(
i
)
return
end
end
for
i
=
1
,
list
.
sel
do
local
v
=
self
.
list
[
i
]
if
v
.
name
:
sub
(
1
,
1
):
lower
()
==
c
:
lower
()
then
list
:
select
(
i
)
return
end
end
end
}
self
.
key
:
addBinds
{
EXIT
=
function
()
game
:
unregisterDialog
(
self
)
end
,
LUA_CONSOLE
=
function
()
if
config
.
settings
.
cheat
then
local
DebugConsole
=
require
"engine.DebugConsole"
game
:
registerDialog
(
DebugConsole
.
new
())
end
end
,}
end
function
_M
:
on_register
()
game
:
onTickEnd
(
function
()
self
.
key
:
unicodeInput
(
true
)
end
)
end
function
_M
:
use
(
item
)
if
not
item
then
return
end
game
:
unregisterDialog
(
self
)
local
f
,
err
=
loadfile
(
item
.
path
)
if
not
f
then
error
(
err
)
end
setfenv
(
f
,
setmetatable
({
level
=
game
.
level
,
zone
=
game
.
zone
,
event_id
=
"test-event-"
..
rng
.
range
(
1
,
9999999
),
params
=
{},
Map
=
engine
.
Map
},
{
__index
=
_G
}))
f
()
end
function
_M
:
generateList
()
local
list
=
{}
local
function
parse
(
base
,
add
,
add_simple
)
for
i
,
file
in
ipairs
(
fs
.
list
(
base
..
"/general/events/"
))
do
local
f
=
loadfile
(
base
..
"/general/events/"
..
file
)
if
f
then
list
[
#
list
+
1
]
=
{
name
=
file
..
(
add_simple
and
" ["
..
add_simple
..
"]"
or
""
),
path
=
base
..
"/general/events/"
..
file
}
end
end
end
parse
(
"/data"
,
""
)
for
i
,
dir
in
ipairs
(
fs
.
list
(
"/"
))
do
local
_
,
_
,
addon
=
dir
:
find
(
"^data%-(.+)$"
)
if
addon
then
parse
(
"/"
..
dir
,
addon
..
"+"
,
addon
)
end
end
table.sort
(
list
,
function
(
a
,
b
)
return
a
.
name
<
b
.
name
end
)
local
chars
=
{}
for
i
,
v
in
ipairs
(
list
)
do
v
.
name
=
v
.
name
chars
[
self
:
makeKeyChar
(
i
)]
=
i
end
list
.
chars
=
chars
self
.
list
=
list
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment