<commit_before>ENT.Type            = "anim"
ENT.Base            = "base_wire_entity"

ENT.PrintName       = "Wire Expression 2"
ENT.Author          = "Syranide"
ENT.Contact         = "<EMAIL>"
ENT.Purpose         = ""
ENT.Instructions    = ""

ENT.Spawnable       = false
ENT.AdminSpawnable  = false


include("core/e2lib.lua")
include("base/preprocessor.lua")
include("base/tokenizer.lua")
include("base/parser.lua")
include("base/compiler.lua")
include('core/init.lua')

/********************************** Player Disconnection **********************************/

-- This code converts the player variable to a string, which is then converted back if the player rejoins and tries to access their E2 again.
-- This fixes the bug that you have to respawn your E2 after rejoining.
-- It uses EntityRemoved because PlayerDisconnected doesn't catch all disconnects.
hook.Add("EntityRemoved","Wire_Expression2_Player_Disconnected",function(ent)
	if (ent and ent:IsPlayer()) then
		for k,v in ipairs( ents.FindByClass("gmod_wire_expression2") ) do
			if (v.player == ent) then
				v.player = ent:UniqueID()
			end
		end<commit_msg>[E2] Made E2 purposely crash itself when you disconnect. This is both to stop laggy E2s while its owner is gone and to prevent other owner-related errors before they happen.<commit_after>ENT.Type            = "anim"
ENT.Base            = "base_wire_entity"

ENT.PrintName       = "Wire Expression 2"
ENT.Author          = "Syranide"
ENT.Contact         = "<EMAIL>"
ENT.Purpose         = ""
ENT.Instructions    = ""

ENT.Spawnable       = false
ENT.AdminSpawnable  = false


include("core/e2lib.lua")
include("base/preprocessor.lua")
include("base/tokenizer.lua")
include("base/parser.lua")
include("base/compiler.lua")
include('core/init.lua')

/********************************** Player Disconnection **********************************/

-- This code converts the player variable to a string, which is then converted back if the player rejoins and tries to access their E2 again.
-- This fixes the bug that you have to respawn your E2 after rejoining.
-- It uses EntityRemoved because PlayerDisconnected doesn't catch all disconnects.
hook.Add("EntityRemoved","Wire_Expression2_Player_Disconnected",function(ent)
	if (ent and ent:IsPlayer()) then
		for k,v in ipairs( ents.FindByClass("gmod_wire_expression2") ) do
			if (v.player == ent) then
				if (SERVER) then v:Error("Owner disconnected.","Owner disconnected.") end
				v.player = ent:UniqueID()
			end
		end
{'fraction_non_alphanumeric': 0.15690208667736757, 'fraction_numerical': 0.006019261637239166, 'mean_word_length': 3.90748031496063, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6531567', 'n_tokens_mistral': 765, 'n_tokens_neox': 719, 'n_words': 221}