From a63c749f0417712d9a6d5c314a14c20d01e0a71c Mon Sep 17 00:00:00 2001
From: Christoph Oelckers <c.oelckers@users.noreply.github.com>
Date: Tue, 15 Nov 2016 13:39:41 +0100
Subject: [PATCH] - moved A_Light to Actor after finding some mods which used
 it badly. Besides, it should be fine to use this from PlayerPawns as well.

---
 src/g_strife/a_strifeweapons.cpp           | 17 -----------------
 src/p_pspr.cpp                             |  4 ++--
 wadsrc/static/zscript/actor.txt            |  6 ++++++
 wadsrc/static/zscript/shared/inventory.txt |  5 -----
 4 files changed, 8 insertions(+), 24 deletions(-)

diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp
index be8452046d..4dad52de4d 100644
--- a/src/g_strife/a_strifeweapons.cpp
+++ b/src/g_strife/a_strifeweapons.cpp
@@ -937,23 +937,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_SigilCharge)
 	return 0;
 }
 
-//============================================================================
-//
-// A_LightInverse
-//
-//============================================================================
-
-DEFINE_ACTION_FUNCTION(AActor, A_LightInverse)
-{
-	PARAM_ACTION_PROLOGUE(AActor);
-
-	if (self->player != NULL)
-	{
-		self->player->extralight = INT_MIN;
-	}
-	return 0;
-}
-
 //============================================================================
 //
 // A_FireSigil1
diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp
index 9ae7b530de..1bb0db9093 100644
--- a/src/p_pspr.cpp
+++ b/src/p_pspr.cpp
@@ -1415,9 +1415,9 @@ void P_GunShot (AActor *mo, bool accurate, PClassActor *pufftype, DAngle pitch)
 	P_LineAttack (mo, angle, PLAYERMISSILERANGE, pitch, damage, NAME_Hitscan, pufftype);
 }
 
-DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_Light)
+DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Light)
 {
-	PARAM_ACTION_PROLOGUE(AActor);
+	PARAM_SELF_PROLOGUE(AActor);
 	PARAM_INT(light);
 
 	if (self->player != NULL)
diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt
index 09b5683c83..8e8b2fdd88 100644
--- a/wadsrc/static/zscript/actor.txt
+++ b/wadsrc/static/zscript/actor.txt
@@ -77,6 +77,12 @@ class Actor : Thinker native
 	native Actor SpawnMissile(Actor dest, class<Actor> type, Actor owner = null);
 	native Actor SpawnMissileZ (double z, Actor dest, class<Actor> type);
 	native Actor SpawnMissileAngleZSpeed (double z, class<Actor> type, float angle, double vz, double speed, Actor owner = null, bool checkspawn = true);
+
+	native void A_Light(int extralight);
+	void A_Light0() { A_Light(0); }
+	void A_Light1() { A_Light(1); }
+	void A_Light2() { A_Light(2); }
+	void A_LightInverse() { A_Light(0x80000000); }
 	
 	native Actor OldSpawnMissile(Actor dest, class<Actor> type, Actor owner = null);
 	native Actor SpawnPuff(class<Actor> pufftype, vector3 pos, float hitdir, float particledir, int updown, int flags = 0, Actor vict = null);
diff --git a/wadsrc/static/zscript/shared/inventory.txt b/wadsrc/static/zscript/shared/inventory.txt
index a6d7af8353..377463adc1 100644
--- a/wadsrc/static/zscript/shared/inventory.txt
+++ b/wadsrc/static/zscript/shared/inventory.txt
@@ -46,11 +46,6 @@ class StateProvider : Inventory native
 	action native void A_FireBullets(float spread_xy, float spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", int flags = 1, float range = 0, class<Actor> missile = null, float Spawnheight = 32, float Spawnofs_xy = 0);
 	action native void A_FireCustomMissile(class<Actor> missiletype, float angle = 0, bool useammo = true, float spawnofs_xy = 0, float spawnheight = 0, int flags = 0, float pitch = 0);
 	action native void A_RailAttack(int damage, int spawnofs_xy = 0, bool useammo = true, color color1 = 0, color color2 = 0, int flags = 0, float maxdiff = 0, class<Actor> pufftype = "BulletPuff", float spread_xy = 0, float spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class<Actor> spawnclass = "none", float spawnofs_z = 0, int spiraloffset = 270, int limit = 0);
-	native action void A_Light(int extralight);
-	action void A_Light0() { A_Light(0); }
-	action void A_Light1() { A_Light(1); }
-	action void A_Light2() { A_Light(2); }
-	action native void A_LightInverse();
 	action native void A_WeaponReady(int flags = 0);
 	action native void A_Lower();
 	action native void A_Raise();