[MOD][WIP] Tunnel Remover v0.1.0

Place for sharing your game modifications for Life is Feudal: Your Own
User avatar
Chessmaster42
 
Posts: 23
Joined: 30 Sep 2014, 22:05

[MOD][WIP] Tunnel Remover v0.1.0

Post by Chessmaster42 » 29 Oct 2014, 17:48

Moving this out into its own thread but here is the tunnel remover mod. This does require a server restart after the admin is done cleaning up tunnels but I'm hoping that in a future version I can remove that need.

To activate this a GM must drop an item of "Gods Favor" (ID 1062) onto the ground into a new dropped items bag. That tunnel will then get filled in on the next server restart.

Code: Select all
CREATE DEFINER=`root`@`localhost` PROCEDURE `p_deleteTunnel`(IN `geoDataID` INT, IN `altitude` INT)
   LANGUAGE SQL
   NOT DETERMINISTIC
   MODIFIES SQL DATA
   SQL SECURITY DEFINER
   COMMENT 'Experimental procedure to undo tunnels in terrain'
BEGIN
   IF true THEN
      UPDATE geo_patch gp SET gp.IsServerOnly = 1 WHERE gp.GeoDataID = geoDataID AND gp.IsServerOnly = 0;
     
      SET @terID = 0;
      SET @newAltitude = 0;
      SELECT gp.TerID, gp.Altitude FROM geo_patch gp WHERE gp.GeoDataID = geoDataID AND ChangeIndex = 1 GROUP BY Altitude LIMIT 1 INTO @terID, @newAltitude;
     
      IF altitude > 0 THEN
         SET @newAltitude = altitude;
      END IF;
     
      SET @result = f_addGeoPatch(1, 0, @terID, 1, geoDataID, @newAltitude, 3, 128, 60000, 42);
   END IF;
END

CREATE DEFINER=`root`@`localhost` TRIGGER `t_adminUndoTunnel` AFTER UPDATE ON `items` FOR EACH ROW BEGIN
   IF NEW.ObjectTypeID = 1062 THEN
      SET @ownerID = (SELECT OwnerID FROM movable_objects mo JOIN containers con ON con.ID = mo.RootContainerID WHERE con.ID = NEW.ContainerID);
     
      SET @location = (SELECT GeoID FROM `character` WHERE ID = @ownerID);
      SET @altitude = (SELECT GeoAlt FROM `character` WHERE ID = @ownerID);
      SET @tunnelCount = (SELECT COUNT(*) FROM geo_patch gp WHERE gp.GeoDataID = @location AND gp.Substance = 0 AND gp.LevelFlags & 1 = 0);
      IF @tunnelCount > 0 THEN
         CALL p_deleteTunnel(@location, 0);
      END IF;
   END IF;
END


Known Issues:
- Server restart is required
- Terraforming will not work at all until server restart is completed


Woutan
Zealous Believer
 
Posts: 6
Joined: 26 Oct 2014, 16:40

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Woutan » 02 Nov 2014, 11:44

Where do you have to insert it?
Image

User avatar
Vamyan
 
Posts: 198
Joined: 23 Oct 2014, 22:29

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Vamyan » 02 Nov 2014, 18:43

Woutan wrote:Where do you have to insert it?

Easiest is in a .sql file and execute that.


Trommler
 
Posts: 2
Joined: 28 Oct 2014, 01:00

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Trommler » 03 Nov 2014, 18:16

Could you explain how to do it step by step?
Sorry, but i am to stupid for that :sorry: :sorry:

User avatar
Desiderius
 
Posts: 30
Joined: 07 Oct 2014, 17:50
Location: Germany

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Desiderius » 04 Nov 2014, 14:37

A Quick question:

To activate this a GM must drop an item of "Gods Favor" (ID 1062) onto the ground into a new dropped items bag. That tunnel will then get filled in on the next server restart.


Do you have to place this bag only at the tunnel entrance ? Or in each diggend field of the tunnel ?

And there are some admin that have this already tested it on active Servers ?

Greetings
Jack


Trommler
 
Posts: 2
Joined: 28 Oct 2014, 01:00

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Trommler » 04 Nov 2014, 17:40

We testet it in million ways with some guys who have much more experience then me.
We didnt found out how to do it....

User avatar
Sali666
 
Posts: 4
Joined: 06 Oct 2014, 16:25

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Sali666 » 07 Nov 2014, 12:51

first of all thanks for the work so far. looking for the next version.

if you insert this to the database, note that it have two parts. insert it seperated with Heidi.

---

this MOD closed 1 out of 6 tunnels. 3 tunnels where on flattened ground an digged by a fault. 3 where on/under sealevel. dont know why only 1 tunnel was closed. :sorry:
www . lgmc . de - -=[LGMC]=- Lan, Games and more Community


