Instabuild

Is this a good idea?

  • Yess

    Votes: 0 0.0%
  • No

    Votes: 0 0.0%

  • Total voters
    0
  • Poll closed .
Status
Not open for further replies.

Jakkee

Plugin Developer
Plugin Developer
Contributor
Jul 28, 2014
1,465
925
113
Australia
Python:
def On_BuildingComplete(self, BuildingPart):
        if not Plugin.IniExists("Log"):
            Plugin.CreateIni("Log")
            ini = Plugin.GetIni("Log")
            ini.Save()
        ini = Plugin.GetIni("Log")
        location = str(BuildingPart.Location)
        playerid = Server.FindPlayer(BuildingEvent.Builder).SteamID.ToString()
        ini.AddSetting(playerid, BuildingEvent.BlockName, location)
        ini.Save()
 

coersum

Plugin Developer
Plugin Developer
Oct 9, 2014
77
5
8
47
Parts Unknown
I had started something like that, but I thought DataStore handled big database like that better than ini's ?

Also I have not tested:
Python:
Server.FindPlayer(BuildingEvent.BuildingPart.OwnerName).SteamID.ToString()
but since OwnerName and OwnerID didn't return anything (unless it's a conversion problem), my way of going by it was to log a GameID + BuildingPart.Location in DataStore like so:

Python:
def On_BuildingUpdate(self, be):
        builder = be.Builder.Name
        if be.BuildingPart.Health == 0: #the first hit with hammer, the BP has 0 health
            bpLoc = be.BuildingPart.Location
            DataStore.Add("bPart_Data", builder.GameID, bpLoc)
            Server.Broadcast("On_BuildingUpdate ADDED" + str(be.BuildingPart.Health) + " by " + builder)
Then later:

Python:
def On_BuildingPartAttacked(self, bhe):
        if DataStore.ContainsValue("nPart_Data", bhe.Victim.Location)
You get your build GameID and can compare it to the person hitting it.

Problem is till the frame reaches lvl1, it can decay and we would still have the entry in the DataStore, so finding a way to detect level 1, THEN saving the BP in the DataStore would be better.
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,065
4,486
113
At your house.
github.com
I had started something like that, but I thought DataStore handled big database like that better than ini's ?

Also I have not tested:
Python:
Server.FindPlayer(BuildingEvent.BuildingPart.OwnerName).SteamID.ToString()
but since OwnerName and OwnerID didn't return anything (unless it's a conversion problem), my way of going by it was to log a GameID + BuildingPart.Location in DataStore like so:

Python:
def On_BuildingUpdate(self, be):
        builder = be.Builder.Name
        if be.BuildingPart.Health == 0:
            bpLoc = be.BuildingPart.Location
            DataStore.Add("bPart_Data", builder.GameID, bpLoc)
            Server.Broadcast("On_BuildingUpdate ADDED" + str(be.BuildingPart.Health) + " by " + builder)
Then later:

Python:
def On_BuildingPartAttacked(self, bhe):
        if DataStore.ContainsValue("nPart_Data", bhe.Victim.Location)
You get your build GameID and can compare it to the person hitting it.
Victim's location wont be equal with the building part's.

Sent from my Samsung Galaxy S4
 

balu92

Moderator
Moderator
Jul 11, 2014
338
75
28
33
I had started something like that, but I thought DataStore handled big database like that better than ini's ?

Also I have not tested:
Python:
Server.FindPlayer(BuildingEvent.BuildingPart.OwnerName).SteamID.ToString()
but since OwnerName and OwnerID didn't return anything (unless it's a conversion problem), my way of going by it was to log a GameID + BuildingPart.Location in DataStore like so:

Python:
def On_BuildingUpdate(self, be):
        builder = be.Builder.Name
        if be.BuildingPart.Health == 0: #the first hit with hammer, the BP has 0 health
            bpLoc = be.BuildingPart.Location
            DataStore.Add("bPart_Data", builder.GameID, bpLoc)
            Server.Broadcast("On_BuildingUpdate ADDED" + str(be.BuildingPart.Health) + " by " + builder)
Then later:

Python:
def On_BuildingPartAttacked(self, bhe):
        if DataStore.ContainsValue("nPart_Data", bhe.Victim.Location)
You get your build GameID and can compare it to the person hitting it.

Problem is till the frame reaches lvl1, it can decay and we would still have the entry in the DataStore, so finding a way to detect level 1, THEN saving the BP in the DataStore would be better.
There is a hook called when its not a frame anymore
 

s8.inno

New Member
Member
Oct 9, 2014
4
0
1
42
New Zealand
public float Health {
get {
return buildingBlock.health;
}
}

Is it possible to add something like
set {
buildingBlock.health = *I have no idea how to get params :D, never written a line of C#*
}
 

coersum

Plugin Developer
Plugin Developer
Oct 9, 2014
77
5
8
47
Parts Unknown
There is a hook called when its not a frame anymore
ah yeah at the time, I didn't want to have to check with every hammer hit, but check Hp is the same lol.. it was LATE last night...

As far as location, it seems 2 pieces can not be at the same space from my tests (I believe it gives us the origin of the block, so it's unique and can be gotten when destroying it to find who built it)
 
Status
Not open for further replies.