isaacscript-common 6.2.0 → 6.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/functions/playerCenter.d.ts +5 -1
- package/functions/playerCenter.lua +16 -8
- package/index.d.ts +1 -0
- package/index.lua +8 -0
- package/package.json +1 -1
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Helper function to move all of the players to
|
|
2
|
+
* Helper function to move all of the players to where they would normally go when arriving at a new
|
|
3
|
+
* floor. (In normal mode, this is the center of the room. In Greed Mode, this is below the top
|
|
4
|
+
* door.)
|
|
5
|
+
*
|
|
6
|
+
* If there is more than one player, they will be distributed around the center in a circle.
|
|
3
7
|
*
|
|
4
8
|
* This function emulates what happens in the vanilla game when you travel to a new floor.
|
|
5
9
|
*/
|
|
@@ -17,25 +17,33 @@ function movePlayerAndTheirFamiliars(self, player, position)
|
|
|
17
17
|
familiar.Position = position
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
|
+
--- This is in the center of the room.
|
|
21
|
+
local NORMAL_MODE_NEW_FLOOR_STARTING_POSITION = Vector(320, 380)
|
|
22
|
+
--- This is near the top door.
|
|
23
|
+
local GREED_MODE_NEW_FLOOR_STARTING_POSITION = Vector(320, 280)
|
|
20
24
|
local CIRCLE_RADIUS_BETWEEN_PLAYERS = 50
|
|
21
|
-
--- Helper function to move all of the players to
|
|
25
|
+
--- Helper function to move all of the players to where they would normally go when arriving at a new
|
|
26
|
+
-- floor. (In normal mode, this is the center of the room. In Greed Mode, this is below the top
|
|
27
|
+
-- door.)
|
|
28
|
+
--
|
|
29
|
+
-- If there is more than one player, they will be distributed around the center in a circle.
|
|
22
30
|
--
|
|
23
31
|
-- This function emulates what happens in the vanilla game when you travel to a new floor.
|
|
24
32
|
function ____exports.movePlayersToCenter(self)
|
|
25
|
-
local
|
|
26
|
-
local
|
|
33
|
+
local isGreedMode = game:IsGreedMode()
|
|
34
|
+
local startingPosition = isGreedMode and GREED_MODE_NEW_FLOOR_STARTING_POSITION or NORMAL_MODE_NEW_FLOOR_STARTING_POSITION
|
|
27
35
|
local players = getPlayers(nil)
|
|
28
36
|
local firstPlayer = players[1]
|
|
29
37
|
if firstPlayer == nil then
|
|
30
38
|
return
|
|
31
39
|
end
|
|
32
40
|
if #players == 1 then
|
|
33
|
-
movePlayerAndTheirFamiliars(nil, firstPlayer,
|
|
41
|
+
movePlayerAndTheirFamiliars(nil, firstPlayer, startingPosition)
|
|
34
42
|
return
|
|
35
43
|
end
|
|
36
44
|
local circlePoints = getCircleDiscretizedPoints(
|
|
37
45
|
nil,
|
|
38
|
-
|
|
46
|
+
startingPosition,
|
|
39
47
|
CIRCLE_RADIUS_BETWEEN_PLAYERS,
|
|
40
48
|
#players,
|
|
41
49
|
1,
|
|
@@ -46,9 +54,9 @@ function ____exports.movePlayersToCenter(self)
|
|
|
46
54
|
local i = 0
|
|
47
55
|
while i < #players do
|
|
48
56
|
local player = players[i + 1]
|
|
49
|
-
local
|
|
50
|
-
if player ~= nil and
|
|
51
|
-
player.Position =
|
|
57
|
+
local circlePosition = circlePoints[i + 1]
|
|
58
|
+
if player ~= nil and circlePosition ~= nil then
|
|
59
|
+
player.Position = circlePosition
|
|
52
60
|
end
|
|
53
61
|
i = i + 1
|
|
54
62
|
end
|
package/index.d.ts
CHANGED
|
@@ -86,6 +86,7 @@ export * from "./functions/pickups";
|
|
|
86
86
|
export * from "./functions/pickupVariants";
|
|
87
87
|
export * from "./functions/pills";
|
|
88
88
|
export * from "./functions/player";
|
|
89
|
+
export * from "./functions/playerCenter";
|
|
89
90
|
export * from "./functions/playerDataStructures";
|
|
90
91
|
export * from "./functions/playerHealth";
|
|
91
92
|
export * from "./functions/playerIndex";
|
package/index.lua
CHANGED
|
@@ -685,6 +685,14 @@ do
|
|
|
685
685
|
end
|
|
686
686
|
end
|
|
687
687
|
end
|
|
688
|
+
do
|
|
689
|
+
local ____export = require("functions.playerCenter")
|
|
690
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
691
|
+
if ____exportKey ~= "default" then
|
|
692
|
+
____exports[____exportKey] = ____exportValue
|
|
693
|
+
end
|
|
694
|
+
end
|
|
695
|
+
end
|
|
688
696
|
do
|
|
689
697
|
local ____export = require("functions.playerDataStructures")
|
|
690
698
|
for ____exportKey, ____exportValue in pairs(____export) do
|