diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 3946816586..143bc6154b 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -5,15 +5,15 @@ body: - type: markdown attributes: value: | - If this is your first time opening an issue here, please read the [contributing guidelines](https://github.com/BEEmod/.github/blob/c865feea6f7f4bd9a65e8aaecac9c7731db9628f/contributing.md). + If this is your first time opening an issue here, please read the [contributing guidelines](https://github.com/BEEmod/.github/blob/master/contributing.md). Remember: - Do not open an issue if you are not using the latest BEEmod application and packages. - Make sure you're in the right place. Application issues should go in the [BEE2.4 repo](https://github.com/BEEmod/BEE2.4/). - Perform a search to make sure this issue hasn't already been reported. - - Do not use the issue tracker to ask questions. + - Please keep questions and general conversations to the Discussions tab or the Discord server, not the issue tracker. - Issues should not be combined, unless they are very closely related (e.g. two bugs with a specific item in a specific case). - - Make absolutely sure the issue is not UCP (User Created Packages) related + - Make absolutely sure the issue is not caused by a user-created package - type: input attributes: label: BEE2 Application Version @@ -26,22 +26,13 @@ body: description: Specify the version of BEE2.4 packages (ex. 4.40.0) validations: required: true -- type: dropdown +- type: input id: OS attributes: label: What operating system are you running on? - multiple: true - options: - - Windows 11 - - Windows 10 (64bit) - - Windows 10 (32bit) - - Windows 8 (64bit) - - Windows 8 (32bit) - - Windows 7 (64bit) - - Windows 7 (32bit) - - Mac - - Linux - - Other + description: If you are using Windows, please specify the version. If you are using Linux, please specify the distro and version. + validations: + required: true - type: textarea attributes: label: Description of the bug diff --git a/.github/ISSUE_TEMPLATE/build-error.yml b/.github/ISSUE_TEMPLATE/build-error.yml index 22a44055b7..d6772f7c8c 100644 --- a/.github/ISSUE_TEMPLATE/build-error.yml +++ b/.github/ISSUE_TEMPLATE/build-error.yml @@ -5,15 +5,15 @@ body: - type: markdown attributes: value: | - If this is your first time opening an issue here, please read the [contributing guidelines](https://github.com/BEEmod/.github/blob/c865feea6f7f4bd9a65e8aaecac9c7731db9628f/contributing.md). + If this is your first time opening an issue here, please read the [contributing guidelines](https://github.com/BEEmod/.github/blob/master/contributing.md). Remember: - Do not open an issue if you are not using the latest BEEmod application and packages. - Make sure you're in the right place. Application issues should go in the [BEE2.4 repo](https://github.com/BEEmod/BEE2.4/). - Perform a search to make sure this issue hasn't already been reported. - - Do not use the issue tracker to ask questions. + - Please keep questions and general conversations to the Discussions tab or the Discord server, not the issue tracker. - Issues should not be combined, unless they are very closely related (e.g. two bugs with a specific item in a specific case). - - Make absolutely sure the issue is not UCP (User Created Packages) related + - Make absolutely sure the issue is not caused by a user-created package - type: input attributes: label: BEE2 Application Version @@ -26,22 +26,13 @@ body: description: Specify the version of BEE2.4 packages (ex. 4.40.0) validations: required: true -- type: dropdown +- type: input id: OS attributes: label: What operating system are you running on? - multiple: true - options: - - Windows 11 - - Windows 10 (64bit) - - Windows 10 (32bit) - - Windows 8 (64bit) - - Windows 8 (32bit) - - Windows 7 (64bit) - - Windows 7 (32bit) - - Mac - - Linux - - Other + description: If you are using Windows, please specify the version. If you are using Linux, please specify the distro and version. + validations: + required: true - type: textarea id: logs attributes: diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml index f66cc26160..6115935508 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.yml +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -5,18 +5,17 @@ body: - type: markdown attributes: value: | - ### This is not for new item suggestions! - We are not currently taking new item suggestions. + If this is your first time opening an issue here, please read the [contributing guidelines](https://github.com/BEEmod/.github/blob/master/contributing.md). - If this is your first time opening an issue here, please read the [contributing guidelines](https://github.com/BEEmod/.github/blob/c865feea6f7f4bd9a65e8aaecac9c7731db9628f/contributing.md). + Additionally, please check the [frequently rejected suggestions](https://github.com/BEEmod/.github/blob/master/rejected_suggestions.md) page to make sure your suggestion hasn't already been made and rejected before. Remember: - Do not open an issue if you are not using the latest BEEmod application and packages. - Make sure you're in the right place. Aapplication issues should go in the [BEE2.4 repo](https://github.com/BEEmod/BEE2.4/). - Perform a search to make sure this issue hasn't already been reported. - - Do not use the issue tracker to ask questions. + - Please keep questions and general conversations to the Discussions tab or the Discord server, not the issue tracker. - Issues should not be combined, unless they are very closely related (e.g. two bugs with a specific item in a specific case). - - Make absolutely sure the issue is not UCP (User Created Packages) related + - Make absolutely sure the issue is not caused by a user-created package - type: textarea attributes: label: Description of the feature diff --git a/packages/core/resources/scripts/vscripts/BEE2/portal_man.nut b/packages/core/resources/scripts/vscripts/BEE2/portal_man.nut index b5221892c6..5a8f89bdc3 100644 --- a/packages/core/resources/scripts/vscripts/BEE2/portal_man.nut +++ b/packages/core/resources/scripts/vscripts/BEE2/portal_man.nut @@ -7,6 +7,35 @@ has_pgun <- true; start_pos <- self.GetOrigin(); +PlayerTeam <- { + CHELL = 0, + PBODY = 2, + ATLAS = 3, +} + +class PortalGun { + primary = true + secondary = true + constructor(p,s) { + primary = p + secondary = s + } + + //Applies this portal gun to an actual portal gun's keyvalues + function apply(pgun) { + pgun.__KeyValueFromInt("CanFirePortal1",primary.tointeger()); + pgun.__KeyValueFromInt("CanFirePortal2",secondary.tointeger()); + } +} + +pgun_atlas_active <- PortalGun(true,true); +pgun_pbody_active <- PortalGun(true,true); + +bluegun <- null; +orangun <- null; +player_blue <- null; +player_oran <- null; + // Takes the gun off you. stripper <- null; // Detects cubes held by the player. @@ -33,9 +62,47 @@ function OnPostSpawn() { if (stripper != null) { return } stripper = Entities.FindByName(null, "__pgun_weapon_strip"); held_trig = Entities.FindByName(null, "__pgun_held_trig"); - if(IsMultiplayer()) { + /* //2.5 second delay does not work when playing with another player + if(IsMultiplayer()) { // Wait enough for it to spawn. EntFireByHandle(self, "CallScriptFunction", "_find_players", 2.5, self, self); + }*/ +} + +function in_hover_phase() {//When playing coop, there is a phase in which the players are frozen. This function calls itself until it is over + if ((spawn_pos-player_blue.GetOrigin()).LengthSqr() == 0) {//Still in hover phase + EntFireByHandle(self,"CallScriptFunction","in_hover_phase",0.01,null,null); + } else { + //Get and set pguns + EntFireByHandle(self,"CallScriptFunction","on_blue_spawn",0.05,null,null); + EntFireByHandle(self,"CallScriptFunction","on_oran_spawn",0.05,null,null); + //Building the map for the first time resets the pguns + EntFireByHandle(self,"CallScriptFunction","on_blue_spawn",0.5,null,null); + EntFireByHandle(self,"CallScriptFunction","on_oran_spawn",0.5,null,null); + } +} + +function waitForBlueRespawn() { + if (player_blue.GetHealth() == 0) { + EntFireByHandle(self,"CallScriptFunction","waitForBlueRespawn",0.01,null,null); + } else { + on_blue_spawn(); + } +} + +function waitForOrangeRespawn() { + if (player_oran.GetHealth() == 0) { + EntFireByHandle(self,"CallScriptFunction","waitForOrangeRespawn",0.01,null,null); + } else { + on_oran_spawn(); + } +} + +function on_death(player, dmgtype) {//Registered as callback function for @glados's BotDeath + if (player == 2) {//Blue + EntFireByHandle(self,"CallScriptFunction","waitForBlueRespawn",0.01,null,null); + } else {//Orange + EntFireByHandle(self,"CallScriptFunction","waitForOrangeRespawn",0.01,null,null); } } @@ -43,27 +110,65 @@ function _find_players() { // Grab the two coop players, which we know are in this order. player_blue <- Entities.FindByClassname(null, "player"); player_oran <- Entities.FindByClassname(player_blue, "player"); + ::BEE_CoopRegisterDeath(on_death.bindenv(this));//Respawns reset the portal gun, so detect deaths and wait for respawn + spawn_pos <- player_blue.GetOrigin();// + in_hover_phase();//Spawn phase that is of unpredictable time in which the portal guns keep getting replaced +} + +function on_blue_spawn() {//Called when the blue player spawns/respawns + bluegun <- Entities.FindByClassnameNearest("weapon_portalgun",player_blue.GetOrigin(),64); + set_gun(pgun_atlas_active,PlayerTeam.ATLAS); +} + +function on_oran_spawn() {//Called when the orange player spawns/respawns + orangun <- Entities.FindByClassnameNearest("weapon_portalgun",player_oran.GetOrigin(),64); + set_gun(pgun_pbody_active,PlayerTeam.PBODY); +} + +function waitForPlayers() {//Waits for both players to exist before finding the players + if (Entities.FindByName(null,"!player_orange") == null) { + } else if (Entities.FindByName(null,"!player_blue") == null) { + } else { + _find_players(); + return; + } + EntFireByHandle(self,"CallScriptFunction","waitForPlayers",0.01,self,self); } // Called OnMapSpawn by the compiler, passing in this config values. // We then appropriately remove/give the gun to the player. -// In Coop, never called. +// In Coop, still called. init_called <- false function init(blue, orange, has_onoff) { - if (IsMultiplayer() || init_called) { + if (init_called) { return; } init_called = true has_blue = blue has_oran = orange + + if (IsMultiplayer()) {//We need to get the player handles + EntFireByHandle(self,"CallScriptFunction","waitForPlayers",0.02,null,null); + } + if (has_onoff) { - portalgun_onoff_count = 0 - give_gun(0, 0) + portalgun_onoff_count = 0; + pgun_atlas_active <- PortalGun(false,false); + pgun_pbody_active <- PortalGun(false,false); + if (IsMultiplayer()) { return; } + give_gun(0, 0); } else if (!has_blue && !has_oran) { - remove_pgun() + remove_pgun(); + pgun_atlas_active <- PortalGun(false,false); + pgun_pbody_active <- PortalGun(false,false); + if (IsMultiplayer()) { return; } + give_gun(0, 0); } else { - give_gun(blue, orange) + pgun_atlas_active <- PortalGun(has_blue,has_oran); + pgun_pbody_active <- PortalGun(has_blue,has_oran); + if (IsMultiplayer()) { return; } + give_gun(blue, orange); } } @@ -100,6 +205,7 @@ function upgrade(blue, orange) { // Public: Remove the player's gun. function remove_pgun() { + // Take the gun off the player if (!has_pgun || IsMultiplayer()) { return; } EntFireByHandle(stripper, "Enable", "", 0.0, self, self); EntFireByHandle(stripper, "Disable", "", 0.1, self, self); @@ -108,10 +214,13 @@ function remove_pgun() { // Public: Give the player their gun back with the same settings. function return_pgun() { - give_gun(has_blue, has_oran); + if (IsMultiplayer()) { + set_gun(pgun_atlas_active, PlayerTeam.ATLAS); + set_gun(pgun_pbody_active, PlayerTeam.PBODY); + } + else give_gun(has_blue, has_oran); } - // Public: Give the player a gun with the specified colours, or replace an existing one. function give_gun(blue, oran) { if (IsMultiplayer()) { @@ -131,16 +240,33 @@ function give_gun(blue, oran) { _held_object = null; if (has_pgun) { - remove_pgun() + remove_pgun(); } EntFireByHandle(held_trig, "Enable", "", 0.0, self, self); EntFireByHandle(held_trig, "Disable", "", 0.1, self, self); EntFireByHandle(self, "ForceSpawn", "", 0.1, self, self); + } +function set_gun(pgun, team) { + if (team == PlayerTeam.ATLAS) { + if (bluegun != null && bluegun.IsValid()) {//If not, assuming nothing has gone wrong, the player is dead or hasn't had their spawn/join code run yet and will spawn with it + pgun.apply(bluegun); + } + pgun_atlas_active <- pgun; + } + if (team == PlayerTeam.PBODY) { + if (orangun != null && orangun.IsValid()) {//If not, assuming nothing has gone wrong, the player is dead or hasn't had their spawn/join code run yet and will spawn with it + pgun.apply(orangun); + } + pgun_pbody_active <- pgun; + } +} + // Public: Increment the number of Portalgun on/off buttons being pressed. -function pgun_btn_act() { +function pgun_btn_act() { + // Are we disabled? if (portalgun_onoff_count == -1) { return} @@ -148,20 +274,29 @@ function pgun_btn_act() { if (portalgun_onoff_count == 1) { // Didn't have a gun, give them one. + pgun_atlas_active <- PortalGun(has_blue,has_oran); + pgun_pbody_active <- PortalGun(has_blue,has_oran); return_pgun(); } } // Public: Decrement the number of Portalgun on/off buttons being pressed. -function pgun_btn_deact() { +function pgun_btn_deact() { + // Are we disabled? if (portalgun_onoff_count == -1) { return} portalgun_onoff_count = portalgun_onoff_count - 1; if (portalgun_onoff_count == 0) { + pgun_atlas_active <- PortalGun(false,false); + pgun_pbody_active <- PortalGun(false,false); // Replace the gun with a no-portal gun. - give_gun(0, 0); + if (IsMultiplayer()) { + set_gun(PortalGun(false,false), PlayerTeam.ATLAS); + set_gun(PortalGun(false,false), PlayerTeam.PBODY); + } + else give_gun(0, 0); } } @@ -189,7 +324,11 @@ function map_won() { return; } if (portalgun_onoff_count > 0) { - give_gun(0, 0); + if (IsMultiplayer()) { + set_gun(PortalGun(false,false), PlayerTeam.ATLAS); + set_gun(PortalGun(false,false), PlayerTeam.PBODY); + } + else give_gun(0, 0); } portalgun_onoff_count = -1; } @@ -226,7 +365,6 @@ function get_portal_pairs() { } return results; } - function portal_active_ent(portal) { return portal_active(portal.GetScriptScope()); } @@ -314,9 +452,7 @@ function _on_spawn() { } _spawn_scheduled = false; - gun.__KeyValueFromInt("CanFirePortal1", _next_blue.tointeger()) - gun.__KeyValueFromInt("CanFirePortal2", _next_oran.tointeger()) - gun.__KeyValueFromInt("Rendermode", 10) // Don't let the player see it onscreen! + set_pgun_keys(gun); _next_blue = _next_oran = null; // TP to player. @@ -331,7 +467,12 @@ function _on_spawn() { } _held_object = null; } -self.ConnectOutput("OnEntitySpawned", "_on_spawn") + +function set_pgun_keys(gun) { + gun.__KeyValueFromInt("CanFirePortal1", _next_blue.tointeger()) + gun.__KeyValueFromInt("CanFirePortal2", _next_oran.tointeger()) + gun.__KeyValueFromInt("Rendermode", 10) // Don't let the player see it onscreen! +} // These are triggered by map-global portal detectors, to let us detect open/closed // portals. This avoids RunScriptCode compiles each time. @@ -364,7 +505,7 @@ function _on_open(port_id, is_oran) { func(portal); } } - + function _on_close(port_id) { local portal = activator; if (GetDeveloperLevel() > 0) { @@ -376,3 +517,4 @@ function _on_close(port_id) { func(portal); } } +self.ConnectOutput("OnEntitySpawned", "_on_spawn") \ No newline at end of file