Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
3cffdd97
Commit
3cffdd97
authored
May 18, 2022
by
Melledy
Browse files
Cleanup and remove business_type filter
parent
4b5f5b3d
Changes
3
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/world/Scene.java
View file @
3cffdd97
...
@@ -531,14 +531,14 @@ public class Scene {
...
@@ -531,14 +531,14 @@ public class Scene {
public
List
<
SceneGroup
>
playerMeetGroups
(
Player
player
,
SceneBlock
block
){
public
List
<
SceneGroup
>
playerMeetGroups
(
Player
player
,
SceneBlock
block
){
int
RANGE
=
100
;
int
RANGE
=
100
;
var
sceneGroups
=
SceneIndexManager
.
queryNeighbors
(
block
.
sceneGroupIndex
,
player
.
getPos
(),
RANGE
);
List
<
SceneGroup
>
sceneGroups
=
SceneIndexManager
.
queryNeighbors
(
block
.
sceneGroupIndex
,
player
.
getPos
(),
RANGE
);
var
groups
=
new
ArrayList
<>(
sceneGroups
.
stream
()
List
<
SceneGroup
>
groups
=
sceneGroups
.
stream
()
.
filter
(
group
->
!
scriptManager
.
getLoadedGroupSetPerBlock
().
get
(
block
.
id
).
contains
(
group
)
&&
group
.
getBusinessType
()
==
0
)
.
filter
(
group
->
!
scriptManager
.
getLoadedGroupSetPerBlock
().
get
(
block
.
id
).
contains
(
group
))
.
peek
(
group
->
scriptManager
.
getLoadedGroupSetPerBlock
().
get
(
block
.
id
).
add
(
group
))
.
peek
(
group
->
scriptManager
.
getLoadedGroupSetPerBlock
().
get
(
block
.
id
).
add
(
group
))
.
toList
()
)
;
.
toList
();
if
(
groups
.
size
()
==
0
){
if
(
groups
.
size
()
==
0
)
{
return
List
.
of
();
return
List
.
of
();
}
}
...
...
src/main/java/emu/grasscutter/scripts/SceneScriptManager.java
View file @
3cffdd97
...
@@ -354,6 +354,9 @@ public class SceneScriptManager {
...
@@ -354,6 +354,9 @@ public class SceneScriptManager {
entity
.
setPointType
(
g
.
point_type
);
entity
.
setPointType
(
g
.
point_type
);
entity
.
buildContent
();
entity
.
buildContent
();
// Lua event
this
.
callEvent
(
EventType
.
EVENT_GADGET_CREATE
,
new
ScriptArgs
(
entity
.
getConfigId
()));
return
entity
;
return
entity
;
}
}
...
@@ -391,31 +394,22 @@ public class SceneScriptManager {
...
@@ -391,31 +394,22 @@ public class SceneScriptManager {
this
.
getScriptMonsterSpawnService
()
this
.
getScriptMonsterSpawnService
()
.
onMonsterCreatedListener
.
forEach
(
action
->
action
.
onNotify
(
entity
));
.
onMonsterCreatedListener
.
forEach
(
action
->
action
.
onNotify
(
entity
));
// Lua event
callEvent
(
EventType
.
EVENT_ANY_MONSTER_LIVE
,
new
ScriptArgs
(
entity
.
getConfigId
()));
return
entity
;
return
entity
;
}
}
public
void
addEntity
(
GameEntity
gameEntity
){
public
void
addEntity
(
GameEntity
gameEntity
){
getScene
().
addEntity
(
gameEntity
);
getScene
().
addEntity
(
gameEntity
);
callCreateEvent
(
gameEntity
);
}
}
public
void
meetEntities
(
List
<?
extends
GameEntity
>
gameEntity
){
public
void
meetEntities
(
List
<?
extends
GameEntity
>
gameEntity
){
getScene
().
addEntities
(
gameEntity
,
VisionTypeOuterClass
.
VisionType
.
VISION_MEET
);
getScene
().
addEntities
(
gameEntity
,
VisionTypeOuterClass
.
VisionType
.
VISION_MEET
);
gameEntity
.
forEach
(
this
::
callCreateEvent
);
}
}
public
void
addEntities
(
List
<?
extends
GameEntity
>
gameEntity
){
public
void
addEntities
(
List
<?
extends
GameEntity
>
gameEntity
){
getScene
().
addEntities
(
gameEntity
);
getScene
().
addEntities
(
gameEntity
);
gameEntity
.
forEach
(
this
::
callCreateEvent
);
}
public
void
callCreateEvent
(
GameEntity
gameEntity
){
if
(!
isInit
){
return
;
}
if
(
gameEntity
instanceof
EntityMonster
entityMonster
){
callEvent
(
EventType
.
EVENT_ANY_MONSTER_LIVE
,
new
ScriptArgs
(
entityMonster
.
getConfigId
()));
}
if
(
gameEntity
instanceof
EntityGadget
entityGadget
){
this
.
callEvent
(
EventType
.
EVENT_GADGET_CREATE
,
new
ScriptArgs
(
entityGadget
.
getConfigId
()));
}
}
}
public
PhTree
<
SceneBlock
>
getBlocksIndex
()
{
public
PhTree
<
SceneBlock
>
getBlocksIndex
()
{
...
...
src/main/java/emu/grasscutter/scripts/ScriptLib.java
View file @
3cffdd97
...
@@ -376,11 +376,14 @@ public class ScriptLib {
...
@@ -376,11 +376,14 @@ public class ScriptLib {
var
configId
=
table
.
get
(
"config_id"
).
toint
();
var
configId
=
table
.
get
(
"config_id"
).
toint
();
var
group
=
getCurrentGroup
();
var
group
=
getCurrentGroup
();
if
(
group
.
isEmpty
()){
if
(
group
.
isEmpty
())
{
return
1
;
return
1
;
}
}
var
gadget
=
group
.
get
().
gadgets
.
get
(
configId
);
var
gadget
=
group
.
get
().
gadgets
.
get
(
configId
);
var
entity
=
getSceneScriptManager
().
createGadget
(
group
.
get
().
id
,
group
.
get
().
block_id
,
gadget
);
var
entity
=
getSceneScriptManager
().
createGadget
(
group
.
get
().
id
,
group
.
get
().
block_id
,
gadget
);
getSceneScriptManager
().
addEntity
(
entity
);
getSceneScriptManager
().
addEntity
(
entity
);
return
0
;
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment