Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
PlacementHook.cs
Go to the documentation of this file.
1using System;
2
4
5public struct PlacementHook
6{
7 public Func<int, int, int, int, int, int, int> hook;
8
9 public int badReturn;
10
11 public int badResponse;
12
14
15 public static PlacementHook Empty = new PlacementHook(null, 0, 0, processedCoordinates: false);
16
17 public const int Response_AllInvalid = 0;
18
19 public PlacementHook(Func<int, int, int, int, int, int, int> hook, int badReturn, int badResponse, bool processedCoordinates)
20 {
21 this.hook = hook;
22 this.badResponse = badResponse;
23 this.badReturn = badReturn;
24 this.processedCoordinates = processedCoordinates;
25 }
26
27 public static bool operator ==(PlacementHook first, PlacementHook second)
28 {
29 if (first.hook == second.hook && first.badResponse == second.badResponse && first.badReturn == second.badReturn)
30 {
31 return first.processedCoordinates == second.processedCoordinates;
32 }
33 return false;
34 }
35
36 public static bool operator !=(PlacementHook first, PlacementHook second)
37 {
38 if (!(first.hook != second.hook) && first.badResponse == second.badResponse && first.badReturn == second.badReturn)
39 {
40 return first.processedCoordinates != second.processedCoordinates;
41 }
42 return true;
43 }
44
45 public override bool Equals(object obj)
46 {
47 if (obj is PlacementHook)
48 {
49 return this == (PlacementHook)obj;
50 }
51 return false;
52 }
53
54 public override int GetHashCode()
55 {
56 return base.GetHashCode();
57 }
58}
override bool Equals(object obj)
Func< int, int, int, int, int, int, int > hook
PlacementHook(Func< int, int, int, int, int, int, int > hook, int badReturn, int badResponse, bool processedCoordinates)
static bool operator==(PlacementHook first, PlacementHook second)
static bool operator!=(PlacementHook first, PlacementHook second)