Ceshun
 
Posts: 1
Joined: 25 Oct 2014, 11:23

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Ceshun » 08 Nov 2014, 15:40

Try n stand on the tunnel for 1min so the DB would update your pos for sure n drop the item then see if it works?


Shmee_
 
Posts: 2
Joined: 07 Nov 2014, 23:16

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Shmee_ » 09 Nov 2014, 03:25

Anyone having problems running this query in Heidisql
Try this modified version. The delimiter needed to be set for me. I ran both queries separate

Code: Select all
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `p_deleteTunnel`(IN `geoDataID` INT, IN `altitude` INT)
   LANGUAGE SQL
   NOT DETERMINISTIC
   MODIFIES SQL DATA
   SQL SECURITY DEFINER
   COMMENT 'Experimental procedure to undo tunnels in terrain'
BEGIN
   IF true THEN
      UPDATE geo_patch gp SET gp.IsServerOnly = 1 WHERE gp.GeoDataID = geoDataID AND gp.IsServerOnly = 0;
     
      SET @terID = 0;
      SET @newAltitude = 0;
      SELECT gp.TerID, gp.Altitude FROM geo_patch gp WHERE gp.GeoDataID = geoDataID AND ChangeIndex = 1 GROUP BY Altitude LIMIT 1 INTO @terID, @newAltitude;
     
      IF altitude > 0 THEN
         SET @newAltitude = altitude;
      END IF;
     
      SET @result = f_addGeoPatch(1, 0, @terID, 1, geoDataID, @newAltitude, 3, 128, 60000, 42);
   END IF;
END $$


Code: Select all
DELIMITER $$
CREATE DEFINER=`root`@`localhost` TRIGGER `t_adminUndoTunnel` AFTER UPDATE ON `items` FOR EACH ROW BEGIN
   IF NEW.ObjectTypeID = 1062 THEN
      SET @ownerID = (SELECT OwnerID FROM movable_objects mo JOIN containers con ON con.ID = mo.RootContainerID WHERE con.ID = NEW.ContainerID);
     
      SET @location = (SELECT GeoID FROM `character` WHERE ID = @ownerID);
      SET @altitude = (SELECT GeoAlt FROM `character` WHERE ID = @ownerID);
      SET @tunnelCount = (SELECT COUNT(*) FROM geo_patch gp WHERE gp.GeoDataID = @location AND gp.Substance = 0 AND gp.LevelFlags & 1 = 0);
      IF @tunnelCount > 0 THEN
         CALL p_deleteTunnel(@location, 0);
      END IF;
   END IF;
END $$


Shynx
 
Posts: 24
Joined: 29 Oct 2014, 09:49

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Shynx » 09 Nov 2014, 15:33

hey, thanks for your work!

just a couple suggestions for the next version:
any way to determine what terrain type was on the tunnel tile? right now it always fills up with stone. after modifying it by hand to fill with dirt instead, i was unable to raise or lower the ground level. i got dirt in my inventory, but the level always stayed the same.

modify it so it fills up to the last known ground level instead of the original one. i.e. if a tile is 5.0 originally and i lower it to 4.0, when i dig a tunnel and fill that in, it defaults back to 5.0 - at least thats what i think it does. especially when paired with the first issue, thats a problem.

all of this is especially relevant for fixing tunnel entrances, which is like the main reason i need it :sorry:


Ikabob
 
Posts: 1
Joined: 09 Nov 2014, 14:04

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Ikabob » 09 Nov 2014, 15:58

to do this at BlackBox Servers you need Super Rights... if anyone know how to get that to get this run please let me know..

* SQL Error (1227): Access denied; you need (at least one of) the SUPER privilege(s) for this operation */


Also you need the delimiter to even try for it to run other wise it Errors out

User avatar
Vamyan
 
Posts: 198
Joined: 23 Oct 2014, 22:29

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Vamyan » 12 Nov 2014, 22:19

This procedure makes a bit more sense, and will fill with 1000 units of the original substance instead of 60000 units of rock, AND should preserve the original quality.

Code: Select all
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `p_deleteTunnel`(IN `geoDataID` INT, IN `altitude` INT)
   LANGUAGE SQL
   NOT DETERMINISTIC
   MODIFIES SQL DATA
   SQL SECURITY DEFINER
   COMMENT 'Experimental procedure to undo tunnels in terrain'
