Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Grasscutter
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
ziqian zhang
Grasscutter
Commits
02d2d728
Commit
02d2d728
authored
3 years ago
by
Melledy
Browse files
Options
Downloads
Patches
Plain Diff
Dont deregister scenes if the player is going to tp back into them
parent
b8614d63
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/emu/grasscutter/game/GenshinScene.java
+10
-1
10 additions, 1 deletion
src/main/java/emu/grasscutter/game/GenshinScene.java
src/main/java/emu/grasscutter/game/World.java
+16
-6
16 additions, 6 deletions
src/main/java/emu/grasscutter/game/World.java
with
26 additions
and
7 deletions
src/main/java/emu/grasscutter/game/GenshinScene.java
+
10
−
1
View file @
02d2d728
...
@@ -47,6 +47,7 @@ public class GenshinScene {
...
@@ -47,6 +47,7 @@ public class GenshinScene {
private
final
Set
<
SpawnDataEntry
>
spawnedEntities
;
private
final
Set
<
SpawnDataEntry
>
spawnedEntities
;
private
final
Set
<
SpawnDataEntry
>
deadSpawnedEntities
;
private
final
Set
<
SpawnDataEntry
>
deadSpawnedEntities
;
private
boolean
dontDestroyWhenEmpty
;
private
int
time
;
private
int
time
;
private
ClimateType
climate
;
private
ClimateType
climate
;
...
@@ -121,6 +122,14 @@ public class GenshinScene {
...
@@ -121,6 +122,14 @@ public class GenshinScene {
this
.
weather
=
weather
;
this
.
weather
=
weather
;
}
}
public
boolean
dontDestroyWhenEmpty
()
{
return
dontDestroyWhenEmpty
;
}
public
void
setDontDestroyWhenEmpty
(
boolean
dontDestroyWhenEmpty
)
{
this
.
dontDestroyWhenEmpty
=
dontDestroyWhenEmpty
;
}
public
Set
<
SpawnDataEntry
>
getSpawnedEntities
()
{
public
Set
<
SpawnDataEntry
>
getSpawnedEntities
()
{
return
spawnedEntities
;
return
spawnedEntities
;
}
}
...
@@ -166,7 +175,7 @@ public class GenshinScene {
...
@@ -166,7 +175,7 @@ public class GenshinScene {
}
}
// Deregister scene if not in use
// Deregister scene if not in use
if
(
this
.
getEntities
().
size
()
<=
0
)
{
if
(
this
.
getEntities
().
size
()
<=
0
&&
!
this
.
dontDestroyWhenEmpty
()
)
{
this
.
getWorld
().
deregisterScene
(
this
);
this
.
getWorld
().
deregisterScene
(
this
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/emu/grasscutter/game/World.java
+
16
−
6
View file @
02d2d728
...
@@ -212,19 +212,29 @@ public class World implements Iterable<GenshinPlayer> {
...
@@ -212,19 +212,29 @@ public class World implements Iterable<GenshinPlayer> {
return
false
;
return
false
;
}
}
Integer
oldScene
Id
=
null
;
GenshinScene
oldScene
=
null
;
if
(
player
.
getScene
()
!=
null
)
{
if
(
player
.
getScene
()
!=
null
)
{
oldSceneId
=
player
.
getScene
().
getId
();
oldScene
=
player
.
getScene
();
player
.
getScene
().
removePlayer
(
player
);
// Dont deregister scenes if the player is going to tp back into them
if
(
oldScene
.
getId
()
==
sceneId
)
{
oldScene
.
setDontDestroyWhenEmpty
(
true
);
}
}
GenshinScene
scene
=
this
.
getSceneById
(
sceneId
);
oldScene
.
removePlayer
(
player
);
scene
.
addPlayer
(
player
);
}
GenshinScene
newScene
=
this
.
getSceneById
(
sceneId
);
newScene
.
addPlayer
(
player
);
player
.
getPos
().
set
(
pos
);
player
.
getPos
().
set
(
pos
);
if
(
oldScene
!=
null
)
{
oldScene
.
setDontDestroyWhenEmpty
(
false
);
}
// Teleport packet
// Teleport packet
if
(
oldScene
Id
.
equals
(
s
cene
Id
)
)
{
if
(
oldScene
==
newS
cene
)
{
player
.
sendPacket
(
new
PacketPlayerEnterSceneNotify
(
player
,
EnterType
.
EnterGoto
,
EnterReason
.
TransPoint
,
sceneId
,
pos
));
player
.
sendPacket
(
new
PacketPlayerEnterSceneNotify
(
player
,
EnterType
.
EnterGoto
,
EnterReason
.
TransPoint
,
sceneId
,
pos
));
}
else
{
}
else
{
player
.
sendPacket
(
new
PacketPlayerEnterSceneNotify
(
player
,
EnterType
.
EnterJump
,
EnterReason
.
TransPoint
,
sceneId
,
pos
));
player
.
sendPacket
(
new
PacketPlayerEnterSceneNotify
(
player
,
EnterType
.
EnterJump
,
EnterReason
.
TransPoint
,
sceneId
,
pos
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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