BEGIN
   IF true THEN
      UPDATE geo_patch gp SET gp.IsServerOnly = 1 WHERE gp.GeoDataID = geoDataID AND gp.IsServerOnly = 0;
     
      SET @terID = 0;
      SET @newAltitude = 0;
      SET @newSubstance = 0;
      SET @newQuality = 0;
      SELECT gp.TerID, gp.Altitude, gp.Substance, gp.Quality FROM geo_patch gp WHERE gp.GeoDataID = geoDataID AND ChangeIndex = 1 GROUP BY Altitude LIMIT 1 INTO @terID, @newAltitude, @newSubstance, @newQuality;
     
      IF altitude > 0 THEN
         SET @newAltitude = altitude;
      END IF;
     
      SET @result = f_addGeoPatch(1, 0, @terID, 1, geoDataID, @newAltitude, @newSubstance, 128, 1000, @newQuality);
   END IF;
END $$


Thoron
 
Posts: 2
Joined: 04 Nov 2014, 22:21

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Thoron » 13 Nov 2014, 23:10

Vamyan wrote:This procedure makes a bit more sense, and will fill with 1000 units of the original substance instead of 60000 units of rock, AND should preserve the original quality.

Code: Select all
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `p_deleteTunnel`(IN `geoDataID` INT, IN `altitude` INT)
   LANGUAGE SQL
   NOT DETERMINISTIC
   MODIFIES SQL DATA
   SQL SECURITY DEFINER
   COMMENT 'Experimental procedure to undo tunnels in terrain'
BEGIN
   IF true THEN
      UPDATE geo_patch gp SET gp.IsServerOnly = 1 WHERE gp.GeoDataID = geoDataID AND gp.IsServerOnly = 0;
     
      SET @terID = 0;
      SET @newAltitude = 0;
      SET @newSubstance = 0;
      SET @newQuality = 0;
      SELECT gp.TerID, gp.Altitude, gp.Substance, gp.Quality FROM geo_patch gp WHERE gp.GeoDataID = geoDataID AND ChangeIndex = 1 GROUP BY Altitude LIMIT 1 INTO @terID, @newAltitude, @newSubstance, @newQuality;
     
      IF altitude > 0 THEN
         SET @newAltitude = altitude;
      END IF;
     
      SET @result = f_addGeoPatch(1, 0, @terID, 1, geoDataID, @newAltitude, @newSubstance, 128, 1000, @newQuality);
   END IF;
END $$


Tested?


Eve
 
Posts: 25
Joined: 06 Oct 2014, 09:50

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Eve » 14 Nov 2014, 00:16

Why is it that something this simple can't be added to the GM commands by the devs? Even as a temporary fix, it would be nice...

I am tired of people saying it will so much time away from current bug fixing etc... The tunnel problem should be one the most high priority fixes that.

User avatar
Vamyan
 
Posts: 198
Joined: 23 Oct 2014, 22:29

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Vamyan » 14 Nov 2014, 00:21

Just tested the following code, which also eliminates the need for waiting 60 seconds prior to dropping the item by using the container's location instead of owner's.

Code: Select all
DELIMITER //
CREATE DEFINER=`root`@`localhost` TRIGGER `t_adminUndoTunnel` AFTER UPDATE ON `items` FOR EACH ROW BEGIN
   IF NEW.ObjectTypeID = 1062 THEN
      SELECT mo.GeoDataID,mo.Altitude,mo.RootContainerID FROM movable_objects mo JOIN items it ON it.ContainerID = mo.RootContainerID WHERE it.ID = NEW.ID INTO @location, @altitude, @container;
      SET @tunnelCount = (SELECT COUNT(*) FROM geo_patch gp WHERE gp.GeoDataID = @location AND gp.Substance = 0 AND gp.LevelFlags & 1 = 0);
      IF @tunnelCount > 0 THEN
         CALL p_deleteTunnel(@location, 0);
      END IF;
      /*
      SET @result = f_deleteItem(NEW.ID);
      SET @result = f_deleteContainer(@container);
      */
   END IF;
END//

CREATE DEFINER=`root`@`localhost` PROCEDURE `p_deleteTunnel`(IN `geoDataID` INT, IN `altitude` INT)
   LANGUAGE SQL
   DETERMINISTIC
   MODIFIES SQL DATA
   SQL SECURITY DEFINER
   COMMENT 'Experimental procedure to undo tunnels in terrain'
BEGIN
   IF true THEN
      UPDATE geo_patch gp SET gp.IsServerOnly = 1 WHERE gp.GeoDataID = geoDataID AND gp.IsServerOnly = 0;
     
      SET @terID = 0;
      SET @newAltitude = 0;
      SET @newSubstance = 0;
      SET @newQuality = 0;
      SELECT gp.TerID, gp.Altitude, gp.Substance, gp.Quality FROM geo_patch gp WHERE gp.GeoDataID = geoDataID AND ChangeIndex = 1 GROUP BY Altitude LIMIT 1 INTO @terID, @newAltitude, @newSubstance, @newQuality;
     
      IF altitude > 0 THEN
         SET @newAltitude = altitude;
      END IF;
     
      SET @result = f_addGeoPatch(1, 0, @terID, 1, geoDataID, @newAltitude, @newSubstance, 128, 1000, @newQuality);
   END IF;
END//

User avatar
Vamyan
 
Posts: 198
Joined: 23 Oct 2014, 22:29

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Vamyan » 14 Nov 2014, 01:29

Actually, the code is still somewhat flawed... it'll fill the tunnel fine, but it won't fix the red-bordered terrain block for the tunnel or all surrounding blocks.

I'm thinking it may have something to do with level flags, but I don't have any solid leads on that yet.


Fluffypinkbunny
 
Posts: 43
Joined: 05 Oct 2014, 15:44

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Fluffypinkbunny » 16 Nov 2014, 03:32

With bags being removed, due to decay, isn't this now needing to be reworked?

User avatar
Vamyan
 
Posts: 198
Joined: 23 Oct 2014, 22:29

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Vamyan » 16 Nov 2014, 04:29

No, because the tunnel removal code works when the bag is created, and doesn't depend on the bag existing long term.


Thoron
 
Posts: 2
Joined: 04 Nov 2014, 22:21

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Thoron » 17 Nov 2014, 18:18

It didn't work satisfactorily.

The tunnel is optical removed, but I still fall into the hole.


Dersuchti
 
Posts: 2
Joined: 19 Nov 2014, 16:07

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Dersuchti » 23 Nov 2014, 15:02

hello every one i got the acces denied error every time.
Server its from Nitrado and i need realy help i hope for help from your side.

Steam id dersuchti1005


Wolfpack
 
Posts: 4
Joined: 18 Oct 2014, 03:45

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Wolfpack » 16 Dec 2014, 18:05

If you not doing this on a local server you need to remove x2 DEFINER=`root`@`localhost`


Woutan
Zealous Believer
 
Posts: 6
Joined: 26 Oct 2014, 16:40

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Woutan » 29 Dec 2014, 14:47

I've finally done it, but is it just an optical delete.
or am I doing something wrong, because the tunnel're physically still there.
Image

User avatar
Gorgo
 
Posts: 22
Joined: 05 Nov 2014, 10:16

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Gorgo » 08 Jan 2015, 15:20

yes it's an optical delete... this solution is not really a solution :(
Image


HydroxTV
Beta Tester
 
Posts: 84
Joined: 10 Oct 2014, 15:27

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by HydroxTV » 19 Jan 2015, 09:38

nvm!

human stupidity :D


Nomaken
 
Posts: 3
Joined: 29 Jan 2015, 22:39

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Nomaken » 07 Feb 2015, 23:25

How do i put this mod in my files? Do i create a new sql file of some random name and put it in with the server new and patch sql files? Or do i add it to the end of one of the existing sql files?


Skootah
 
Posts: 5
Joined: 04 Mar 2015, 00:40

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Skootah » 09 Mar 2015, 03:58

Any further information on this?

I also am getting the "need SUPER privileges" error.

And was it fixed to be more than just an optical delete?


Alandro
 
Posts: 3
Joined: 18 Apr 2015, 17:00

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Alandro » 02 May 2015, 05:15

Where do you have to insert it?

Step by step please.

I create a a.sql
I load with Navicat into Lif_1
And unsuccesful

How please


Rezalt
 
Posts: 1
Joined: 27 Dec 2014, 17:24

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Rezalt » 03 May 2015, 09:03

I use MariaDB / HeidiSQL and have not been able to get it to work.
I get an error saying "MariaDB doesn't support multiple triggers with the same action time and event for one table".

Do any of you know what I am doing wrong, or are you using another program?


Zhalls
Alpha Tester
 
Posts: 89
Joined: 14 Mar 2014, 19:30

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Zhalls » 17 Jun 2015, 05:46

Just to make sure I understand what this script is purporting-- this doesn't actually remove a tunnel, it just makes it look like its filled in, but your character can still walk in and/or through said tunnel, despite the ground level appearing as if its just ground?


Dyfan
 
Posts: 2
Joined: 25 Sep 2015, 11:53

Re: [MOD][WIP] Tunnel Remover v0.1.0

Post by Dyfan » 12 Oct 2015, 18:12

Hey! I am currently looking for a tunnel script but was told by a friend that the previous tunnel script existing doesn't work anymore, after the latest patch. Can someone confirm this? I have no experience in scripting so a reply from the OP would be most appriciated.

If it's not working, what needs to be changed?

Return to Game mods